Same name in other branches
- 5.0.x advagg_js_minify/jshrink.inc \JShrink\Minifier::initialize()
- 6.0.x advagg_js_minify/jshrink.inc \JShrink\Minifier::initialize()
- 7.x-2.x advagg_js_compress/jshrink.inc \JShrink\Minifier::initialize()
- 8.x-3.x advagg_js_minify/jshrink.inc \JShrink\Minifier::initialize()
- 8.x-4.x advagg_js_minify/jshrink.inc \JShrink\Minifier::initialize()
Initializes internal variables, normalizes new lines,
Parameters
string $js The raw javascript to be minified:
array $options Various runtime options in an associative array:
1 call to Minifier::initialize()
- Minifier::minifyDirectToOutput in advagg_js_minify/
jshrink.inc - Processes a javascript string and outputs only the required characters, stripping out all unneeded characters.
File
-
advagg_js_minify/
jshrink.inc, line 196
Class
- Minifier
- Minifier
Namespace
JShrinkCode
protected function initialize($js, $options) {
$this->options = array_merge(static::$defaultOptions, $options);
$js = str_replace("\r\n", "\n", $js);
$js = str_replace('/**/', '', $js);
$this->input = str_replace("\r", "\n", $js);
// We add a newline to the end of the script to make it easier to deal
// with comments at the bottom of the script- this prevents the unclosed
// comment error that can otherwise occur.
$this->input .= PHP_EOL;
// Populate "a" with a new line, "b" with the first character, before
// entering the loop
$this->a = "\n";
$this->b = $this->getReal();
}