// Load external plugins if ($index == 0) { $content .= "tinyMCECompressed.loadPlugins();"; } // Add core languages $lang_content = ''; foreach ($languages as $lang) { $lang_content .= getFileContents("langs/" . $lang . ".js"); } if (empty($lang_content)) { $lang_content .= getFileContents("langs/en.js"); } $content .= $lang_content; // Add themes foreach ($themes as $theme) { $content .= wp_compact_tinymce_js(getFileContents("themes/" . $theme . "/editor_template" . $suffix . ".js")); $lang_content = ''; foreach ($languages as $lang) { $lang_content .= getFileContents("themes/" . $theme . "/langs/" . $lang . ".js"); } if (empty($lang_content)) { $lang_content .= getFileContents("themes/" . $theme . "/langs/en.js"); } $content .= $lang_content; } // Add plugins foreach ($plugins as $plugin) { $content .= getFileContents("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js"); $lang_content = ''; foreach ($languages as $lang) { $lang_content .= getFileContents("plugins/" . $plugin . "/langs/" . $lang . ".js");
TinyMCE_echo(wp_compact_tinymce_js(file_get_contents(realpath("tiny_mce" . $suffix . ".js")))); // WP TinyMCE_echo('TinyMCE.prototype.orgLoadScript = TinyMCE.prototype.loadScript;'); TinyMCE_echo('TinyMCE.prototype.loadScript = function() {};var realTinyMCE = tinyMCE;'); } else { TinyMCE_echo('tinyMCE = realTinyMCE;'); } // Do init based on index TinyMCE_echo("tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);"); // Load external plugins if ($index == 0) { TinyMCE_echo("tinyMCECompressed.loadPlugins();"); } // Load theme, language pack and theme language packs if ($theme) { TinyMCE_echo(wp_compact_tinymce_js(file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js")))); // WP TinyMCE_echo(wp_tinymce_lang("themes/" . $theme . "/langs/%s.js")); // WP } /* WP if ($language) WP */ TinyMCE_echo(wp_tinymce_lang("langs/%s.js")); // WP // Load all plugins and their language packs $plugins = explode(",", $plugins); foreach ($plugins as $plugin) { $pluginFile = realpath("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js"); /* WP $languageFile = realpath("plugins/" . $plugin . "/langs/" . $lang . ".js"); WP */ if ($pluginFile) { TinyMCE_echo(file_get_contents($pluginFile)); }
header("Content-type: text/javascript; charset: UTF-8"); header("Vary: Accept-Encoding"); // Handle proxies header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT"); // Write main script $tinymce = file_get_contents(realpath("tiny_mce.js")); echo wp_compact_tinymce_js($tinymce); echo "\n\n"; // Remove some functions echo "\n/* WP cancels all TinyMCE language and import handling */\n"; echo "TinyMCE.prototype.importThemeLanguagePack = function() {};\n"; echo "TinyMCE.prototype.importPluginLanguagePack = function() {};\n\n"; echo "TinyMCE.prototype.loadScript = function() {};\n"; // Load theme, language pack and theme language packs $theme = apply_filters('mce_theme', 'advanced'); echo wp_compact_tinymce_js(file_get_contents(realpath("themes/" . $theme . "/editor_template.js"))); echo wp_translate_tinymce_lang(file_get_contents(realpath("themes/" . $theme . "/langs/en.js"))); echo wp_translate_tinymce_lang(file_get_contents(realpath("langs/en.js"))); // Load all plugins and their language packs $plugins = apply_filters('mce_plugins', array('wordpress', 'autosave', 'wphelp')); foreach ($plugins as $plugin) { $pluginFile = realpath("plugins/" . $plugin . "/editor_plugin.js"); $languageFile = realpath("plugins/" . $plugin . "/langs/en.js"); if ($pluginFile) { echo file_get_contents($pluginFile); } if ($languageFile) { echo wp_translate_tinymce_lang(file_get_contents($languageFile)); } } // Set up init variables