WordPress.org

Make WordPress Core

Changeset 3703


Ignore:
Timestamp:
04/13/2006 02:57:25 AM (14 years ago)
Author:
ryan
Message:

Thwart the browser cache by versioning tinyMCE. Props to that Andy guy. fixes #2658

Location:
trunk/wp-includes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions-post.php

    r3664 r3703  
    10341034 */
    10351035function tinymce_include() {
    1036     $src1 = get_settings('siteurl') . '/wp-includes/js/tinymce/tiny_mce_gzip.php';
    1037     $src2 = get_settings('siteurl') . '/wp-includes/js/tinymce/tiny_mce_config.php';
     1036    $src1 = get_settings('siteurl') . '/wp-includes/js/tinymce/tiny_mce_gzip.php?ver=04122006';
     1037    $src2 = get_settings('siteurl') . '/wp-includes/js/tinymce/tiny_mce_config.php?ver=04122006';
    10381038
    10391039    echo "<script type='text/javascript' src='$src1'></script>\n";
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js

    r3698 r3703  
    7474    pos.absLeft += Math.round((elm.firstChild.clientWidth / 2) - (width / 2));
    7575    pos.absTop += Math.round((elm.firstChild.clientHeight / 2) - (height / 2));
     76
     77    url += tinyMCE.settings['imp_version'] ? (url.indexOf('?')==-1?'?':'&') + 'ver=' + tinyMCE.settings['imp_version'] : '';
    7678
    7779    mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop);
  • trunk/wp-includes/js/tinymce/tiny_mce_config.php

    r3664 r3703  
    7373    valid_elements : "<?php echo $valid_elements; ?>",
    7474    save_callback : 'TinyMCE_wordpressPlugin.saveCallback',
     75    imp_version : "<?php echo intval($_GET['ver']); ?>",
    7576<?php do_action('mce_options'); ?>
    7677    plugins : "<?php echo $plugins; ?>"
  • trunk/wp-includes/js/tinymce/tiny_mce_gzip.php

    r3664 r3703  
    55 * $Date: $
    66 *
    7  * @version 1.07
     7 * @version 1.08
    88 * @author Moxiecode
    9  * @copyright Copyright © 20052006, Moxiecode Systems AB, All rights reserved.
     9 * @copyright Copyright © 2005-2006, Moxiecode Systems AB, All rights reserved.
    1010 *
    1111 * This file compresses the TinyMCE JavaScript using GZip and
     
    1616@require_once('../../../wp-config.php');
    1717
    18 gzip_compression();
     18// gzip_compression();
    1919
    2020function wp_tinymce_lang($path) {
     
    120120        echo $str;
    121121}
    122 /* WP
     122
    123123// Only gzip the contents if clients and server support it
    124124$encodings = array();
     
    128128
    129129// Check for gzip header or northon internet securities
    130 if ((in_array('gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) {
     130if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) {
     131    $enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip";
     132
    131133    // Use cached file if it exists but not in debug mode
    132134    if (file_exists($cacheFile) && !$debug) {
    133         header("Content-Encoding: gzip");
     135        header("Content-Encoding: " . $enc);
    134136        echo file_get_contents($cacheFile);
    135137        die;
     
    140142} else
    141143    $diskCache = false;
    142 WP */
     144
    143145if ($index > -1) {
    144146    // Write main script and patch some things
    145147    if ($index == 0) {
    146148        TinyMCE_echo(wp_compact_tinymce_js(file_get_contents(realpath("tiny_mce" . $suffix . ".js")))); // WP
     149        TinyMCE_echo('TinyMCE.prototype.orgLoadScript = TinyMCE.prototype.loadScript;');
    147150        TinyMCE_echo('TinyMCE.prototype.loadScript = function() {};var realTinyMCE = tinyMCE;');
    148151    } else
     
    152155    TinyMCE_echo("tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);");
    153156
     157    // Load external plugins
     158    if ($index == 0)
     159        TinyMCE_echo("tinyMCECompressed.loadPlugins();");
     160
    154161    // Load theme, language pack and theme language packs
    155162    if ($theme) {
    156         TinyMCE_echo(wp_compact_tinymce_js(file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js"))));
     163        TinyMCE_echo(wp_compact_tinymce_js(file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js")))); // WP
    157164        TinyMCE_echo(wp_tinymce_lang("themes/" . $theme . "/langs/%s.js")); // WP
    158165    }
    159166
    160167    /* WP if ($language) WP */
    161         TinyMCE_echo(wp_tinymce_lang("langs/%s.js"));
     168        TinyMCE_echo(wp_tinymce_lang("langs/%s.js")); // WP
    162169
    163170    // Load all plugins and their language packs
     
    195202
    196203        // Output
    197         header("Content-Encoding: gzip");
     204        header("Content-Encoding: " . $enc);
    198205        echo $cacheData;
    199206    }
     
    206213    this.configs = new Array();
    207214    this.loadedFiles = new Array();
     215    this.externalPlugins = new Array();
    208216    this.loadAdded = false;
    209217    this.isLoaded = false;
     
    228236    this.settings = settings;
    229237
    230     scriptURL += "?theme=" + escape(this.getOnce(settings["theme"])) + "&language=" + escape(this.getOnce(settings["language"])) + "&plugins=" + escape(this.getOnce(settings["plugins"])) + "&lang=" + settings["language"] + "&index=" + escape(this.configs.length-1);
     238    scriptURL += (scriptURL.indexOf('?') == -1) ? '?' : '&';
     239    scriptURL += "theme=" + escape(this.getOnce(settings["theme"])) + "&language=" + escape(this.getOnce(settings["language"])) + "&plugins=" + escape(this.getOnce(settings["plugins"])) + "&lang=" + settings["language"] + "&index=" + escape(this.configs.length-1);
    231240    document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>');
    232241
     
    245254    TinyMCE_Engine.prototype.onLoad();
    246255    tinyMCE._addUnloadEvents();
     256
    247257    tinyMCE.isLoaded = true;
    248258}
     
    256266
    257267TinyMCECompressed.prototype.getOnce = function(str) {
    258     var ar = str.split(',');
     268    var ar = str.replace(/\s+/g, '').split(',');
    259269
    260270    for (var i=0; i<ar.length; i++) {
    261         if (ar[i] == '')
     271        if (ar[i] == '' || ar[i].charAt(0) == '-') {
     272            ar[i] = null;
    262273            continue;
     274        }
    263275
    264276        // Skip load
     
    284296
    285297    return str;
    286 }
     298};
     299
     300TinyMCECompressed.prototype.loadPlugins = function() {
     301    var i, ar;
     302
     303    TinyMCE.prototype.loadScript = TinyMCE.prototype.orgLoadScript;
     304    tinyMCE = realTinyMCE;
     305
     306    ar = tinyMCECompressed.externalPlugins;
     307    for (i=0; i<ar.length; i++)
     308        tinyMCE.loadPlugin(ar[i].name, ar[i].url);
     309
     310    TinyMCE.prototype.loadScript = function() {};
     311};
     312
     313TinyMCECompressed.prototype.loadPlugin = function(n, u) {
     314    this.externalPlugins[this.externalPlugins.length] = {name : n, url : u};
     315};
     316
     317TinyMCECompressed.prototype.importPluginLanguagePack = function(n, v) {
     318    tinyMCE = realTinyMCE;
     319    TinyMCE.prototype.loadScript = TinyMCE.prototype.orgLoadScript;
     320    tinyMCE.importPluginLanguagePack(n, v);
     321};
     322
     323TinyMCECompressed.prototype.addPlugin = function(n, p) {
     324    tinyMCE = realTinyMCE;
     325    tinyMCE.addPlugin(n, p);
     326};
    287327
    288328var tinyMCE = new TinyMCECompressed();
Note: See TracChangeset for help on using the changeset viewer.