2794 // Which tags to strip for JAVASCRIPT PROCESSING ONLY - you can change this if needed |
2794 // Which tags to strip for JAVASCRIPT PROCESSING ONLY - you can change this if needed |
2795 $strip_tags = Array('enano:no-opt'); |
2795 $strip_tags = Array('enano:no-opt'); |
2796 $strip_tags = implode('|', $strip_tags); |
2796 $strip_tags = implode('|', $strip_tags); |
2797 |
2797 |
2798 // Strip out the tags and replace with placeholders |
2798 // Strip out the tags and replace with placeholders |
2799 preg_match_all("#<($strip_tags)(.*?)>(.*?)</($strip_tags)>#is", $html, $matches); |
2799 preg_match_all("#<($strip_tags)([ ]+.*?)?>(.*?)</($strip_tags)>#is", $html, $matches); |
2800 $seed = md5(microtime() . mt_rand()); // Random value used for placeholders |
2800 $seed = md5(microtime() . mt_rand()); // Random value used for placeholders |
2801 for ($i = 0;$i < sizeof($matches[1]); $i++) |
2801 for ($i = 0;$i < sizeof($matches[1]); $i++) |
2802 { |
2802 { |
2803 $html = str_replace($matches[0][$i], "{DONT_STRIP_ME_NAKED:$seed:$i}", $html); |
2803 $html = str_replace($matches[0][$i], "{DONT_STRIP_ME_NAKED:$seed:$i}", $html); |
2804 } |
2804 } |
2805 |
2805 |
2806 // Optimize (but don't obfuscate) Javascript |
2806 // Optimize (but don't obfuscate) Javascript |
2807 preg_match_all('/<script(.*?)>(.+?)<\/script>/is', $html, $jscript); |
2807 preg_match_all('/<script([ ]+.*?)?>(.*?)<\/script>/is', $html, $jscript); |
2808 |
2808 |
2809 // list of Javascript reserved words - from about.com |
2809 // list of Javascript reserved words - from about.com |
2810 $reserved_words = array('abstract', 'as', 'boolean', 'break', 'byte', 'case', 'catch', 'char', 'class', 'continue', 'const', 'debugger', 'default', 'delete', 'do', |
2810 $reserved_words = array('abstract', 'as', 'boolean', 'break', 'byte', 'case', 'catch', 'char', 'class', 'continue', 'const', 'debugger', 'default', 'delete', 'do', |
2811 'double', 'else', 'enum', 'export', 'extends', 'false', 'final', 'finally', 'float', 'for', 'function', 'goto', 'if', 'implements', 'import', |
2811 'double', 'else', 'enum', 'export', 'extends', 'false', 'final', 'finally', 'float', 'for', 'function', 'goto', 'if', 'implements', 'import', |
2812 'in', 'instanceof', 'int', 'interface', 'is', 'long', 'namespace', 'native', 'new', 'null', 'package', 'private', 'protected', 'public', |
2812 'in', 'instanceof', 'int', 'interface', 'is', 'long', 'namespace', 'native', 'new', 'null', 'package', 'private', 'protected', 'public', |