function css_gzip_exit in CSS Gzip 6
Implementation of hook_exit().
Alt way of getting the css filenames
2 string references to 'css_gzip_exit'
- css_gzip_form_alter in ./
css_gzip.module - Implementation of hook_form_alter().
- css_gzip_init in ./
css_gzip.module - Implementation of hook_init().
File
- ./
css_gzip.module, line 104 - Gzips aggregated CSS files if CSS Optimization is turned on.
Code
function css_gzip_exit() {
// Ensure we are not serving a cached page; drupal_set_content is the first
// function in common.inc which is included in the full drupal bootstrap.
if (variable_get('css_gzip', FALSE) && variable_get('css_gzip_exit', FALSE) && function_exists('drupal_set_content')) {
$buffer = ob_get_contents();
// Extract external css files from html document
$css = explode('<link type="text/css" rel="stylesheet" ', $buffer);
array_shift($css);
foreach ($css as $key => $value) {
// Only grab the first one, containing the css filename.
$css[$key] = array_shift(explode(' />', $value));
}
$css = implode('', $css);
$css_files = css_gzip_file_list($css);
// Create the GZip file if it doesn't already exist.
css_gzip_copy_compress($css_files);
}
}