@param string $url

@return bool
328119
public function isAccessible($url)
    {
        $context = $this->getContext($url);

        return is_resource(@fopen($url, 'r', null, $context));
    }
1355678
protected function checkUrl($url)
    {
        if ($this->fullName) {
            $pos = strpos($this->fullName, '<');

            if (false !== $pos) {
                $str = substr($this->fullName, 0, $pos);
            } else {
                $str = $this->fullName;
            }

            if ($str && 0 !== stripos(str_replace('|', '/', $url), $str)) {
                return false;
            }
        }

        return true;
    }
1199515
protected function isValidDomain($url)
    {
        $trusted = $this->config->trusted_sites;


        if (!empty($trusted)) {
            extract(parse_url($url));

            $host = substr($url, 0, strpos($url, $host)).$host;

            if (!$this->matchHost($host, $trusted)) {
                return false;
            }
        }
        return $url;
    }
298226
public function checkLink($url)
    {
        $url = trim($url);
        if (substr($url, 0, 7 ) == "http://") return $url;

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

        return "http://".$url;
    }
520311
public function getDesiredUrl(?string $url = null)
  {
    if (isset($_GET['url'])) {
      $url = $_GET['url'] . (count($_GET) > 0 ? '?' : '');
      unset($_GET['url']);

      foreach ($_GET as $key => $value) {
        $url .= (ends_with($url, '?') ? '' : '&') . $key . '=' . $value;
      }
    }

    if ($url != null) return $url;
    return false;
  }
77592
static function isSameHost($url)
    {
        $urlParts = parse_url($url);
        if(
            isset($_SERVER['SERVER_NAME']) &&
            $_SERVER['SERVER_NAME'] == $urlParts['host']
        ){
            return true;
        }

        return false;
    }
186018
protected function loadFromUrl($url)
    {
        $url = $this->overrideUrl($url);
        $this->log->debug("Load from url $url");
        $this->initCurl();
        curl_setopt($this->curl, CURLOPT_URL, $url);
        if (!$data = $this->getDataFromCurl()) {
            return false;
        }

        // fix encoding
        $data = iconv('ISO-8859-15', 'UTF-8', $data);

        // validate data through parser
        if (!$this->isDataValid($data)) {
            $this->addError($url, 'Data not valid according to parser');

            return false;
        }

        // save result to disk
        $this->saveToCache($data);

        return true;
    }
173844
public function contains($url)
	{
		$url = trim($url, '/');

		foreach ($this->entries as $entry) {
			if ($entry['loc'] == $url) {
				return TRUE;
			}
		}

		return FALSE;
	}
1205974
public function checkWhitelist(string $url): bool
	{
		$pluginSettings = EmbeddedAssets::$plugin->getSettings();
		$whitelist = array_merge($pluginSettings->whitelist, $pluginSettings->extraWhitelist);

		foreach ($whitelist as $whitelistUrl)
		{
			if ($whitelistUrl)
			{
				$pattern = explode('*', $whitelistUrl);
				$pattern = array_map('preg_quote', $pattern);
				$pattern = implode('[a-z][a-z0-9]*', $pattern);
				$pattern = "%^(https?:)?//([a-z0-9\-]+\\.)?$pattern([:/].*)?$%";

				if (preg_match($pattern, $url))
				{
					return true;
				}
			}
		}

		return false;
	}
329334
public function supports($url)
    {
        $error = $this->validator->validate($url, [new Url()]);

        return 0 === count($error);
    }
557053
public static function isUrlArchive($url)
    {
        if (0 === strpos($url, 'http')) {
            foreach (self::$extensions as $extension) {
                if (substr($url, -\strlen($extension)) === $extension) {
                    return true;
                }
            }
        }

        return false;
    }
1143474
protected function compare($url)
    {
        $activeMenuRouteUrl = $this->getActiveMenuRoute();
        if ($this->url == $url or $url == $activeMenuRouteUrl) {
            return true;
        }
        $segments = $this->segments;
        $count    = count($segments);
        if ($count !== count(array_filter(explode('/', str_replace(url('/'), '', $url))))) {
            return false;
        }

        $segmented = url('/') . '/' . implode('/', array_slice($segments, 0, $count - 1));
        if (count($segments) > 2 && starts_with($url, $segmented)) {
            return true;
        }
        @list($domain, $area, $module, $action) = explode('/', str_replace('http://', '', $url));
        if (!isset($segments[1])) {
            return false;
        }
        return ($segments[1] == $module && isset($segments[2]) && (in_array($segments[2], ['index', 'edit']) or is_numeric($segments[2])));
    }
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;
    }
1257123
public function isMatch($url){

		$url = trim($url);
		if($url == $this->pattern)
			return true;

		$parts = explode("/", trim($url, "/"));
		$pattern = explode("/", trim($this->pattern, "/"));

		if(count($parts) != count($pattern))
			return false;

		// print_r($pattern);

		$regex = array();
		foreach($pattern as $key=>$url_item){

			if(preg_match_all("|{(.*):(.*)}|", $url_item, $matches)){

				if(in_array(reset($matches[2]),  array("int", "bool", "alpha", "float", "date"))){

					switch(reset($matches[2])){

						case "int":
							$regex[] = "[0-9]+";
						break;
						case "bool":
							$regex[] = "(true|false)";
						break;
						case "alpha":
							$regex[] = "[A-Za-z]+";
						break;
						case "float":
							$regex[] = "[+-]?\d+(\.\d+)?";
						break;
						case "date"://yyyy-mm-dd
							$regex[] = "(19?[0-9]{2}|20[0-1][0-4])-(0?[1-9]|1[0-2])-([0-2]?[0-9]|3[0-1])";
						break;
					}

					$this->params[reset($matches[1])] = $parts[$key];
				}
			}
			elseif(preg_match_all("|{(.*)}|", $url_item, $matches)){

				$regex[] = ".*";
				$this->params[reset($matches[1])] = $parts[$key];
			}
			else $regex[] = $url_item;
		}

		return (bool)preg_match(sprintf("/^%s$/", implode("\/", $regex)), trim($url, "/"));
	}
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;
	}
166982
public static function getUrl($url = false)
    {
        $url = false !== $url ? $url : self::$_url;
        return $url;
    }
309937
public static function isHttp(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::HTTP_SCHEME;
    }