src/Common/Service/Config.php
public static function siteUrl($sUri, $bUseSecure = false)
    {
        if (preg_match('/^(https?:\/\/|#)/', $sUri)) {
            //  Absolute URI; return unaltered
            return $sUri;
        } else {

            if ($bUseSecure && defined('SECURE_BASE_URL')) {
                $sBaseUrl = rtrim(SECURE_BASE_URL, '/') . '/';
            } else {
                $sBaseUrl = rtrim(BASE_URL, '/') . '/';
            }

            if (is_file($sUri) || is_dir($sUri)) {
                return $sBaseUrl . ltrim($sUri, '/');
            }

            /** @var Locale $oLocale */
            $oLocale = Factory::service('Locale');
            $sLocale = $oLocale->getUrlSegment($oLocale->get());
            $sLocale = $sLocale && $sUri ? $sLocale . '/' : $sLocale;

            return $sBaseUrl . $sLocale . ltrim($sUri, '/');

        }
    }
public static function siteUrl($sUri, $bUseSecure = false)
    {
        if (preg_match('/^(https?:\/\/|#)/', $sUri)) {
            //  Absolute URI; return unaltered
            return $sUri;
        } else {

            if ($bUseSecure && defined('SECURE_BASE_URL')) {
                $sBaseUrl = rtrim(SECURE_BASE_URL, '/') . '/';
            } else {
                $sBaseUrl = rtrim(BASE_URL, '/') . '/';
            }

            if (is_file($sUri) || is_dir($sUri)) {
                return $sBaseUrl . ltrim($sUri, '/');
            }

            /** @var Locale $oLocale */
            $oLocale = Factory::service('Locale');
            $sLocale = $oLocale->getUrlSegment($oLocale->get());
            $sLocale = $sLocale && $sUri ? $sLocale . '/' : $sLocale;

            return $sBaseUrl . $sLocale . ltrim($sUri, '/');

        }
    }
public static function siteUrl ( $ sUri , $ bUseSecure = false ) { if ( preg_match ( '/^(https?:\/\/|#)/' , $ sUri ) ) { //  Absolute URI; return unaltered return $ sUri ; } else { if ( $ bUseSecure && defined ( 'SECURE_BASE_URL' ) ) { $ sBaseUrl = rtrim ( SECURE_BASE_URL , '/' ) . '/' ; } else { $ sBaseUrl = rtrim ( BASE_URL , '/' ) . '/' ; } if ( is_file ( $ sUri ) || is_dir ( $ sUri ) ) { return $ sBaseUrl . ltrim ( $ sUri , '/' ) ; } /** @var Locale $oLocale */ $ oLocale = Factory :: service ( 'Locale' ) ; $ sLocale = $ oLocale -> getUrlSegment ( $ oLocale -> get ( ) ) ; $ sLocale = $ sLocale && $ sUri ? $ sLocale . '/' : $ sLocale ; return $ sBaseUrl . $ sLocale . ltrim ( $ sUri , '/' ) ; } }
Prepends BASE_URL or SECURE_BASE_URL to a string

@param string $sUri       The URI to append
@param bool   $bUseSecure Whether to use BASE_URL or SECURE_BASE_URL

@return string
Prepends BASE_URL or SECURE_BASE_URL to a string