public static function getConfigDomain($host)
    {
        if (!$host) return null;

        $longDomainEndings = array('or.at', 'co.at', 'gv.at', 'co.uk');

        // cleaning out the dots of long domain endings
        foreach ($longDomainEndings as $k => $v) {
            $longDomainEndings[$k] = str_replace('.', '', $v);
        }

        $hostParts = explode('.', $host);
        if (count($hostParts) <= 1) {
            $ret = $host;
        } else {
            $ret = $hostParts[count($hostParts)-2]  // zB 'vivid-planet'
                            .$hostParts[count($hostParts)-1]; // zB 'com'
        }
        if (in_array($ret, $longDomainEndings)) {
            $ret = $hostParts[count($hostParts)-3].$ret;
        }
        return $ret;
    }
public static function getConfigDomain($host)
    {
        if (!$host) return null;

        $longDomainEndings = array('or.at', 'co.at', 'gv.at', 'co.uk');

        // cleaning out the dots of long domain endings
        foreach ($longDomainEndings as $k => $v) {
            $longDomainEndings[$k] = str_replace('.', '', $v);
        }

        $hostParts = explode('.', $host);
        if (count($hostParts) <= 1) {
            $ret = $host;
        } else {
            $ret = $hostParts[count($hostParts)-2]  // zB 'vivid-planet'
                            .$hostParts[count($hostParts)-1]; // zB 'com'
        }
        if (in_array($ret, $longDomainEndings)) {
            $ret = $hostParts[count($hostParts)-3].$ret;
        }
        return $ret;
    }
public static function getConfigDomain ( $ host ) { if ( ! $ host ) return null ; $ longDomainEndings = array ( 'or.at' , 'co.at' , 'gv.at' , 'co.uk' ) ; // cleaning out the dots of long domain endings foreach ( $ longDomainEndings as $ k => $ v ) { $ longDomainEndings [ $ k ] = str_replace ( '.' , '' , $ v ) ; } $ hostParts = explode ( '.' , $ host ) ; if ( count ( $ hostParts ) <= 1 ) { $ ret = $ host ; } else { $ ret = $ hostParts [ count ( $ hostParts ) - 2 ] // zB 'vivid-planet' . $ hostParts [ count ( $ hostParts ) - 1 ] ; // zB 'com' } if ( in_array ( $ ret , $ longDomainEndings ) ) { $ ret = $ hostParts [ count ( $ hostParts ) - 3 ] . $ ret ; } return $ ret ; }
for unit testing only
for unit testing only