Same name in other branches
  1. 7.x-2.x 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

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;
}