src/Common/CodeIgniter/Core/Config.php
public function site_url($sUrl = '', $bForceSecure = false)
    {
        //  If an explicit URL is passed in, then leave it be
        if (preg_match('/^(http|https|ftp|mailto)\:/', $sUrl)) {
            return $sUrl;
        }

        $sUrl = parent::site_url($sUrl);

        //  If the URL begins with a slash then attempt to guess the host using $_SERVER
        if (preg_match('/^\//', $sUrl) && !empty($_SERVER['HTTP_HOST'])) {
            $sProtocol = !empty($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : 'http';
            $sUrl      = $sProtocol . '://' . $_SERVER['HTTP_HOST'] . $sUrl;
        }

        if ($bForceSecure || Functions::isPageSecure()) {
            $sUrl = preg_replace('#^' . BASE_URL . '#', SECURE_BASE_URL, $sUrl);
        }

        return $sUrl;
    }
public function site_url($sUrl = '', $bForceSecure = false)
    {
        //  If an explicit URL is passed in, then leave it be
        if (preg_match('/^(http|https|ftp|mailto)\:/', $sUrl)) {
            return $sUrl;
        }

        $sUrl = parent::site_url($sUrl);

        //  If the URL begins with a slash then attempt to guess the host using $_SERVER
        if (preg_match('/^\//', $sUrl) && !empty($_SERVER['HTTP_HOST'])) {
            $sProtocol = !empty($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : 'http';
            $sUrl      = $sProtocol . '://' . $_SERVER['HTTP_HOST'] . $sUrl;
        }

        if ($bForceSecure || Functions::isPageSecure()) {
            $sUrl = preg_replace('#^' . BASE_URL . '#', SECURE_BASE_URL, $sUrl);
        }

        return $sUrl;
    }
public function site_url ( $ sUrl = '' , $ bForceSecure = false ) { //  If an explicit URL is passed in, then leave it be if ( preg_match ( '/^(http|https|ftp|mailto)\:/' , $ sUrl ) ) { return $ sUrl ; } $ sUrl = parent :: site_url ( $ sUrl ) ; //  If the URL begins with a slash then attempt to guess the host using $_SERVER if ( preg_match ( '/^\//' , $ sUrl ) && ! empty ( $ _SERVER [ 'HTTP_HOST' ] ) ) { $ sProtocol = ! empty ( $ _SERVER [ 'REQUEST_SCHEME' ] ) ? $ _SERVER [ 'REQUEST_SCHEME' ] : 'http' ; $ sUrl = $ sProtocol . '://' . $ _SERVER [ 'HTTP_HOST' ] . $ sUrl ; } if ( $ bForceSecure || Functions :: isPageSecure ( ) ) { $ sUrl = preg_replace ( '#^' . BASE_URL . '#' , SECURE_BASE_URL , $ sUrl ) ; } return $ sUrl ; }
Returns the site's URL, secured if necessary

@param string $sUrl
@param bool   $bForceSecure

@return mixed|string
Returns the site s URL secured if necessary