WordPress.org

Make WordPress Core

Ticket #2058: 2058.diff

File 2058.diff, 26.3 KB (added by skeltoac, 13 years ago)
  • wp-includes/js/tinymce/tiny_mce_gzip.php

     
    1616         *  - Add local file cache for the GZip:ed version.
    1717         */
    1818
    19         @ include('../../../wp-config.php');
     19        /* Heavily edited to add flexibilty in WordPress */
     20        @ require('../../../wp-config.php');
    2021
    2122        function wp_translate_tinymce_lang($text) {
    2223                if ( ! function_exists('__') ) {
     
    5354        }
    5455
    5556        // General options
    56         $suffix = "";                                                   // Set to "_src" to use source version
    57         $expiresOffset = 3600 * 24 * 10;                // 10 days util client cache expires
     57        $expiresOffset = 3600 * 24 * 30; // 30 days util client cache expires
    5858
    59         // Get data to load
    60         $theme = isset($_REQUEST['theme']) ? $_REQUEST['theme'] : "";
    61         $language = isset($_REQUEST['language']) ? $_REQUEST['language'] : "";
    62         $plugins = isset($_REQUEST['plugins']) ? $_REQUEST['plugins'] : "";
    63         $lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : "en";
    64         $index = isset($_REQUEST['index']) ? $_REQUEST['index'] : -1;
    65 
    6659        // Only gzip the contents if clients and server support it
    6760        $encodings = explode(',', strtolower($_SERVER['HTTP_ACCEPT_ENCODING']));
    6861        if (in_array('gzip', $encodings) && function_exists('ob_gzhandler'))
     
    7063
    7164        // Output rest of headers
    7265        header("Content-type: text/javascript; charset: UTF-8");
    73         // header("Cache-Control: must-revalidate");
    7466        header("Vary: Accept-Encoding"); // Handle proxies
    7567        header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
    7668
    77         if ($index > -1) {
    78                 // Write main script and patch some things
    79                 if ($index == 0) {
    80 // WP                   echo file_get_contents(realpath("tiny_mce" . $suffix . ".js"));
    81                         $tinymce = file_get_contents(realpath("tiny_mce.js"));
    82                         echo wp_compact_tinymce_js($tinymce);
    83                         echo "\n\n";
    84                         echo "TinyMCE.prototype.loadScript = function() {};\n";
    85                 }
     69        // Write main script
     70        $tinymce = file_get_contents(realpath("tiny_mce.js"));
     71        echo wp_compact_tinymce_js($tinymce);
     72        echo "\n\n";
    8673
    87                 // WP
    88                 $lang = $language = 'en';
    89                 echo "\n/* WP Cancels all TinyMCE language handling */\n";
    90                 echo "TinyMCE.prototype.importThemeLanguagePack = function() {};\n";
    91                 echo "TinyMCE.prototype.importPluginLanguagePack = function() {};\n\n";
     74        // Remove some functions
     75        echo "\n/* WP cancels all TinyMCE language and import handling */\n";
     76        echo "TinyMCE.prototype.importThemeLanguagePack = function() {};\n";
     77        echo "TinyMCE.prototype.importPluginLanguagePack = function() {};\n\n";
     78        echo "TinyMCE.prototype.loadScript = function() {};\n";
    9279
    93                 // Do init based on index
    94 // WP           echo "tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);\n\n";
     80        // Load theme, language pack and theme language packs
     81        $theme = apply_filters('mce_theme', 'advanced');
     82        echo wp_compact_tinymce_js(file_get_contents(realpath("themes/" . $theme . "/editor_template.js")));
     83        echo wp_translate_tinymce_lang(file_get_contents(realpath("themes/" . $theme . "/langs/en.js")));
     84        echo wp_translate_tinymce_lang(file_get_contents(realpath("langs/en.js")));
    9585
    96                 // Load theme, language pack and theme language packs
    97                 if ($theme) {
    98                         echo file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js"));
    99                         echo wp_translate_tinymce_lang(file_get_contents(realpath("themes/" . $theme . "/langs/" . $lang . ".js")));
    100                 }
     86        // Load all plugins and their language packs
     87        $plugins = apply_filters('mce_plugins', array('wordpress', 'autosave', 'wphelp'));
     88        foreach ($plugins as $plugin) {
     89                $pluginFile = realpath("plugins/" . $plugin . "/editor_plugin.js");
     90                $languageFile = realpath("plugins/" . $plugin . "/langs/en.js");
    10191
    102                 if ($language)
    103                         echo wp_translate_tinymce_lang(file_get_contents(realpath("langs/" . $language . ".js")));
     92                if ($pluginFile)
     93                        echo file_get_contents($pluginFile);
    10494
    105                 // Load all plugins and their language packs
    106                 $plugins = explode(",", $plugins);
    107                 foreach ($plugins as $plugin) {
    108                         $pluginFile = realpath("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");
    109                         $languageFile = realpath("plugins/" . $plugin . "/langs/" . $lang . ".js");
    110 
    111                         if ($pluginFile)
    112                                 echo file_get_contents($pluginFile);
    113 
    114                         if ($languageFile)
    115                                 echo wp_translate_tinymce_lang(file_get_contents($languageFile));
    116                 }
    117 
    118                 die;
     95                if ($languageFile)
     96                        echo wp_translate_tinymce_lang(file_get_contents($languageFile));
    11997        }
     98
     99        // Set up init variables
     100        if ( current_user_can('unfiltered_html') ) // Use the full XHTML set provided in the docs
     101                $valid_elements = 'a[accesskey|charset|class|coords|dir<ltr?rtl|href|hreflang|id|lang|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rel|rev|shape<circle?default?poly?rect|style|tabindex|title|target|type],abbr[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],acronym[class|dir<ltr?rtl|id|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],address[class|align|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],applet[align<bottom?left?middle?right?top|alt|archive|class|code|codebase|height|hspace|id|name|object|style|title|vspace|width],area[accesskey|alt|class|coords|dir<ltr?rtl|href|id|lang|nohref<nohref|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|shape<circle?default?poly?rect|style|tabindex|title|target],base[href|target],basefont[color|face|id|size],bdo[class|dir<ltr?rtl|id|lang|style|title],big[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],blockquote[dir|style|cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],body[alink|background|bgcolor|class|dir<ltr?rtl|id|lang|link|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onunload|style|title|text|vlink],br[class|clear<all?left?none?right|id|style|title],button[accesskey|class|dir<ltr?rtl|disabled<disabled|id|lang|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|tabindex|title|type|value],caption[align<bottom?left?right?top|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],center[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],'
     102                        . 'cite[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],code[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],col[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title|valign<baseline?bottom?middle?top|width],colgroup[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title|valign<baseline?bottom?middle?top|width],dd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],del[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],dfn[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],dir[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],div[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],dl[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],dt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],em/i[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],'
     103                        . 'fieldset[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],font[class|color|dir<ltr?rtl|face|id|lang|size|style|title],form[accept|accept-charset|action|class|dir<ltr?rtl|enctype|id|lang|method<get?post|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onreset|onsubmit|style|title|target],frame[class|frameborder|id|longdesc|marginheight|marginwidth|name|noresize<noresize|scrolling<auto?no?yes|src|style|title],frameset[class|cols|id|onload|onunload|rows|style|title],h1[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h2[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h3[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h4[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h5[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h6[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],head[dir<ltr?rtl|lang|profile],hr[align<center?left?right|class|dir<ltr?rtl|id|lang|noshade<noshade|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|size|style|title|width],html[dir<ltr?rtl|lang|version],'
     104                        . 'iframe[align<bottom?left?middle?right?top|class|frameborder|height|id|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style|title|width],img[align<bottom?left?middle?right?top|alt|border|class|dir<ltr?rtl|height|hspace|id|ismap<ismap|lang|longdesc|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|src|style|title|usemap|vspace|width],input[accept|accesskey|align<bottom?left?middle?right?top|alt|checked<checked|class|dir<ltr?rtl|disabled<disabled|id|ismap<ismap|lang|maxlength|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect|readonly<readonly|size|src|style|tabindex|title|type<button?checkbox?file?hidden?image?password?radio?reset?submit?text|usemap|value],ins[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],isindex[class|dir<ltr?rtl|id|lang|prompt|style|title],kbd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],label[accesskey|class|dir<ltr?rtl|for|id|lang|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],legend[align<bottom?left?right?top|accesskey|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],li[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|type|value],link[charset|class|dir<ltr?rtl|href|hreflang|id|lang|media|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rel|rev|style|title|target|type],map[class|dir<ltr?rtl|id|lang|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],'
     105                        . 'menu[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],meta[content|dir<ltr?rtl|http-equiv|lang|name|scheme],noframes[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],noscript[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],object[align<bottom?left?middle?right?top|archive|border|class|classid|codebase|codetype|data|declare|dir<ltr?rtl|height|hspace|id|lang|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|standby|style|tabindex|title|type|usemap|vspace|width],ol[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|start|style|title|type],optgroup[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],option[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|selected<selected|style|title|value],p[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],param[id|name|type|value|valuetype<DATA?OBJECT?REF],pre/listing/plaintext/xmp[align|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|width],q[cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],'
     106                        . 's[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],samp[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],script[charset|defer|language|src|type],select[class|dir<ltr?rtl|disabled<disabled|id|lang|multiple<multiple|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|size|style|tabindex|title],small[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],span[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],strike[class|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],strong/b[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],style[dir<ltr?rtl|lang|media|title|type],sub[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],sup[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],table[align<center?left?right|bgcolor|border|cellpadding|cellspacing|class|dir<ltr?rtl|frame|height|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rules|style|summary|title|width],'
     107                        . 'tbody[align<center?char?justify?left?right|char|class|charoff|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|valign<baseline?bottom?middle?top],td[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup|style|title|valign<baseline?bottom?middle?top|width],textarea[accesskey|class|cols|dir<ltr?rtl|disabled<disabled|id|lang|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect|readonly<readonly|rows|style|tabindex|title],tfoot[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|valign<baseline?bottom?middle?top],th[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup|style|title|valign<baseline?bottom?middle?top|width],thead[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|valign<baseline?bottom?middle?top],'
     108                        . 'title[dir<ltr?rtl|lang],tr[abbr|align<center?char?justify?left?right|bgcolor|char|charoff|class|rowspan|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|valign<baseline?bottom?middle?top],tt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],u[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],ul[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|type],var[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
     109        else // Use a much smaller set
     110                $valid_elements = '-a[id|href|title|rel],-strong/b,-em/i,-strike,-del,-u,p[class|align|dir],-ol,-ul,-li,br,img[class|src|alt|title|width|height|align],-sub,-sup,-blockquote[dir],-table[border|cellspacing|cellpadding|width|height|class|align|dir],thead[class|rowspan|width|height|align|valign|dir],tr[class|rowspan|width|height|align|valign|dir],th[dir|class|colspan|rowspan|width|height|align|valign|scope],td[dir|class|colspan|rowspan|width|height|align|valign],-div[dir|class|align],-span[class|align],-pre[class],-code[class],-address,-h1[class|align|dir],-h2[class|align|dir],-h3[class|align|dir],-h4[class|align|dir],-h5[class|align|dir],-h6[class|align|dir],hr';
     111        $valid_elements = apply_filters('mce_valid_elements', $valid_elements);
     112        $plugins = implode($plugins, ',');
     113        $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright' ,'separator', 'link', 'unlink', 'image', 'wordpress', 'separator', 'undo', 'redo', 'code', 'wphelp'));
     114        $mce_buttons = implode($mce_buttons, ',');
     115        $mce_buttons_2 = apply_filters('mce_buttons_2', array());
     116        $mce_buttons_2 = implode($mce_buttons_2, ',');
     117        $mce_buttons_3 = apply_filters('mce_buttons_3', array());
     118        $mce_buttons_3 = implode($mce_buttons_3, ',');
     119        $mce_browsers = apply_filters('mce_browsers', array('msie', 'gecko', 'opera'));
     120        $mce_browsers = implode($mce_browsers, ',');
    120121?>
     122tinyMCE.init({
     123        mode : "specific_textareas",
     124        textarea_trigger : "title",
     125        width : "100%",
     126        theme : "advanced",
     127        theme_advanced_buttons1 : "<?php echo $mce_buttons; ?>",
     128        theme_advanced_buttons2 : "<?php echo $mce_buttons_2; ?>",
     129        theme_advanced_buttons3 : "<?php echo $mce_buttons_3; ?>",
     130        theme_advanced_toolbar_location : "top",
     131        theme_advanced_toolbar_align : "left",
     132        theme_advanced_path_location : "bottom",
     133        theme_advanced_resizing : true,
     134        browsers : "<?php echo $mce_browsers; ?>",
     135        dialog_type : "modal",
     136        theme_advanced_resize_horizontal : false,
     137        entity_encoding : "raw",
     138        relative_urls : false,
     139        remove_script_host : false,
     140        force_p_newlines : true,
     141        force_br_newlines : false,
     142        convert_newlines_to_brs : false,
     143        remove_linebreaks : true,
     144        save_callback : "wp_save_callback",
     145        valid_elements : "<?php echo $valid_elements; ?>",
     146<?php do_action('mce_options'); ?>
     147        plugins : "<?php echo $plugins; ?>"
     148});
    121149
    122 function TinyMCECompressed() {
    123         this.configs = new Array();
    124         this.loadedFiles = new Array();
    125 }
    126 
    127 TinyMCECompressed.prototype.init = function(settings) {
    128         var elements = document.getElementsByTagName('script');
    129         var scriptURL = "";
    130 
    131         for (var i=0; i<elements.length; i++) {
    132                 if (elements[i].src && elements[i].src.indexOf("tiny_mce_gzip.php") != -1) {
    133                         scriptURL = elements[i].src;
    134                         break;
    135                 }
    136         }
    137 
    138         settings["theme"] = typeof(settings["theme"]) != "undefined" ? settings["theme"] : "default";
    139         settings["plugins"] = typeof(settings["plugins"]) != "undefined" ? settings["plugins"] : "";
    140         settings["language"] = typeof(settings["language"]) != "undefined" ? settings["language"] : "en";
    141         settings["button_tile_map"] = typeof(settings["button_tile_map"]) != "undefined" ? settings["button_tile_map"] : true;
    142         this.configs[this.configs.length] = settings;
    143         this.settings = settings;
    144 
    145         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);
    146         document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>');
    147 }
    148 
    149 TinyMCECompressed.prototype.getOnce = function(str) {
    150         var ar = str.split(',');
    151 
    152         for (var i=0; i<ar.length; i++) {
    153                 if (ar[i] == '')
    154                         continue;
    155 
    156                 // Skip load
    157                 for (var x=0; x<this.loadedFiles.length; x++) {
    158                         if (this.loadedFiles[x] == ar[i])
    159                                 ar[i] = null;
    160                 }
    161 
    162                 this.loadedFiles[this.loadedFiles.length] = ar[i];
    163         }
    164 
    165         // Glue
    166         str = "";
    167         for (var i=0; i<ar.length; i++) {
    168                 if (ar[i] == null)
    169                         continue;
    170 
    171                 str += ar[i];
    172 
    173                 if (i != ar.length-1)
    174                         str += ",";
    175         }
    176 
    177         return str;
    178 }
    179 
    180 var tinyMCE = new TinyMCECompressed();
    181 var tinyMCECompressed = tinyMCE;
  • wp-admin/admin-header.php

     
    7979<script type="text/javascript" src="../wp-includes/js/tw-sack.js"></script>
    8080<script type="text/javascript" src="list-manipulation.js"></script>
    8181<?php if ( isset( $editing ) ) : ?>
    82 <?php if ( $editing && user_can_richedit() ) :
    83 $mce_plugins = apply_filters('mce_plugins', array('wordpress', 'autosave', 'wphelp'));
    84 $mce_plugins = implode($mce_plugins, ',');
    85 $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright' ,'separator', 'link', 'unlink', 'image', 'emotions', 'wordpress', 'separator', 'undo', 'redo', 'code', 'wphelp'));
    86 $mce_buttons = implode($mce_buttons, ',');
    87 $mce_buttons_2 = apply_filters('mce_buttons_2', array());
    88 $mce_buttons_2 = implode($mce_buttons_2, ',');
    89 ?>
    90 <script language="javascript" type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php?index=0&theme=advanced&plugins=<?php echo $mce_plugins; ?>"></script>
    91 <script type="text/javascript">
    92 tinyMCE.init({
    93         mode : "specific_textareas",
    94         textarea_trigger : "title",
    95         width : "100%",
    96         theme : "advanced",
    97         theme_advanced_buttons1 : "<?php echo $mce_buttons; ?>",
    98         theme_advanced_buttons2 : "<?php echo $mce_buttons_2; ?>",
    99         theme_advanced_buttons3 : "",
    100         theme_advanced_toolbar_location : "top",
    101         theme_advanced_toolbar_align : "left",
    102         theme_advanced_path_location : "bottom",
    103         theme_advanced_resizing : true,
    104         browsers : "msie,gecko,opera",
    105         dialog_type : "modal",
    106         theme_advanced_resize_horizontal : false,
    107         entity_encoding : "raw",
    108         relative_urls : false,
    109         remove_script_host : false,
    110         force_p_newlines : true,
    111         force_br_newlines : false,
    112         convert_newlines_to_brs : false,
    113         remove_linebreaks : true,
    114         save_callback : "wp_save_callback",
    115 <?php if (current_user_can('unfiltered_html') == false) : ?>
    116 valid_elements : "-a[id|href|title|rel],-strong/b,-em/i,-strike,-del,-u,p[class|align|dir],-ol,-ul,-li,br,img[class|src|alt|title|width|height|align],-sub,-sup,-blockquote[dir],-table[border=0|cellspacing|cellpadding|width|height|class|align|dir],thead[class|rowspan|width|height|align|valign|dir],tr[class|rowspan|width|height|align|valign|dir],th[dir|class|colspan|rowspan|width|height|align|valign|scope],td[dir|class|colspan|rowspan|width|height|align|valign],-div[dir|class|align],-span[class|align],-pre[class],-code[class],-address,-h1[class|align|dir],-h2[class|align|dir],-h3[class|align|dir],-h4[class|align|dir],-h5[class|align|dir],-h6[class|align|dir],hr",
     82<?php if ( $editing && user_can_richedit() ) : ?>
     83<script language="javascript" type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php?ver=20051211"></script>
    11784<?php endif; ?>
    118         plugins : "<?php echo $mce_plugins; ?>"
    119         <?php do_action('mce_options'); ?>
    120 });
    121 </script>
    122 <?php endif; ?>
    12385<script type="text/javascript" src="../wp-includes/js/dbx.js"></script>
    12486<script type="text/javascript" src="../wp-includes/js/dbx-key.js"></script>
    12587