protected function Minifier::lock in Advanced CSS/JS Aggregation 7.2
Same name and namespace in other branches
- 8.4 advagg_js_minify/jshrink.inc \JShrink\Minifier::lock()
- 8.2 advagg_js_minify/jshrink.inc \JShrink\Minifier::lock()
- 8.3 advagg_js_minify/jshrink.inc \JShrink\Minifier::lock()
Replace patterns in the given string and store the replacement
Parameters
string $js The string to lock:
Return value
bool
File
- advagg_js_compress/
jshrink.inc, line 601
Class
- Minifier
- Minifier
Namespace
JShrinkCode
protected function lock($js) {
/* lock things like <code>"asd" + ++x;</code> */
$lock = '"LOCK---' . crc32(time()) . '"';
$matches = array();
preg_match('/([+-])(\\s+)([+-])/S', $js, $matches);
if (empty($matches)) {
return $js;
}
$this->locks[$lock] = $matches[2];
$js = preg_replace('/([+-])\\s+([+-])/S', "\$1{$lock}\$2", $js);
/* -- */
return $js;
}