Same name in other branches
  1. 7.x-2.x advagg.module \advagg_get_relative_path()

Given a uri, get the relative_path.

Paramètres

string $uri: The uri for the stream wrapper.

Return value

string The relative path of the uri.

Voir aussi

https://www.drupal.org/node/837794#comment-9124435

3 calls to advagg_get_relative_path()
advagg_ext_minify_css_minify dans advagg_ext_minify/advagg_ext_minify.module
Minify CSS using via command line.
advagg_ext_minify_js_minify dans advagg_ext_minify/advagg_ext_minify.module
Minify Javascript using via command line.
Files::createSubfile dans src/State/Files.php
Write CSS parts to disk; used when CSS selectors in one file is > 4096.

Fichier

./advagg.module, line 533

Code

function advagg_get_relative_path($uri) {
    $wrapper = \Drupal::service("stream_wrapper_manager")->getViaUri($uri);
    if ($wrapper instanceof DrupalLocalStreamWrapper) {
        $relative_path = $wrapper->getDirectoryPath() . '/' . file_uri_target($uri);
    }
    else {
        $relative_path = parse_url(file_create_url($uri), PHP_URL_PATH);
        if (substr($relative_path, 0, strlen($GLOBALS['base_path'])) == $GLOBALS['base_path']) {
            $relative_path = substr($relative_path, strlen($GLOBALS['base_path']));
        }
    }
    return $relative_path;
}