Same name in other branches
- 5.0.x advagg_js_minify/jshrink.inc \JShrink\Minifier::lock()
- 6.0.x advagg_js_minify/jshrink.inc \JShrink\Minifier::lock()
- 8.x-2.x advagg_js_minify/jshrink.inc \JShrink\Minifier::lock()
- 8.x-3.x advagg_js_minify/jshrink.inc \JShrink\Minifier::lock()
- 8.x-4.x 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;
}