-1) { // Write main script and patch some things if ($index == 0) { TinyMCE_echo(file_get_contents(realpath("tiny_mce" . $suffix . ".js"))); 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 theme, language pack and theme language packs if ($theme) { TinyMCE_echo(file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js"))); TinyMCE_echo(file_get_contents(realpath("themes/" . $theme . "/langs/" . $lang . ".js"))); } if ($language) TinyMCE_echo(file_get_contents(realpath("langs/" . $language . ".js"))); // Load all plugins and their language packs $plugins = explode(",", $plugins); foreach ($plugins as $plugin) { $pluginFile = realpath("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js"); $languageFile = realpath("plugins/" . $plugin . "/langs/" . $lang . ".js"); if ($pluginFile) TinyMCE_echo(file_get_contents($pluginFile)); if ($languageFile) TinyMCE_echo(file_get_contents($languageFile)); } // Reset tinyMCE compressor engine TinyMCE_echo("tinyMCE = tinyMCECompressed;"); // Write to cache if ($diskCache) { // Calculate compression ratio and debug target output path if ($debug) { $ratio = round(100 - strlen(gzencode($cacheData, 9, FORCE_GZIP)) / strlen($cacheData) * 100.0); TinyMCE_echo("alert('TinyMCE was compressed by " . $ratio . "%.\\nOutput cache file: " . $cacheFile . "');"); } $cacheData = gzencode($cacheData, 9, FORCE_GZIP); // Write to file if possible $fp = @fopen($cacheFile, "wb"); if ($fp) { fwrite($fp, $cacheData); fclose($fp); } // Output header("Content-Encoding: gzip"); echo $cacheData; } die; } ?> function TinyMCECompressed() { this.configs = new Array(); this.loadedFiles = new Array(); this.loadAdded = false; this.isLoaded = false; } TinyMCECompressed.prototype.init = function(settings) { var elements = document.getElementsByTagName('script'); var scriptURL = ""; for (var i=0; i'); if (!this.loadAdded) { tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCECompressed.prototype.onLoad); tinyMCE.addEvent(window, "load", TinyMCECompressed.prototype.onLoad); this.loadAdded = true; } } TinyMCECompressed.prototype.onLoad = function() { if (tinyMCE.isLoaded) return true; tinyMCE = realTinyMCE; TinyMCE_Engine.prototype.onLoad(); tinyMCE._addUnloadEvents(); tinyMCE.isLoaded = true; } TinyMCECompressed.prototype.addEvent = function(o, n, h) { if (o.attachEvent) o.attachEvent("on" + n, h); else o.addEventListener(n, h, false); } TinyMCECompressed.prototype.getOnce = function(str) { var ar = str.split(','); for (var i=0; i