Test if domain is valid with different methods
@param  string $url Url to check
@return boolean
17853
public function isBroken($url)
    {
        if (!$domain = parse_url($url, PHP_URL_HOST)) {
            return true;
        }

        if(in_array($domain, (array) apply_filters('brokenLinks/External/ExceptedDomains', array()))) {
            return false;
        }

        // Convert domain name to IDNA ASCII form
        if(count(explode('.', $domain)) == count(array_filter(explode('.', $domain),
            function($var) {
                if(strlen($var) < 1) {
                    return false; 
                }
                return true; 
            })))  
        {
            try {
                $punycode = new Punycode();
                $domainAscii = $punycode->encode($domain);
                $url = str_ireplace($domain, $domainAscii, $url);
            } catch (Exception $e) {
                return false;
            }
        }

        // Test if URL is internal and page exist
        if ($this->isInternal($url)) {
            return false;
        }

        // Validate domain name
        if (!$this->isValidDomainName(isset($domainAscii) ? $domainAscii : $domain)) {
            return true;
        }

        // Test if domain is available
        return !$this->isDomainAvailable($url);
    }
246183
public function is(string $url)
  {
    if ($this->path() == $url || $this->url() == $url) return true;
    return false;
  }
153355
public function isValid($value)
    {
        $result = (boolean) filter_var($value, FILTER_VALIDATE_URL);
        if (!$result) {
            $this->addMessage('url');
        }
        return $result;
    }
758769
public function hostExists($url)
    {
        if (strpos($url, '/') === false) {
            $server = $url;
        } else {
            $server = @parse_url($url, PHP_URL_HOST);
        }
        if (!$server) {
            return false;
        }
        $ips = gethostbynamel($server);

        return !empty($ips);
    }
180623
public static boolean isDomainClass(URL url) {
        if (url == null) return false;
        return KNOWN_DOMAIN_CLASSES.get(url.getFile());
    }
77592
static function isSameHost($url)
    {
        $urlParts = parse_url($url);
        if(
            isset($_SERVER['SERVER_NAME']) &&
            $_SERVER['SERVER_NAME'] == $urlParts['host']
        ){
            return true;
        }

        return false;
    }
107600
function nicifyUrl($url) {
			$fullurl = $url;
		    $url = urldecode(strtolower($url));
		    $url = $this->stripit($url);
		    // clean up url path
		    $url = explode("/",$url);
		    $arrUrl = parse_url($url[0]);
		    $urlRet = $arrUrl['path'];
		    // valid?
		    if($this->validateTheUrl($urlRet)){
		        return true;
		    }
		    else{
		        return false;
		    }
		}
223889
public function isValidHttpMethod($method)
    {
        $method = strtoupper($method);

        if (in_array('ANY', $this->methods)) {
            return true;
        }

        return (bool)in_array($method, $this->methods);
    }
484044
public static function isURL(string $url): bool {
        return (boolean) !(filter_var($url, FILTER_SANITIZE_URL | FILTER_VALIDATE_URL) === false);
    }
903606
public function isInternal($url)
    {
        // Check if post exist by url (only works with 'public' posts)
        $postId = url_to_postid($url);
        if ($postId > 0) {
            return true;
        }

        // Check if the URL is internal or external
        $siteUrlComponents = parse_url(get_site_url());
        $urlComponents = parse_url($url);
        if (!empty($siteUrlComponents['host']) && !empty($urlComponents['host']) && strcasecmp($urlComponents['host'], $siteUrlComponents['host']) === 0) {
            // Test with get_page_by_path() to get other post statuses
            $postTypes = get_post_types(array('public' => true));
            if (!empty($urlComponents['path']) && !empty(get_page_by_path(basename(untrailingslashit($urlComponents['path'])), ARRAY_A, $postTypes))) {
                return true;
            }
        }

        return false;
    }
1330620
protected function isUrl($url)
    {
        $urlArr = parse_url($url);

        return $urlArr['scheme']
        && in_array($urlArr['scheme'], array('http', 'https'))
        && $urlArr['host']
        && $urlArr['path'];
    }
376841
protected function _validUrl($url) {
		$headers = Utility::getHeaderFromUrl($url);
		if ($headers === false) {
			return false;
		}
		$headers = implode("\n", $headers);
		$protocol = mb_strpos($url, 'https://') === 0 ? 'HTTP' : 'HTTP';
		if (!preg_match('#^' . $protocol . '/.*?\s+[(200|301|302)]+\s#i', $headers)) {
			return false;
		}
		if (preg_match('#^' . $protocol . '/.*?\s+[(404|999)]+\s#i', $headers)) {
			return false;
		}
		return true;
	}
674214
public static function is($url, $regexp = false) {
        $r = self::getRouter();
        if ($regexp) {
            return preg_match('`^' . $url . '$`', $r->requestURL);
        }

        return $url == $r->requestURL;
    }
267953
protected function isValidUrl($url)
    {
        $valid = false;

        $parseUrl = parse_url($url);

        if(isset($parseUrl['host']) || !empty($parseUrl['host'])) {

            $uri = new \Zend\Validator\Uri();
            if ($uri->isValid($url)) {
                $valid = true;
            }
            else {
                $valid = false;
            }
        }

        return $valid;
    }
221570
private function isValidDomain($domain)
    {
        if (filter_var($domain, FILTER_VALIDATE_URL)) {
            return true;
        }

        $regex = '~^(https?:\/\/|(\*\.){1})?(\w.+)(\.)(?!\s)(?!\.\*)(\w{2,})$~i';
        return (bool) preg_match($regex, $domain);
    }
108175
public function matchUrl($method, $url) {
		if ($this->method == $method) {
			if (preg_match('/^' . $this->url . '$/', $url, $matches)) {
				$params = $this->prepareParams($matches);
				$this->execute($params);
				return true;
			}
			return false;
		}
	}
423090
protected function isRedirectionUrlValid(string $url)
    {
        // No http or https
        if (stripos(trim($url), "http")===0){
            return false;
        }

        // In fact no scheme:// at all thanks.
        if (stripos($url, "://")!==false){
            return false;
        }

        return true;
    }