Checks to make sure the URL is a relative or absolute path on the
existing domain.

Simply returns false if the url starts with http or https

@param string $url
@return bool True if the url is valid, false if it is not
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;
    }
816078
public static function active( $url )
	{
		$url = parse_url( $url, PHP_URL_PATH );

		if ( empty( $url ) )
		{
			return false;
		}

		if ( $url[0] !== '/' )
		{
			$url = static::to( $url );
		}

		// when we are on "/" only "/" counts as active.
	 	if ( $url === '/' )
		{
			return static::current() == $url;
		}

		// for everything else we cut the url and compare
		$cut = substr( static::current(), 0, strlen( $url ) );

		return $cut == $url;
	}
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);
    }
43291
public function isAdminRoute($url)
    {
        if ($this->matchesPreviewRoute($url)) {
            return false;
        }

        preg_match(sprintf(self::$ADMIN_MATCH_REGEX, $this->adminKey), $url, $matches);

        // Check if path is part of admin area
        if (count($matches) === 0) {
            return false;
        }

        return true;
    }
497137
protected function isSitemapURL($url)
    {
        $path = parse_url($this->urlEncode($url), PHP_URL_PATH);
        return $this->urlValidate($url) && (
            mb_substr($path, -mb_strlen(self::XML_EXTENSION) - 1) == '.' . self::XML_EXTENSION ||
            mb_substr($path, -mb_strlen(self::XML_EXTENSION_COMPRESSED) - 1) == '.' . self::XML_EXTENSION_COMPRESSED
        );
    }
534271
public function hasStaticUrlSegment(string $url) :bool {
		// if the route is dynamic (has parameters), and starts with the base segment or if it matches strictly
		return 
			($this->indexedParameters && strpos($url, $this->staticSegment) === 0) || 
			$this->url == $url;
	}
537853
public static function urlExists($url) {
		// @codingStandardsIgnoreStart
		$headers = @get_headers($url);
		// @codingStandardsIgnoreEnd
		if ($headers && preg_match('|\b200\b|', $headers[0])) {
			return true;
		}
		return false;
	}
1036595
public static function domainFromString($url)
    {
        $domain = parse_url($url, PHP_URL_HOST);
        if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) {
            return $regs['domain'];
        }
        return false;
    }
1352965
public function is_current_url( $url )
	{
		$current_url = $this->getSession()->getCurrentUrl();

		if ( $url === substr( $current_url, 0 - strlen( $url ) ) ) {
			return true;
		} else {
			return false;
		}
	}
329334
public function supports($url)
    {
        $error = $this->validator->validate($url, [new Url()]);

        return 0 === count($error);
    }
663400
public static function prefaceURLwithHTTP($url) {
        $url = trim($url);

        if (substr($url, 0, 7 ) == "http://") {
            return $url;
        }

        if (substr($url, 0, 8 ) == "https://") {
            return $url;
        }

        return "http://".$url;
    }
439810
public function relative($url)
    {
        if (!$url || $url == '/') {
            return '.';
        }

        if (strpos($url, '..') !== false) {
            throw new InvalidArgumentException('Double dots in paths are not allowed');
        }

        $baseUrl = $this->getBaseUrl();

        if ($baseUrl && strpos($url, $baseUrl) === 0) {
            return trim(str_replace($baseUrl, '', $url), '/');
        }

        if ($this->startsWithBasePath($url) || !$this->checkFilesystem) {
            return trim(str_replace($this->basePath, '', $url), '/');
        }

        return static::getRelativePath($this->basePath, $url);
    }
484044
public static function isURL(string $url): bool {
        return (boolean) !(filter_var($url, FILTER_SANITIZE_URL | FILTER_VALIDATE_URL) === false);
    }
1302508
public static function isHttps(string $url)
    {
        $url = UrlHelper::validateUrl($url);

        $parsedUrl = parse_url($url);
        if ($parsedUrl === false) {
            throw new InvalidArgumentException("The provided url is not valid: $url");
        }

        return $parsedUrl["scheme"] === UrlHelper::HTTPS_SCHEME;
    }
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;
    }
693483
public static function url_exist($url)
    {
        $headers = @get_headers($url);

        if (empty($headers) || 'HTTP/1.1 404 Not Found' == $headers[0]) {
            return false;
        }

        return true;
    }
863669
public function validate($url)
    {
        $url = UrlImmutable::createFromUrl($url);

        $query = $url->getQuery();

        if ($this->isMissingAQueryParameter($query)) {
            return false;
        }

        $expiration = $query[$this->expiresParameter];

        if (!$this->isFuture($expiration)) {
            return false;
        }

        if (!$this->hasValidSignature($url)) {
            return false;
        }

        return true;
    }