public function generateUrl($url)
    {
        $extern = false;
        if ((0 === strrpos($url, 'http://'))
            || (0 === strrpos($url, 'https://'))) {
            $extern = true;
        }

        $http = (isset($_SERVER['HTTPS'])) ? 'https://' : 'http://';

        if (!$extern) {
            return ($this->getRoot() == '/')
                ? (($this->getRoot() == $url) ? '' : $url) : $http.$_SERVER['SERVER_NAME'].$this->getRoot().$url;
        } else {
            return $url;
        }
    }
public function generateUrl($url)
    {
        $extern = false;
        if ((0 === strrpos($url, 'http://'))
            || (0 === strrpos($url, 'https://'))) {
            $extern = true;
        }

        $http = (isset($_SERVER['HTTPS'])) ? 'https://' : 'http://';

        if (!$extern) {
            return ($this->getRoot() == '/')
                ? (($this->getRoot() == $url) ? '' : $url) : $http.$_SERVER['SERVER_NAME'].$this->getRoot().$url;
        } else {
            return $url;
        }
    }
public function generateUrl ( $ url ) { $ extern = false ; if ( ( 0 === strrpos ( $ url , 'http://' ) ) || ( 0 === strrpos ( $ url , 'https://' ) ) ) { $ extern = true ; } $ http = ( isset ( $ _SERVER [ 'HTTPS' ] ) ) ? 'https://' : 'http://' ; if ( ! $ extern ) { return ( $ this -> getRoot ( ) == '/' ) ? ( ( $ this -> getRoot ( ) == $ url ) ? '' : $ url ) : $ http . $ _SERVER [ 'SERVER_NAME' ] . $ this -> getRoot ( ) . $ url ; } else { return $ url ; } }
Used to generate a URL based on relative or absolute.

@param string $url - URL to generate from

@return string
Used to generate a URL based on relative or absolute .