function css_gzip_preprocess_page in CSS Gzip 6
Implementation of template_preprocess_page().
Does not modify the pages contents, only gets info. Could probably use drupal_get_css() and a different hook, if needed.
Parameters
&$variables: Array containing various page elements.
File
- ./
css_gzip.module, line 70 - Gzips aggregated CSS files if CSS Optimization is turned on.
Code
function css_gzip_preprocess_page(&$variables) {
$htaccess = file_directory_path() . '/css/' . '.htaccess';
if (!variable_get('css_gzip', FALSE) || variable_get('css_gzip_no_htaccess', FALSE)) {
css_gzip_remove_htaccess($htaccess);
}
if (!empty($variables['styles']) && variable_get('preprocess_css', FALSE) && variable_get('css_gzip', FALSE)) {
if (!variable_get('css_gzip_no_htaccess', FALSE) && (file_exists($htaccess) == FALSE || variable_get('css_gzip_htaccess_size', NULL) != filesize($htaccess))) {
css_gzip_create_htaccess($htaccess);
}
$css_files = css_gzip_file_list($variables['styles']);
// Create the GZip file if it doesn't already exist.
css_gzip_copy_compress($css_files);
}
}