Read only the first 8192 bytes to get the file header.

Paramètres

string $content: JS string to cut.

int $length: The number of bytes to grab. See advagg_js_header_length variable.

Return value

string The shortened JS string.

1 call to advagg_get_js_header()
advagg_does_js_start_with_use_strict dans ./advagg.inc
Given a js string, see if "use strict"; is the first thing ran.

Fichier

./advagg.inc, line 394

Code

function advagg_get_js_header($content, $length) {
    $content = trim($content);
    // Only grab the first X bytes.
    if (function_exists('mb_strcut')) {
        $header = mb_strcut($content, 0, $length);
    }
    else {
        $header = substr($content, 0, $length);
    }
    return $header;
}