Changeset 3265 for trunk/wp-includes/js/tinymce/tiny_mce_gzip.php
- Timestamp:
- 12/05/2005 03:04:25 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/js/tinymce/tiny_mce_gzip.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/tinymce/tiny_mce_gzip.php
r3162 r3265 38 38 } 39 39 40 function wp_compact_tinymce_js($text) { 41 // This function was custom-made for TinyMCE 2.0, not expected to work with any other JS. 42 43 echo "\n//" . strlen(gzdeflate($text)) . " bytes gzdeflated\n"; 44 echo "//" . microtime() . " " . strlen($text) . " Micro Time Length\n"; 45 46 // Strip comments 47 $text = preg_replace("!(^|\s+)//.*$!m", '', $text); 48 echo "//" . microtime() . " " . strlen($text) . " Stripped // comments\n"; 49 $text = preg_replace("!/\*.*?\*/!s", '', $text); 50 echo "//" . microtime() . " " . strlen($text) . " Stripped /* */ comments\n"; 51 52 // Strip leading tabs, carriage returns and unnecessary line breaks. 53 $text = preg_replace("!^\t+!m", '', $text); 54 echo "//" . microtime() . " " . strlen($text) . " Stripped leading tabs\n"; 55 $text = str_replace("\r", '', $text); 56 echo "//" . microtime() . " " . strlen($text) . " Stripped returns\n"; 57 $text = preg_replace("!(^|{|}|;|:|\))\n!m", '\\1', $text); 58 echo "//" . microtime() . " " . strlen($text) . " Stripped safe linebreaks\n"; 59 60 // Strip spaces. This one is not generally economical. 61 //$text = preg_replace("!\s*(\=|\=\=|\!\=|\<\=|\>\=|\+=|\+|\s|:|,)\s*!", '\\1', $text); 62 //echo "//" . microtime() . " " . strlen($text) . " Stripped safe spaces\n"; 63 64 echo "//" . strlen(gzdeflate($text)) . " bytes gzdeflated\n"; 65 return $text; 66 } 67 40 68 // General options 41 69 $suffix = ""; // Set to "_src" to use source version … … 52 80 $encodings = explode(',', strtolower($_SERVER['HTTP_ACCEPT_ENCODING'])); 53 81 if (in_array('gzip', $encodings) && function_exists('ob_gzhandler')) 54 ob_start("ob_gzhandler");82 @ ob_start("ob_gzhandler"); // Don't let warnings foul up the JS 55 83 56 84 // Output rest of headers … … 63 91 // Write main script and patch some things 64 92 if ($index == 0) { 65 echo file_get_contents(realpath("tiny_mce" . $suffix . ".js")); 93 // WP echo file_get_contents(realpath("tiny_mce" . $suffix . ".js")); 94 $tinymce = file_get_contents(realpath("tiny_mce.js")); 95 echo wp_compact_tinymce_js($tinymce); 66 96 echo "\n\n"; 67 97 echo "TinyMCE.prototype.loadScript = function() {};\n";
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)