Same name and namespace in other branches
- 7.x-2.x advagg_js_compress/advagg_js_compress.advagg.inc \advagg_js_compress_jspacker() 1 commentaire
Compress a JS string using packer.
Paramètres
$contents: Javascript string.
1 call to advagg_js_compress_jspacker()
- advagg_js_compress_file_saver dans advagg_js_compress/
advagg_js_compress.module - Save a string to the specified destination. Verify that file size is not zero.
Fichier
-
advagg_js_compress/
advagg_js_compress.module, line 552
Code
function advagg_js_compress_jspacker(&$contents) {
// Use Packer on the contents of the aggregated file.
require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'advagg_js_compress') . '/jspacker.inc';
// Add semicolons to the end of lines if missing.
$contents = str_replace("}\n", "};\n", $contents);
$contents = str_replace("\nfunction", ";\nfunction", $contents);
// Remove char returns, looking at you lightbox2.
$contents = str_replace("\n\r", "", $contents);
$contents = str_replace("\r", "", $contents);
$contents = str_replace("\n", "", $contents);
$packer = new JavaScriptPacker($contents, 62, TRUE, FALSE);
$contents = $packer->pack();
}