Same name and namespace in other branches
  1. 6.0.x advagg_js_minify/jshrink.inc \JShrink\Minifier::initialize() 1 commentaire
  2. 7.x-2.x advagg_js_compress/jshrink.inc \JShrink\Minifier::initialize() 1 commentaire
  3. 8.x-2.x advagg_js_minify/jshrink.inc \JShrink\Minifier::initialize() 1 commentaire
  4. 8.x-3.x advagg_js_minify/jshrink.inc \JShrink\Minifier::initialize() 1 commentaire
  5. 8.x-4.x advagg_js_minify/jshrink.inc \JShrink\Minifier::initialize() 1 commentaire

Initializes internal variables, normalizes new lines,

Paramètres

string $js The raw javascript to be minified:

array $options Various runtime options in an associative array:

1 call to Minifier::initialize()
Minifier::minifyDirectToOutput dans advagg_js_minify/jshrink.inc
Processes a javascript string and outputs only the required characters, stripping out all unneeded characters.

Fichier

advagg_js_minify/jshrink.inc, line 196

Classe

Minifier
Minifier

Namespace

JShrink

Code

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();
}