Allow other modules to alter the contents and add new files to save (.gz).
Paramètres
array $files_to_save: Array($uri => $contents).
array $aggregate_settings: Array of settings.
array $other_parameters: Array of containing $files and $type.
Voir aussi
advagg_advagg_save_aggregate_alter()
Sujets associés
3 functions implement hook_advagg_save_aggregate_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- advagg_advagg_save_aggregate_alter dans ./
advagg.advagg.inc - Implements hook_advagg_save_aggregate_alter().
- advagg_js_compress_advagg_save_aggregate_alter dans advagg_js_compress/
advagg_js_compress.advagg.inc - Implements hook_advagg_save_aggregate_alter().
- advagg_sri_advagg_save_aggregate_alter dans advagg_sri/
advagg_sri.advagg.inc - Implements hook_advagg_save_aggregate_alter().
1 invocation of hook_advagg_save_aggregate_alter()
- advagg_save_aggregate dans ./
advagg.missing.inc - Save an aggregate given a filename, the files included in it, and the type.
Fichier
-
./
advagg.api.php, line 133
Code
function hook_advagg_save_aggregate_alter(array &$files_to_save, array $aggregate_settings, array $other_parameters) {
// Return if gzip is disabled.
if (empty($aggregate_settings['variables']['advagg_gzip'])) {
return;
}
// See if a .gz file already exists.
$gzip_exists = FALSE;
foreach ($files_to_save as $uri => $contents) {
// See if this uri contains .gz near the end of it.
$pos = strripos($uri, '.gz', 91 + strlen(ADVAGG_SPACE) * 3);
if (!empty($pos)) {
$len = strlen($uri);
// .gz file exists, exit loop.
if ($pos == $len - 3) {
$gzip_exists = TRUE;
break;
}
}
}
// If a .gz file does not exist, create one.
if (!$gzip_exists) {
// Use the first file in the array.
$data = reset($files_to_save);
$uri = key($files_to_save);
// Compress it and add it to the $files_to_save array.
$compressed = gzencode($data, 9, FORCE_GZIP);
$files_to_save[$uri . '.gz'] = $compressed;
}
}