Return the domain of the url (for example: google).

@param bool $first_level True to return the first level domain (.com, .es, etc)

@return string
767431
public function getDomain($first_level = false)
    {
        $host = $this->getHost();

        if (empty($host)) {
            return '';
        }

        $host = array_reverse(explode('.', $host));

        switch (count($host)) {
            case 1:
                return $host[0];

            case 2:
                return $first_level ? ($host[1].'.'.$host[0]) : $host[1];

            default:
                $tld = $host[1].'.'.$host[0];
                $suffixes = self::getSuffixes();

                if (in_array($tld, $suffixes, true)) {
                    return $first_level ? $host[2].'.'.$tld : $host[2];
                }

                return $first_level ? $host[1].'.'.$host[0] : $host[1];
        }
    }
829780
public static function getDomainName(string $url): string
    {
        if (isset(self::$cached_url_domains[$url])) {
            return self::$cached_url_domains[$url];
        }

        $parsed_url = parse_url(strtolower($url));
        $host = $parsed_url['host'] ?? '';

        /// Remove www. part
        if (0 === strpos($host, 'www.')) {
            $host = substr($host, 4);
        }

        // Get last part (zone)
        $parts = array_reverse(explode('.', $host));

        if (!$parts || !self::zoneExists($parts[0])) {
            return '';
        }

        if(count($parts)==1){
            $domain = $parts[0];
        }else {
            $zone = '.' . $parts[0];

            // Save parsed url and found zone
            $domain = substr($host, 0, -strlen($zone));
        }

        return self::$cached_url_domains[$url] = $domain;
    }
667871
protected function first_page()
    {
        $style = @$this->span_class['first'];
        if ($this->page == 1)
        {
            return '<span class="' . $style . '">' . $this->first_page . '</span>';
        }

        return $this->_get_link($this->_get_url(1), $this->first_page, $style);
	}
629761
public static function getRootDomain($url)
    {
        $host = $domain = self::getHostname($url);
        $root = false;

        if (($dotsCount = substr_count($host, '.')) > 0) {
            $last = $domain;
            while ($dotsCount > -1) {
                if (self::isHostInSuffixList($domain)) {
                    $root = $last;
                    break;
                }
                $last = trim($domain, '.');
                $domain = substr($last, strpos($last, '.'));
                $dotsCount = $dotsCount - 1;
            }
        }

        return $root;
    }
1339730
public function getDomainName(): string
    {
        return $this->myDomainParts[count($this->myDomainParts) - 1] . ($this->myTld !== null ? '.' . $this->myTld : '');
    }
1001236
public function getMainUrl($url)
    {
        $social  = $this->getSocialNetworkFromDomain($url);
        foreach ($this->getDefinitions() as $domain => $name) {

            if ($name == $social) {

                return $domain;
            }
        }
        return $url;
    }
527792
public function getTextdomain()
    {
        $textDomain = Strata::app()->getConfig("i18n.textdomain");
        return is_null($textDomain) ? self::DOMAIN : $textDomain;
    }
776225
public function GetThirdLevelDomain () {
		if ($this->domainParts === NULL) $this->initDomainSegments();
		return isset($this->domainParts[0]) ? $this->domainParts[0] : NULL;
	}
650980
public function getDomain() : ?string 
    {
        if ( ! $this->hasDomain()) {
            $this->setDomain($this->getDefaultDomain());
        }
        return $this->domain;
    }
910074
public static function getDomain($uri)
    {
        $returnValue = parse_url($uri, PHP_URL_HOST);
        if (empty($returnValue)) {
            return null;
        }

        return $returnValue;
    }
837615
public function getTld() : ?string 
    {
        if ( ! $this->hasTld()) {
            $this->setTld($this->getDefaultTld());
        }
        return $this->tld;
    }
771067
public function getDomain($name)
    {
        if (isset($this->domainMap[$name])) {
            return $this->domainMap[$name];
        }

        return null;
    }
993864
public function getDomain($tldLength = 1)
    {
        $segmentList = explode('.', $this->getHost());
        $domain = array_slice($segmentList, -1 * ($tldLength + 1));
        return implode('.', $domain);
    }
299408
public function getDomains()
    {
        $res = $this->doRequest('GET_DOMAINS');
        if (!$res) {
            return false;
        }

        $domains = array();

        for ($i = 1; $i <= $res['domains']; ++$i) {
            $dom = 'domain'.$i;
            $classes = array();

            // Associate classes to current domain (class name => mindevcount)
            for ($j = 1; $j <= $res[$dom.'classes']; ++$j) {
                $classes[$res[$dom.'class'.$j.'name']] = $res[$dom.'class'.$j.'mindevcount'];
            }

            $domains[] = array('name' => $res[$dom], 'classes' => $classes);
        }

        return $domains;
    }
701897
function GetSubdomain()
    {
        $host = $this->host;
        $sub = substr($host, 0, strlen($host) - strlen($this->GetDomain()));
        return rtrim($sub, '.');
    }
292392
public static function domain()
	{
		$arr = self::_getConfigArray();
		array_shift($arr);
		if (is_null($arr))
		{
			$arr = [];
		}

		$domain = implode('.', $arr);
		return $domain;
	}
1225911
public function domain($tldLength = 1)
    {
        $segments = explode('.', $this->host());
        $domain = array_slice($segments, -1 * ($tldLength + 1));

        return implode('.', $domain);
    }