Given a filename calculate the processed filesize.
Paramètres
string $filename: String; filename containing path information as well.
string $type: String; css or js.
Return value
int Processed filesize.
2 calls to advagg_generate_filesize_processed()
- advagg_insert_update_files dans ./
advagg.inc - Insert/Update data in the advagg_files table.
- advagg_update_7211 dans ./
advagg.install - Populate the filesize_processed field in the advagg_files table.
Fichier
-
./
advagg.inc, line 293
Code
function advagg_generate_filesize_processed($filename, $type) {
$files =& drupal_static(__FUNCTION__, array());
if (!isset($files[$type][$filename])) {
// Make advagg_get_*_aggregate_contents() available.
module_load_include('inc', 'advagg', 'advagg.missing');
$aggregate_settings = advagg_current_hooks_hash_array();
$file_aggregate = array(
$filename => array(),
);
if ($type === 'css') {
list($contents) = advagg_get_css_aggregate_contents($file_aggregate, $aggregate_settings);
}
elseif ($type === 'js') {
list($contents) = advagg_get_js_aggregate_contents($file_aggregate, $aggregate_settings);
}
if (!empty($contents)) {
$files[$type][$filename] = strlen(gzencode($contents, 9, FORCE_GZIP));
}
else {
$files[$type][$filename] = 0;
}
}
return $files[$type][$filename];
}