private function JavaScriptPacker::_encodeSpecialChars in Advanced CSS/JS Aggregation 7
Same name and namespace in other branches
- 8.4 advagg_js_minify/jspacker.inc \JavaScriptPacker::_encodeSpecialChars()
- 8.2 advagg_js_minify/jspacker.inc \JavaScriptPacker::_encodeSpecialChars()
- 8.3 advagg_js_minify/jspacker.inc \JavaScriptPacker::_encodeSpecialChars()
- 6 advagg_js_compress/jspacker.inc \JavaScriptPacker::_encodeSpecialChars()
- 7.2 advagg_js_compress/jspacker.inc \JavaScriptPacker::_encodeSpecialChars()
File
- advagg_js_compress/
jspacker.inc, line 155
Class
Code
private function _encodeSpecialChars($script) {
$parser = new ParseMaster();
// replace: $name -> n, $$name -> na
$parser
->add('/((\\x24+)([a-zA-Z$_]+))(\\d*)/', array(
'fn' => '_replace_name',
));
// replace: _name -> _0, double-underscore (__name) is ignored
$regexp = '/\\b_[A-Za-z\\d]\\w*/';
// build the word list
$keywords = $this
->_analyze($script, $regexp, '_encodePrivate');
// quick ref
$encoded = $keywords['encoded'];
$parser
->add($regexp, array(
'fn' => '_replace_encoded',
'data' => $encoded,
));
return $parser
->exec($script);
}