Exemple #1
0
// Strip "Guard" version tags
if (in_array("--strip-Guard", $_SERVER["argv"])) {
    echo "Stripping 'Guard' code\n";
    $sOutput = fStripTags($sOutput, "Guard");
}
if (in_array("--obfuscate", $_SERVER["argv"])) {
    $oCompiler = new cJSCompiler();
    $oCompiler->keyword = "ampled";
    $oCompiler->readFromString($sOutput);
    echo "Obfuscating contents\n";
    $oCompiler->addOmmitArray(array("http://www.w3.org/2000/svg", "http://www.w3.org/1999/xhtml", "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "http://www.amplesdk.com/ns/aml", "http://www.w3.org/1999/XSL/Transform", "http://www.w3.org/1999/xlink", "http://www.w3.org/2000/xmlns/", "http://www.w3.org/2001/XInclude", "http://www.w3.org/2001/xml-events", "http://www.w3.org/2008/SMIL30/", "http://www.w3.org/XML/1998/namespace"));
    //
    $oCompiler->stripComments();
    $oCompiler->stripSpaces();
    $oCompiler->obfuscateStrings();
    $oCompiler->obfuscateVariables();
    $oCompiler->obfuscatePrivates();
    $oCompiler->obfuscate();
    $sOutput = $oCompiler->getOutput();
} else {
    echo "Wrapping contents\n";
    $oCompiler = new cJSCompiler();
    $oCompiler->readFromString($sOutput);
    $oCompiler->stripComments();
    $sOutput = $oCompiler->output;
    $sOutput = "" . "(function () {\n" . $sOutput . "\n" . "})()" . "";
}
echo "Writing: " . $sOutputFile . "\n";
$fOutputFile = fopen($sOutputFile, "w+");
fwrite($fOutputFile, $sOutput);
fclose($fOutputFile);