private function JavaScriptPacker::_encodeKeywords in Advanced CSS/JS Aggregation 6
Same name and namespace in other branches
- 8.4 advagg_js_minify/jspacker.inc \JavaScriptPacker::_encodeKeywords()
- 8.2 advagg_js_minify/jspacker.inc \JavaScriptPacker::_encodeKeywords()
- 8.3 advagg_js_minify/jspacker.inc \JavaScriptPacker::_encodeKeywords()
- 7.2 advagg_js_compress/jspacker.inc \JavaScriptPacker::_encodeKeywords()
- 7 advagg_js_compress/jspacker.inc \JavaScriptPacker::_encodeKeywords()
File
- advagg_js_compress/
jspacker.inc, line 177
Class
Code
private function _encodeKeywords($script) {
// escape high-ascii values already in the script (i.e. in strings)
if ($this->_encoding > 62) {
$script = $this
->_escape95($script);
}
// create the parser
$parser = new ParseMaster();
$encode = $this
->_getEncoder($this->_encoding);
// for high-ascii, don't encode single character low-ascii
$regexp = $this->_encoding > 62 ? '/\\w\\w+/' : '/\\w+/';
// build the word list
$keywords = $this
->_analyze($script, $regexp, $encode);
$encoded = $keywords['encoded'];
// encode
$parser
->add($regexp, array(
'fn' => '_replace_encoded',
'data' => $encoded,
));
if (empty($script)) {
return $script;
}
else {
//$res = $parser->exec($script);
//$res = $this->_bootStrap($res, $keywords);
//return $res;
return $this
->_bootStrap($parser
->exec($script), $keywords);
}
}