|<|:|\?|\|\||\&\&)\s*/', '/\}(\w+)/', '/\};(catch|finally|else)/', ); $aReplace = array( '', '', ' ', '', '\1', '};\1', '}\1', ); //remove c++ comments $szContents = preg_replace( $aSearch, $aReplace, $szContents ); $cjsF = "compressed/$szCJSfile"; $fh = fopen($cjsF, "w"); fwrite( $fh, $szContents); fclose($fh); $cratio = round(100 *(filesize($cjsF) / filesize($szJSfile))); echo "compress ratio $cratio %\n"; } else { echo "File $szCJSfile not existing!"; } } //compressJS('zoombox.js', 'zoombox.cjs'); $fileList = scandir("."); //print_r($fileList); foreach ($fileList as $f) { if (substr($f, -3) == ".js") { echo "compressing $f\n"; compressJS($f, $f); } } ?>