Same name in other branches
- 8.x-2.x advagg.module \advagg_convert_abs_to_rel()
Converts absolute paths to be self references.
Paramètres
string $path: Path to check.
bool $strip_base_path: Do no add the base path to the given path if TRUE.
Return value
string The path.
4 calls to advagg_convert_abs_to_rel()
- advagg_advagg_get_info_on_files_alter dans ./
advagg.advagg.inc - Implements hook_advagg_get_info_on_files_alter().
- advagg_file_create_url dans ./
advagg.module - Wrapper around file_create_url() to do post-processing on the created url.
- advagg_relocate_js_script_rewrite dans advagg_relocate/
advagg_relocate.module - Add external.
- _advagg_process_html dans ./
advagg.module - Replacement for template_process_html().
Fichier
-
./
advagg.module, line 4913
Code
function advagg_convert_abs_to_rel($path, $strip_base_path = FALSE) {
$base_url = $GLOBALS['base_url'];
// Add a slash to end if none is found.
if (strpos(strrev($base_url), '/') !== 0) {
$base_url .= '/';
}
// Set base path.
$base_path = $GLOBALS['base_path'];
if ($strip_base_path) {
$base_path = '';
}
// Do conversion of https and http to self references.
$base_url_https = advagg_force_https_path($base_url);
$path = str_replace($base_url_https, $base_path, $path);
$base_url_http = advagg_force_http_path($base_url);
$path = str_replace($base_url_http, $base_path, $path);
$base_url = advagg_convert_abs_to_protocol($GLOBALS['base_url']);
// Add a slash to end if none is found.
if (strpos(strrev($base_url), '/') !== 0) {
$base_url .= '/';
}
// Do conversion of protocol relative to self references.
$path = str_replace($base_url, $base_path, $path);
return $path;
}