lib/ezutils/classes/ezsys.php
public static function hostname()
    {
        $hostName = null;
        $forwardedHostsString = self::serverVariable( 'HTTP_X_FORWARDED_HOST', true );
        if ( $forwardedHostsString )
        {
            $forwardedHosts = explode( ',', $forwardedHostsString );
            $hostName = trim( $forwardedHosts[0] );
        }

        if ( !$hostName && self::serverVariable( 'HTTP_HOST', true ) )
        {
            $hostName = self::serverVariable( 'HTTP_HOST' );
        }

        if ( !$hostName )
        {
            $siteUrl = eZINI::instance()->variable( 'SiteSettings', 'SiteURL' );
            $hostName = parse_url( "http://{$siteUrl}", PHP_URL_HOST );
        }

        return $hostName;
    }
public static function hostname()
    {
        $hostName = null;
        $forwardedHostsString = self::serverVariable( 'HTTP_X_FORWARDED_HOST', true );
        if ( $forwardedHostsString )
        {
            $forwardedHosts = explode( ',', $forwardedHostsString );
            $hostName = trim( $forwardedHosts[0] );
        }

        if ( !$hostName && self::serverVariable( 'HTTP_HOST', true ) )
        {
            $hostName = self::serverVariable( 'HTTP_HOST' );
        }

        if ( !$hostName )
        {
            $siteUrl = eZINI::instance()->variable( 'SiteSettings', 'SiteURL' );
            $hostName = parse_url( "http://{$siteUrl}", PHP_URL_HOST );
        }

        return $hostName;
    }
public static function hostname ( ) { $ hostName = null ; $ forwardedHostsString = self :: serverVariable ( 'HTTP_X_FORWARDED_HOST' , true ) ; if ( $ forwardedHostsString ) { $ forwardedHosts = explode ( ',' , $ forwardedHostsString ) ; $ hostName = trim ( $ forwardedHosts [ 0 ] ) ; } if ( ! $ hostName && self :: serverVariable ( 'HTTP_HOST' , true ) ) { $ hostName = self :: serverVariable ( 'HTTP_HOST' ) ; } if ( ! $ hostName ) { $ siteUrl = eZINI :: instance ( ) -> variable ( 'SiteSettings' , 'SiteURL' ) ; $ hostName = parse_url ( "http://{$siteUrl}" , PHP_URL_HOST ) ; } return $ hostName ; }
Returns the current hostname.

First tries to use X-Forward-Host before it goes on to use host in header, if none of them
exists fallback to use host part of site.ini\[SiteSettings]|SiteURL setting.

@return string
Returns the current hostname .