function advagg_file_url_alter in Advanced CSS/JS Aggregation 7.2
Implements hook_file_url_alter().
File
- ./
advagg.module, line 805 - Advanced CSS/JS aggregation module.
Code
function advagg_file_url_alter(&$original_uri) {
// Do nothing if URI does not contain /advagg_
// OR file does not have the correct pattern.
if (strpos($original_uri, '/advagg_') === FALSE || !advagg_match_file_pattern($original_uri)) {
return;
}
// CDN fix.
// Do nothing if
// in maintenance_mode
// CDN module does not exist
// CDN far future is disabled
// CDN mode is not basic
// URI does not contain cdn/farfuture/.
if (variable_get('maintenance_mode', FALSE) || !module_exists('cdn') || !variable_get(CDN_BASIC_FARFUTURE_VARIABLE, CDN_BASIC_FARFUTURE_DEFAULT) || variable_get(CDN_MODE_VARIABLE, CDN_MODE_BASIC) != CDN_MODE_BASIC || strpos($original_uri, 'cdn/farfuture/') === FALSE) {
return;
}
// Remove cdn/farfuture/BASE64/prefix:value/ from the URI.
$original_uri = preg_replace('/cdn\\/farfuture\\/[A-Za-z0-9-_]{43}\\/[A-Za-z]+\\:[A-Za-z0-9-_]+\\//', '', $original_uri);
}