code/libraries/joomlatools/library/template/locator/file.php
public function normalise($url)
    {
        $scheme = parse_url($url, PHP_URL_SCHEME);
        $path   = str_replace(array('/', '\\', $scheme.'://'), DIRECTORY_SEPARATOR, $url);

        $parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');

        $absolutes = array();
        foreach ($parts as $part)
        {
            if ('.' == $part) {
                continue;
            }

            if ('..' == $part) {
                array_pop($absolutes);
            } else {
                $absolutes[] = $part;
            }
        }

        $path = implode(DIRECTORY_SEPARATOR, $absolutes);
        $url  = $scheme ? $scheme.'://'.$path : $path;

        return $url;
    }
public function normalise($url)
    {
        $scheme = parse_url($url, PHP_URL_SCHEME);
        $path   = str_replace(array('/', '\\', $scheme.'://'), DIRECTORY_SEPARATOR, $url);

        $parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');

        $absolutes = array();
        foreach ($parts as $part)
        {
            if ('.' == $part) {
                continue;
            }

            if ('..' == $part) {
                array_pop($absolutes);
            } else {
                $absolutes[] = $part;
            }
        }

        $path = implode(DIRECTORY_SEPARATOR, $absolutes);
        $url  = $scheme ? $scheme.'://'.$path : $path;

        return $url;
    }
public function normalise ( $ url ) { $ scheme = parse_url ( $ url , PHP_URL_SCHEME ) ; $ path = str_replace ( array ( '/' , '\\' , $ scheme . '://' ) , DIRECTORY_SEPARATOR , $ url ) ; $ parts = array_filter ( explode ( DIRECTORY_SEPARATOR , $ path ) , 'strlen' ) ; $ absolutes = array ( ) ; foreach ( $ parts as $ part ) { if ( '.' == $ part ) { continue ; } if ( '..' == $ part ) { array_pop ( $ absolutes ) ; } else { $ absolutes [ ] = $ part ; } } $ path = implode ( DIRECTORY_SEPARATOR , $ absolutes ) ; $ url = $ scheme ? $ scheme . '://' . $ path : $ path ; return $ url ; }
Normalise a template url

Resolves references to /./, /../ and extra / characters in the input path and
returns the canonicalize absolute url. Equivalent of realpath() method.

@param  string $url   The template to normalise
@return string|false  The normalised template url
Normalise a template url