You are here

function advagg_get_js_header in Advanced CSS/JS Aggregation 7.2

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

Parameters

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 in ./advagg.inc
Given a js string, see if "use strict"; is the first thing ran.

File

./advagg.inc, line 394
Advanced CSS/JS aggregation module.

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