Classes/Utility/GeneralUtility.php
public static function fullUrl($url, $domain = null)
    {
        if (!preg_match('/^https?:\/\//i', $url)) {
            // Fix for root page link
            if ($url === '/') {
                $url = '';
            }

            // remove first /
            if (strpos($url, '/') === 0) {
                $url = substr($url, 1);
            }

            if ($domain !== null) {
                // specified domain
                $url = 'http://' . $domain . '/' . $url;
            } else {
                // domain from env
                $url = Typo3GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $url;
            }
        }

        // Fix url stuff
        $url = str_replace('?&', '?', $url);

        return $url;
    }
public static function fullUrl($url, $domain = null)
    {
        if (!preg_match('/^https?:\/\//i', $url)) {
            // Fix for root page link
            if ($url === '/') {
                $url = '';
            }

            // remove first /
            if (strpos($url, '/') === 0) {
                $url = substr($url, 1);
            }

            if ($domain !== null) {
                // specified domain
                $url = 'http://' . $domain . '/' . $url;
            } else {
                // domain from env
                $url = Typo3GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $url;
            }
        }

        // Fix url stuff
        $url = str_replace('?&', '?', $url);

        return $url;
    }
public static function fullUrl ( $ url , $ domain = null ) { if ( ! preg_match ( '/^https?:\/\//i' , $ url ) ) { // Fix for root page link if ( $ url === '/' ) { $ url = '' ; } // remove first / if ( strpos ( $ url , '/' ) === 0 ) { $ url = substr ( $ url , 1 ) ; } if ( $ domain !== null ) { // specified domain $ url = 'http://' . $ domain . '/' . $ url ; } else { // domain from env $ url = Typo3GeneralUtility :: getIndpEnv ( 'TYPO3_SITE_URL' ) . $ url ; } } // Fix url stuff $ url = str_replace ( '?&' , '?' , $ url ) ; return $ url ; }
Generate full url

Makes sure the url is absolute (http://....)

@param   string $url    URL
@param   string $domain Domain

@return  string
Generate full url