function advagg_build_uri in Advanced CSS/JS Aggregation 6
Same name and namespace in other branches
- 7 advagg.module \advagg_build_uri()
Given path output uri to that file
Parameters
$filename_md5: md5 of filename.
$data: data to store.
5 calls to advagg_build_uri()
- advagg_admin_info_form in ./
advagg.admin.inc - Form builder; Configure advagg settings.
- advagg_check_missing_handler in ./
advagg.install - Check to see if the CSS/JS generator is working.
- advagg_missing_regenerate in ./
advagg.missing.inc - regenerates a missing css file.
- advagg_process_css in ./
advagg.module - Returns a themed representation of all stylesheets that should be attached to the page.
- advagg_process_js in ./
advagg.module - Returns a themed presentation of all JavaScript code for the current page.
File
- ./
advagg.module, line 1799 - Advanced CSS/JS aggregation module
Code
function advagg_build_uri($path) {
static $hook_file_url_alter = array();
// If the current path is an absolute path, return immediately.
$fragments = parse_url($path);
if (isset($fragments['host'])) {
return $path;
}
$original_path = $path;
// CDN Support.
if (module_exists('cdn')) {
$status = variable_get(CDN_STATUS_VARIABLE, CDN_DISABLED);
if ($status == CDN_ENABLED || $status == CDN_TESTING && user_access(CDN_PERM_ACCESS_TESTING)) {
// Alter URL when the file_create_url() patch is not there.
if (variable_get(CDN_THEME_LAYER_FALLBACK_VARIABLE, FALSE)) {
cdn_file_url_alter($path);
}
else {
$path = advagg_file_create_url($path);
}
// Return here if the path was changed above.
if (strcmp($original_path, $path) != 0) {
return $path;
}
}
}
// Other modules besides CDN might want to use hook_file_url_alter.
if (empty($hook_file_url_alter)) {
$hook_file_url_alter = module_implements('file_url_alter');
}
if (!empty($hook_file_url_alter)) {
$path = advagg_file_create_url($path);
// Return here if the path was changed above.
if (strcmp($original_path, $path) != 0) {
return $path;
}
}
// If nothing was altered then use the drupal default.
return base_path() . $path;
}