WordPress.org

Make WordPress Core

Ticket #2658: tinymce-versioning.diff

File tinymce-versioning.diff, 7.7 KB (added by skeltoac, 14 years ago)
  • js/tinymce/plugins/inlinepopups/editor_plugin.js

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

     
    7272        content_css : "<?php echo $mce_css; ?>",
    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; ?>"
    7778};
  • js/tinymce/tiny_mce_gzip.php

     
    44 * $Revision: $
    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
    1212 * enables the browser to do two requests instead of one for each .js file.
     
    1515
    1616@require_once('../../../wp-config.php');
    1717
    18 gzip_compression();
     18// gzip_compression();
    1919
    2020function wp_tinymce_lang($path) {
    2121        global $language;
     
    119119        else
    120120                echo $str;
    121121}
    122 /* WP
     122
    123123// Only gzip the contents if clients and server support it
    124124$encodings = array();
    125125
     
    127127        $encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));
    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;
    136138        }
     
    139141                ob_start("ob_gzhandler");
    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
    149152                TinyMCE_echo('tinyMCE = realTinyMCE;');
     
    151154        // Do init based on index
    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
    164171        $plugins = explode(",", $plugins);
     
    194201                }
    195202
    196203                // Output
    197                 header("Content-Encoding: gzip");
     204                header("Content-Encoding: " . $enc);
    198205                echo $cacheData;
    199206        }
    200207
     
    205212function TinyMCECompressed() {
    206213        this.configs = new Array();
    207214        this.loadedFiles = new Array();
     215        this.externalPlugins = new Array();
    208216        this.loadAdded = false;
    209217        this.isLoaded = false;
    210218}
     
    227235        this.configs[this.configs.length] = settings;
    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
    233242        if (!this.loadAdded) {
     
    244253        tinyMCE = realTinyMCE;
    245254        TinyMCE_Engine.prototype.onLoad();
    246255        tinyMCE._addUnloadEvents();
     256
    247257        tinyMCE.isLoaded = true;
    248258}
    249259
     
    255265}
    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
    265277                for (var x=0; x<this.loadedFiles.length; x++) {
     
    283295        }
    284296
    285297        return str;
    286 }
     298};
    287299
     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};
     327
    288328var tinyMCE = new TinyMCECompressed();
    289329var tinyMCECompressed = tinyMCE;
  • functions-post.php

     
    10331033 * Places two script links in <head>: one to get tinyMCE (big), one to configure and start it (small)
    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";
    10401040        echo "<script type='text/javascript' src='$src2'></script>\n";