Changeset 6694 for trunk/wp-includes/js/tinymce/tiny_mce_gzip.php
- Timestamp:
- 01/31/2008 06:10:46 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/tinymce/tiny_mce_gzip.php
r6632 r6694 1 1 <?php 2 2 /** 3 * $Id: tiny_mce_gzip.php 158 2006-12-21 14:32:19Z spocke $3 * $Id: tiny_mce_gzip.php 315 2007-10-25 14:03:43Z spocke $ 4 4 * 5 5 * @author Moxiecode 6 * @copyright Copyright 2005-2006, Moxiecode Systems AB, All rights reserved.6 * @copyright Copyright © 2005-2006, Moxiecode Systems AB, All rights reserved. 7 7 * 8 8 * This file compresses the TinyMCE JavaScript using GZip and … … 10 10 * Notice: This script defaults the button_tile_map option to true for extra performance. 11 11 */ 12 13 //error_reporting(E_ALL); 14 @require_once('../../../wp-config.php'); // For get_bloginfo(). 12 15 13 @require_once('../../../wp-config.php'); // For get_bloginfo(). 14 ?> 15 var scriptURL = '<?php echo get_bloginfo('wpurl') . '/' . WPINC; ?>/js/tinymce/tiny_mce.js'; 16 document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>'); 17 <?php 18 exit; // tiny_mce_gzip.php needs changes, but also it's much easier to test the js when it's not in one big file 19 16 // Headers 17 $expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache 18 header("Content-type: text/javascript"); 19 header("Vary: Accept-Encoding"); // Handle proxies 20 header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT"); 21 22 if ( isset($_GET['load']) ) { 23 24 function getParam( $name, $def = false ) { 25 if ( ! isset($_GET[$name]) ) 26 return $def; 27 28 return preg_replace( "/[^0-9a-z\-_,]+/i", "", $_GET[$name] ); // Remove anything but 0-9,a-z,-_ 29 } 30 31 function getFileContents($path) { 32 $path = realpath($path); 33 34 if ( !$path || !@is_file($path) ) 35 return ''; 36 37 if ( function_exists('file_get_contents') ) 38 return @file_get_contents($path); 39 40 $content = ''; 41 $fp = @fopen( $path, 'r' ); 42 if (!$fp) 43 return ''; 44 45 while ( ! feof($fp) ) 46 $content .= fgets($fp); 47 48 fclose($fp); 49 50 return $content; 51 } 52 53 function putFileContents( $path, $content ) { 54 if ( function_exists('file_put_contents') ) 55 return @file_put_contents($path, $content); 56 57 $fp = @fopen($path, 'wb'); 58 if ($fp) { 59 fwrite($fp, $content); 60 fclose($fp); 61 } 62 } 63 64 20 65 // Get input 21 $plugins = explode(',', getParam("plugins", "")); 22 $languages = explode(',', getParam("languages", "")); 23 $themes = explode(',', getParam("themes", "")); 24 $diskCache = getParam("diskcache", "") == "true"; 25 $isJS = getParam("js", "") == "true"; 26 $compress = getParam("compress", "true") == "true"; 27 $suffix = getParam("suffix", "_src") == "_src" ? "_src" : ""; 28 $cachePath = realpath("."); // Cache path, this is where the .gz files will be stored 29 $expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache 30 $content = ""; 66 $plugins = explode( ',', getParam('plugins', '') ); 67 $languages = explode( ',', getParam('languages', '') ); 68 $themes = explode( ',', getParam('themes', '') ); 69 $diskCache = getParam( 'diskcache', '' ) == 'true'; 70 $isJS = getParam( 'js', '' ) == 'true'; 71 $compress = getParam( 'compress', 'true' ) == 'true'; 72 $core = getParam( 'core', 'true' ) == 'true'; 73 $suffix = getParam( 'suffix', '_src' ) == '_src' ? '_src' : ''; 74 $cachePath = realpath('.'); // Cache path, this is where the .gz files will be stored 75 76 $content = ''; 31 77 $encodings = array(); 32 78 $supportsGzip = false; 33 $enc = ""; 34 $cacheKey = ""; 35 36 // Custom extra javascripts to pack 37 $custom = array(/* 38 "some custom .js file", 39 "some custom .js file" 40 */); 41 42 // WP 43 $index = getParam("index", -1); 44 $theme = getParam("theme", ""); 79 $enc = ''; 80 $cacheKey = ''; 81 82 // WP. Language handling could be improved... Concat all translated langs files and store in /wp-content/languages as .mo? 83 $theme = getParam( 'theme', 'advanced' ); 45 84 $themes = array($theme); 46 $language = getParam("language", "en");47 if ( empty($language) ) 48 $language = 'en';49 $languages = array($language);50 85 86 $language = getParam( 'language', 'en' ); 87 $languages = array($language); 88 89 if ( $language != strtolower($language) ) 51 90 $languages[] = strtolower($language); 52 if ( $language != substr($language, 0, 2) ) 91 92 if ( $language != substr($language, 0, 2) ) 53 93 $languages[] = substr($language, 0, 2); 54 $diskCache = false; 94 95 $diskCache = false; 55 96 $isJS = true; 56 97 $suffix = ''; 57 98 58 // Headers 59 header("Content-Type: text/javascript; charset=" . get_bloginfo('charset')); 60 header("Vary: Accept-Encoding"); // Handle proxies 61 header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT"); 99 // Custom extra javascripts to pack 100 // WP - add a hook for external plugins to be compressed too? 101 $custom = array(/* 102 'some custom .js file', 103 'some custom .js file' 104 */); 62 105 63 106 // Is called directly then auto init with default settings 64 if ( !$isJS) {65 echo getFileContents( "tiny_mce_gzip.js");66 echo "tinyMCE_GZ.init({});";107 if ( ! $isJS ) { 108 echo getFileContents('tiny_mce_gzip.js'); 109 echo 'tinyMCE_GZ.init({});'; 67 110 die(); 68 111 } 69 112 70 71 if ( $diskCache) {72 if ( !$cachePath)73 die( "alert('Real path failed.');");74 75 $cacheKey = getParam( "plugins", "") . getParam("languages", "") . getParam("themes", "");76 77 foreach ( $custom as $file)113 // Setup cache info 114 if ( $diskCache ) { 115 if ( ! $cachePath ) 116 die('Real path failed.'); 117 118 $cacheKey = getParam( 'plugins', '' ) . getParam( 'languages', '' ) . getParam( 'themes', '' ) . $suffix; 119 120 foreach ( $custom as $file ) 78 121 $cacheKey .= $file; 79 122 80 123 $cacheKey = md5($cacheKey); 81 124 82 if ( $compress)83 $cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".gz";125 if ( $compress ) 126 $cacheFile = $cachePath . '/tiny_mce_' . $cacheKey . '.gz'; 84 127 else 85 $cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".js";128 $cacheFile = $cachePath . '/tiny_mce_' . $cacheKey . '.js'; 86 129 } 87 130 88 131 // Check if it supports gzip 89 if ( isset($_SERVER['HTTP_ACCEPT_ENCODING']))90 $encodings = explode( ',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));91 92 if ( (in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression') && ini_get('output_handler') != 'ob_gzhandler') {93 $enc = in_array( 'x-gzip', $encodings) ? "x-gzip" : "gzip";132 if ( isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) 133 $encodings = explode( ',', strtolower( preg_replace('/\s+/', '', $_SERVER['HTTP_ACCEPT_ENCODING']) ) ); 134 135 if ( ( in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------']) ) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression') ) { 136 $enc = in_array( 'x-gzip', $encodings ) ? 'x-gzip' : 'gzip'; 94 137 $supportsGzip = true; 95 138 } 96 139 97 140 // Use cached file disk cache 98 if ( $diskCache && $supportsGzip && file_exists($cacheFile)) {99 if ( $compress)100 header( "Content-Encoding: ". $enc);141 if ( $diskCache && $supportsGzip && file_exists($cacheFile) ) { 142 if ( $compress ) 143 header('Content-Encoding: ' . $enc); 101 144 102 145 echo getFileContents($cacheFile); … … 104 147 } 105 148 106 if ($index > -1) { 107 // Write main script and patch some things 108 if ( $index == 0 ) { 109 // Add core 110 $content .= wp_compact_tinymce_js(getFileContents("tiny_mce" . $suffix . ".js")); 111 $content .= 'TinyMCE.prototype.orgLoadScript = TinyMCE.prototype.loadScript;'; 112 $content .= 'TinyMCE.prototype.loadScript = function() {};var realTinyMCE = tinyMCE;'; 113 } else 114 $content .= 'tinyMCE = realTinyMCE;'; 115 116 // Patch loading functions 117 //$content .= "tinyMCE_GZ.start();"; 118 119 // Do init based on index 120 $content .= "tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);"; 121 122 // Load external plugins 123 if ( $index == 0 ) 124 $content .= "tinyMCECompressed.loadPlugins();"; 149 // Add core 150 if ( $core == 'true' ) { 151 $content .= getFileContents('tiny_mce' . $suffix . '.js'); 152 153 // Patch loading functions 154 $content .= 'tinyMCE_GZ.start();'; 155 } 125 156 126 157 // Add core languages 127 158 $lang_content = ''; 128 foreach ($languages as $lang) 129 $lang_content .= getFileContents("langs/" . $lang . ".js"); 130 if ( empty($lang_content) ) 131 $lang_content .= getFileContents("langs/en.js"); 132 $content .= $lang_content; 159 foreach ( $languages as $lang ) 160 $lang_content .= getFileContents('langs/' . $lang . '.js'); 161 162 if ( empty($lang_content) && file_exists('langs/en.js') ) 163 $lang_content .= getFileContents('langs/en.js'); 164 165 $content .= $lang_content; 133 166 134 167 // Add themes 135 foreach ( $themes as $theme) {136 $content .= wp_compact_tinymce_js(getFileContents( "themes/" . $theme . "/editor_template" . $suffix . ".js"));168 foreach ( $themes as $theme ) { 169 $content .= getFileContents( 'themes/' . $theme . '/editor_template' . $suffix . '.js'); 137 170 138 171 $lang_content = ''; 139 foreach ($languages as $lang) 140 $lang_content .= getFileContents("themes/" . $theme . "/langs/" . $lang . ".js"); 141 if ( empty($lang_content) ) 142 $lang_content .= getFileContents("themes/" . $theme . "/langs/en.js"); 143 $content .= $lang_content; 172 foreach ( $languages as $lang ) 173 $lang_content .= getFileContents( 'themes/' . $theme . '/langs/' . $lang . '.js' ); 174 175 if ( empty($lang_content) && file_exists( 'themes/' . $theme . '/langs/en.js' ) ) 176 $lang_content .= getFileContents( 'themes/' . $theme . '/langs/en.js' ); 177 178 $content .= $lang_content; 144 179 } 145 180 146 181 // Add plugins 147 foreach ( $plugins as $plugin) {148 $content .= getFileContents( "plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");182 foreach ( $plugins as $plugin ) { 183 $content .= getFileContents('plugins/' . $plugin . '/editor_plugin' . $suffix . '.js'); 149 184 150 185 $lang_content = ''; 151 foreach ($languages as $lang) 152 $lang_content .= getFileContents("plugins/" . $plugin . "/langs/" . $lang . ".js"); 153 if ( empty($lang_content) ) 154 $lang_content .= getFileContents("plugins/" . $plugin . "/langs/en.js"); 155 $content .= $lang_content; 186 foreach ( $languages as $lang ) 187 $lang_content .= getFileContents( 'plugins/' . $plugin . '/langs/' . $lang . '.js' ); 188 189 if ( empty($lang_content) && file_exists( 'plugins/' . $plugin . '/langs/en.js' ) ) 190 $lang_content .= getFileContents( 'plugins/' . $plugin . '/langs/en.js' ); 191 192 $content .= $lang_content; 156 193 } 157 194 158 195 // Add custom files 159 foreach ( $custom as $file)196 foreach ( $custom as $file ) 160 197 $content .= getFileContents($file); 161 198 162 // Reset tinyMCE compressor engine163 $content .= "tinyMCE = tinyMCECompressed;";164 165 199 // Restore loading functions 166 //$content .= "tinyMCE_GZ.end();"; 200 if ( $core == 'true' ) 201 $content .= 'tinyMCE_GZ.end();'; 167 202 168 203 // Generate GZIP'd content 169 if ( $supportsGzip) {170 if ( $compress) {171 header( "Content-Encoding: ". $enc);172 $cacheData = gzencode( $content, 9, FORCE_GZIP);204 if ( $supportsGzip ) { 205 if ( $compress ) { 206 header('Content-Encoding: ' . $enc); 207 $cacheData = gzencode( $content, 9, FORCE_GZIP ); 173 208 } else 174 209 $cacheData = $content; 175 210 176 211 // Write gz file 177 if ( $diskCache && $cacheKey != "")178 putFileContents( $cacheFile, $cacheData);212 if ( $diskCache && $cacheKey != '' ) 213 putFileContents( $cacheFile, $cacheData ); 179 214 180 215 // Stream to client … … 185 220 } 186 221 187 die;222 exit; 188 223 } 189 190 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 191 192 function getParam($name, $def = false) { 193 if (!isset($_GET[$name])) 194 return $def; 195 196 return preg_replace("/[^0-9a-z\-_,]+/i", "", $_GET[$name]); // Remove anything but 0-9,a-z,-_ 197 } 198 199 function getFileContents($path) { 200 $path = realpath($path); 201 202 if (!$path || !@is_file($path)) 203 return ""; 204 205 if (function_exists("file_get_contents")) 206 return @file_get_contents($path); 207 208 $content = ""; 209 $fp = @fopen($path, "r"); 210 if (!$fp) 211 return ""; 212 213 while (!feof($fp)) 214 $content .= fgets($fp); 215 216 fclose($fp); 217 218 return $content; 219 } 220 221 function putFileContents($path, $content) { 222 if (function_exists("file_put_contents")) 223 return @file_put_contents($path, $content); 224 225 $fp = @fopen($path, "wb"); 226 if ($fp) { 227 fwrite($fp, $content); 228 fclose($fp); 224 ?> 225 226 var tinyMCEPreInit = {suffix : ''}; 227 228 var tinyMCE_GZ = { 229 settings : { 230 themes : '', 231 plugins : '', 232 languages : '', 233 disk_cache : false, 234 page_name : 'tiny_mce_gzip.php', 235 debug : false, 236 suffix : '' 237 }, 238 239 opt : {}, 240 241 init : function(arr, cb) { 242 var t = this, n, s, nl = document.getElementsByTagName('script'); 243 244 t.opt = arr; 245 246 t.settings.themes = arr.theme; 247 t.settings.plugins = arr.plugins; 248 t.settings.languages = arr.language; 249 s = t.settings; 250 t.cb = cb || ''; 251 252 for (i=0; i<nl.length; i++) { 253 n = nl[i]; 254 255 if (n.src && n.src.indexOf('tiny_mce') != -1) 256 t.baseURL = n.src.substring(0, n.src.lastIndexOf('/')); 229 257 } 230 } 231 232 // WP specific 233 function wp_compact_tinymce_js($text) { 234 // This function was custom-made for TinyMCE 2.0, not expected to work with any other JS. 235 236 // Strip comments 237 $text = preg_replace("!(^|\s+)//.*$!m", '', $text); 238 $text = preg_replace("!/\*.*?\*/!s", '', $text); 239 240 // Strip leading tabs, carriage returns and unnecessary line breaks. 241 $text = preg_replace("!^\t+!m", '', $text); 242 $text = str_replace("\r", '', $text); 243 $text = preg_replace("!(^|{|}|;|:|\))\n!m", '\\1', $text); 244 245 return "$text\n"; 246 } 247 ?> 248 249 function TinyMCECompressed() { 250 this.configs = new Array(); 251 this.loadedFiles = new Array(); 252 this.externalPlugins = new Array(); 253 this.loadAdded = false; 254 this.isLoaded = false; 255 } 256 257 TinyMCECompressed.prototype.init = function(settings) { 258 var elements = document.getElementsByTagName('script'); 259 var scriptURL = ""; 260 261 for (var i=0; i<elements.length; i++) { 262 if (elements[i].src && elements[i].src.indexOf("tiny_mce_gzip.php") != -1) { 263 scriptURL = elements[i].src; 264 break; 265 } 266 } 267 268 settings["theme"] = typeof(settings["theme"]) != "undefined" ? settings["theme"] : "default"; 269 settings["plugins"] = typeof(settings["plugins"]) != "undefined" ? settings["plugins"] : ""; 270 settings["language"] = typeof(settings["language"]) != "undefined" ? settings["language"] : "en"; 271 settings["button_tile_map"] = typeof(settings["button_tile_map"]) != "undefined" ? settings["button_tile_map"] : true; 272 this.configs[this.configs.length] = settings; 273 this.settings = settings; 274 275 scriptURL += (scriptURL.indexOf('?') == -1) ? '?' : '&'; 276 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); 277 document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>'); 278 279 if (!this.loadAdded) { 280 tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCECompressed.prototype.onLoad); 281 tinyMCE.addEvent(window, "load", TinyMCECompressed.prototype.onLoad); 282 this.loadAdded = true; 283 } 284 } 285 286 TinyMCECompressed.prototype.onLoad = function() { 287 if (tinyMCE.isLoaded) 288 return true; 289 290 tinyMCE = realTinyMCE; 291 TinyMCE_Engine.prototype.onLoad(); 292 tinyMCE._addUnloadEvents(); 293 294 tinyMCE.isLoaded = true; 295 } 296 297 TinyMCECompressed.prototype.addEvent = function(o, n, h) { 298 if (o.attachEvent) 299 o.attachEvent("on" + n, h); 300 else 301 o.addEventListener(n, h, false); 302 } 303 304 TinyMCECompressed.prototype.getOnce = function(str) { 305 var ar = str.replace(/\s+/g, '').split(','); 306 307 for (var i=0; i<ar.length; i++) { 308 if (ar[i] == '' || ar[i].charAt(0) == '-') { 309 ar[i] = null; 310 continue; 311 } 312 313 // Skip load 314 for (var x=0; x<this.loadedFiles.length; x++) { 315 if (this.loadedFiles[x] == ar[i]) 316 ar[i] = null; 317 } 318 319 this.loadedFiles[this.loadedFiles.length] = ar[i]; 320 } 321 322 // Glue 323 str = ""; 324 for (var i=0; i<ar.length; i++) { 325 if (ar[i] == null) 326 continue; 327 328 str += ar[i]; 329 330 if (i != ar.length-1) 331 str += ","; 332 } 333 334 return str; 258 tinyMCEPreInit.base = t.baseURL; 259 260 if (!t.coreLoaded) 261 t.loadScripts(1, s.themes, s.plugins, s.languages); 262 }, 263 264 loadScripts : function(co, th, pl, la, cb, sc) { 265 var t = this, x, w = window, q, c = 0, ti, s = t.settings; 266 267 function get(s) { 268 x = 0; 269 270 try { 271 x = new ActiveXObject(s); 272 } catch (s) { 273 } 274 275 return x; 276 }; 277 278 // Build query string 279 q = 'load=true&js=true&diskcache=' + (s.disk_cache ? 'true' : 'false') + '&core=' + (co ? 'true' : 'false') + '&suffix=' + escape(s.suffix) + '&themes=' + escape(th) + '&plugins=' + escape(pl) + '&languages=' + escape(la); 280 281 if (co) 282 t.coreLoaded = 1; 283 284 // Easier to debug with this... 285 // document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + t.baseURL + '/' + s.page_name + '?' + q + '"></script>'); 286 287 // Send request 288 x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Msxml2.XMLHTTP') || get('Microsoft.XMLHTTP'); 289 x.overrideMimeType && x.overrideMimeType('text/javascript'); 290 x.open('GET', t.baseURL + '/' + s.page_name + '?' + q, !!cb); 291 // x.setRequestHeader('Content-Type', 'text/javascript'); 292 x.send(''); 293 294 // Handle asyncronous loading 295 if (cb) { 296 // Wait for response 297 ti = w.setInterval(function() { 298 if (x.readyState == 4 || c++ > 10000) { 299 w.clearInterval(ti); 300 301 if (c < 10000 && x.status == 200) { 302 t.loaded = 1; 303 t.eval(x.responseText); 304 tinymce.dom.Event.domLoaded = true; 305 // cb.call(sc || t, x); 306 } 307 308 ti = x = null; 309 } 310 }, 10); 311 } else 312 t.eval(x.responseText); 313 }, 314 315 start : function() { 316 var t = this, each = tinymce.each, s = t.settings, sl, ln = s.languages.split(','); 317 318 tinymce.suffix = s.suffix; 319 320 // Extend script loader 321 tinymce.create('tinymce.compressor.ScriptLoader:tinymce.dom.ScriptLoader', { 322 loadScripts : function(sc, cb, s) { 323 var ti = this, th = [], pl = [], la = []; 324 325 each(sc, function(o) { 326 var u = o.url; 327 328 if ((!ti.lookup[u] || ti.lookup[u].state != 2) && u.indexOf(t.baseURL) === 0) { 329 // Collect theme 330 if (u.indexOf('editor_template') != -1) { 331 th.push(/\/themes\/([^\/]+)/.exec(u)[1]); 332 load(u, 1); 333 } 334 335 // Collect plugin 336 if (u.indexOf('editor_plugin') != -1) { 337 pl.push(/\/plugins\/([^\/]+)/.exec(u)[1]); 338 load(u, 1); 339 } 340 341 // Collect language 342 if (u.indexOf('/langs/') != -1) { 343 la.push(/\/langs\/([^.]+)/.exec(u)[1]); 344 load(u, 1); 345 } 346 } 347 }); 348 349 if (th.length + pl.length + la.length > 0) { 350 if (sl.settings.strict_mode) { 351 // Async 352 t.loadScripts(0, th.join(','), pl.join(','), la.join(','), cb, s); 353 return; 354 } else 355 t.loadScripts(0, th.join(','), pl.join(','), la.join(','), cb, s); 356 } 357 358 return ti.parent(sc, cb, s); 359 } 360 }); 361 362 sl = tinymce.ScriptLoader = new tinymce.compressor.ScriptLoader(); 363 364 function load(u, sp) { 365 var o; 366 367 if (!sp) 368 u = t.baseURL + u; 369 370 o = {url : u, state : 2}; 371 sl.queue.push(o); 372 sl.lookup[o.url] = o; 373 }; 374 375 // Add core languages 376 each (ln, function(c) { 377 if (c) 378 load('/langs/' + c + '.js'); 379 }); 380 381 // Add themes with languages 382 each(s.themes.split(','), function(n) { 383 if (n) { 384 load('/themes/' + n + '/editor_template' + s.suffix + '.js'); 385 386 each (ln, function(c) { 387 if (c) 388 load('/themes/' + n + '/langs/' + c + '.js'); 389 }); 390 } 391 }); 392 393 // Add plugins with languages 394 each(s.plugins.split(','), function(n) { 395 if (n) { 396 load('/plugins/' + n + '/editor_plugin' + s.suffix + '.js'); 397 398 each (ln, function(c) { 399 if (c) 400 load('/plugins/' + n + '/langs/' + c + '.js'); 401 }); 402 } 403 }); 404 }, 405 406 end : function() { 407 tinyMCE.init(this.opt); 408 }, 409 410 eval : function(co) { 411 var w = window; 412 413 // Evaluate script 414 if (!w.execScript) { 415 try { 416 eval.call(w, co); 417 } catch (ex) { 418 eval(co, w); // Firefox 3.0a8 419 } 420 } else 421 w.execScript(co); // IE 422 } 335 423 }; 336 337 TinyMCECompressed.prototype.loadPlugins = function() {338 var i, ar;339 340 TinyMCE.prototype.loadScript = TinyMCE.prototype.orgLoadScript;341 tinyMCE = realTinyMCE;342 343 ar = tinyMCECompressed.externalPlugins;344 for (i=0; i<ar.length; i++)345 tinyMCE.loadPlugin(ar[i].name, ar[i].url);346 347 TinyMCE.prototype.loadScript = function() {};348 };349 350 TinyMCECompressed.prototype.loadPlugin = function(n, u) {351 this.externalPlugins[this.externalPlugins.length] = {name : n, url : u};352 };353 354 TinyMCECompressed.prototype.importPluginLanguagePack = function(n, v) {355 tinyMCE = realTinyMCE;356 TinyMCE.prototype.loadScript = TinyMCE.prototype.orgLoadScript;357 tinyMCE.importPluginLanguagePack(n, v);358 };359 360 TinyMCECompressed.prototype.addPlugin = function(n, p) {361 tinyMCE = realTinyMCE;362 tinyMCE.addPlugin(n, p);363 };364 365 var tinyMCE = new TinyMCECompressed();366 var tinyMCECompressed = tinyMCE;
Note: See TracChangeset
for help on using the changeset viewer.