Implements hook_advagg_get_css_file_contents_alter().
Used to run strings inside of quotes of the content attribute through the t function.
See also
drupal_load_stylesheet_content()
Related topics
File
-
advagg_mod/
advagg_mod.advagg.inc, line 53
Code
function advagg_mod_advagg_get_css_file_contents_alter(&$contents, $filename, $aggregate_settings) {
if (empty($aggregate_settings['variables']['advagg_mod_css_translate'])) {
return;
}
// Code taken from drupal_load_stylesheet_content().
// Regexp to match double quoted strings.
$double_quot = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"';
// Regexp to match single quoted strings.
$single_quot = "'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'";
// Extract all content inside of quotes.
$css_content_pattern = "/content:.*?({$double_quot}|{$single_quot}|(?:\\;|\\})).*?(?:\\;|\\})/";
// Run strings inside of quotes of the content attribute through the t
// function.
$contents = preg_replace_callback($css_content_pattern, 'advagg_mod_advagg_css_content_t_replace_callback', $contents);
}