function advagg_convert_abs_to_rel in Advanced CSS/JS Aggregation 8.2
Same name and namespace in other branches
- 7.2 advagg.module \advagg_convert_abs_to_rel()
Converts absolute paths to be self references.
Parameters
string $path: Path to check.
Return value
string The path.
File
- ./
advagg.module, line 618 - Advanced CSS/JS aggregation module.
Code
function advagg_convert_abs_to_rel($path) {
if (strpos($path, $GLOBALS['base_url']) === 0) {
$base_url = $GLOBALS['base_url'];
// Add a slash if none is found.
if (stripos(strrev($base_url), '/') !== 0) {
$base_url .= '/';
}
$path = str_replace($base_url, $GLOBALS['base_path'], $path);
}
return $path;
}