Check if the URL may contain an Sitemap

@param string $url
@return bool
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
        );
    }
1341152
public function match($url)
    {
        if (!$this->schemes) {
            return true;
        }

        foreach ($this->schemes as $scheme) {
            if ($scheme->match($url)) {
                return true;
            }
        }

        return false;
    }
171208
protected function doRouteMatching($url)
    {
        $matches = array();
        foreach ($this->route_definitions as $name => $route) {
            if (preg_match($route['regex'], $url, $matches)) {
                $matches[0] = $name;
                return $matches;
            }
        }
        return false;
    }
67998
protected function hasRedirectUrl($url)
    {
        if (null === $this->redirectApi && 0 === strpos($url, $this->getRepositoryApiUrl())) {
            $this->redirectApi = $this->getNewRepositoryUrl();

            if (\is_string($this->redirectApi)) {
                $this->cache->write('redirect-api', $this->redirectApi);
            }
        }

        return \is_string($this->redirectApi);
    }
725533
private function urlWhitelisted($url)
    {
        $always_allowed = array('localhost');
        $whitelisted_domains = array_merge($this->options->getWhitelist(), $always_allowed);

        // Add http if missing(to satisfy parse_url())
        if (strpos($url, "/") !== 0 && strpos($url, "http") !== 0) {
            $url = 'http://' . $url;
        }
        $domain = parse_url($url, PHP_URL_HOST);

        if (strpos($url, "/") === 0 || in_array($domain, $whitelisted_domains)) {
            return true;
        }

        foreach ($whitelisted_domains as $whitelisted_domain) {
            $whitelisted_domain = '.' . $whitelisted_domain;
            if (strpos($domain, $whitelisted_domain) === (strlen($domain) - strlen($whitelisted_domain))) {
                return true;
            }
        }

        return false;
    }
1107594
def sitemap_check(url):
        
        response = urllib2.urlopen(UrlExtractor.get_sitemap_url(url, True))

        # Check if "Sitemap" is set
        return "Sitemap:" in response.read().decode('utf-8')
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;
	}
1285686
protected function isUrlPointingToModule( $url )
    {
        // Grab the first URL element, representing the possible module name
        $urlElements = explode( '/', $url );
        $moduleName = $urlElements[0];

        // Look up for a match in the module list
        $moduleIni = eZINI::instance( 'module.ini' );
        $availableModules = $moduleIni->variable( 'ModuleSettings', 'ModuleList' );
        return in_array( $moduleName, $availableModules, true );
    }
129470
public static function map($url)
    {
        return (isset(self::$mapping[$url])) ? self::$mapping[$url] : false;
    }
306151
public static function isExternalUrl($url)
    {
        /*
         * Unknown url or it's just slash?
         * Nothing to do
         */
        if (empty($url) || '/' === $url) {
            return false;
        }

        $currentUrl = self::getServerNameOrIp(true);
        $url = self::replenishProtocol($url);

        // Let's prepare pattern of current url
        $search = [
            ':',
            '/',
            '.',
        ];

        $replace = [
            '\:',
            '\/',
            '\.',
        ];

        $currentUrlPattern = str_replace($search, $replace, $currentUrl);

        return !Regex::contains($url, $currentUrlPattern);
    }
1323860
protected function checkIfReservedWordInUrl($url = false)
    {
        $sections = $this->getCurrentUrlSections();
        if (count($sections) >= 1) {
            $last = intval($sections[count($sections) - 1]);
        }

        $keywords = [
            'show',
            'create',
            'edit',
        ];

        foreach ($sections as $key => $slug) {
            if (in_array($slug, $keywords)) {
                return $slug;
            }
        }

        // resource ID
        if ($last >= 1) {
            return 'show';
        }

        return false;
    }
997231
private function checkRouteAlias($url)
    {
        $alias = strpos($url, '|') ? strstr($url, '|', true) : $url;

        $item = $this->router->getAlias($alias);

        return $item ? $item->check($url) : false;
    }
1088690
public function isWebpage($url) {
		$url = filter_var($url, FILTER_VALIDATE_URL);
		if (!strlen($url)) {
			return false;
		}
		
		$c = curl_init(); 
		curl_setopt($c, CURLOPT_URL, $url); 
		curl_setopt($c, CURLOPT_HEADER, 1); // get the header 
		curl_setopt($c, CURLOPT_NOBODY, 1); // and *only* get the header 
		curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); // get the response as a string from curl_exec(), rather than echoing it 
		curl_setopt($c, CURLOPT_FRESH_CONNECT, 1); // don't use a cached version of the url 
		$result = curl_exec($c);
		
		if (!$result) { 
			return false; 
		} 
		
		if (stripos($result, 'Content-type: text/html')) {
//			$svc = new RestfulService($url);
//			$response = $svc->request('', 'GET');
			return true;
		}
		
		return false;
	}
1313606
protected function generateSiteMap($websiteUrl)
    {
        $urls = array();
        foreach ($this->pageTreeCollection->getPages() as $pageTree) {
            $page = $pageTree->getPage();
            if ( ! $page->getIsPublished()) {
                continue;
            }

            $seo = $pageTree->getSeo();
            $permalink = "";
            if ( ! $pageTree->getLanguage()->getMainLanguage() || ! $page->getIsHome()) {
                $permalink = $seo->getPermalink();
            }

            $urls[] = array(
                'href' => $websiteUrl . $permalink,
                'frequency' => $seo->getSitemapChangefreq(),
                'priority' => $seo->getSitemapPriority()
            );
        }

        return $this->templating->render('RedKiteCmsBundle:Sitemap:sitemap.html.twig', array('urls' => $urls));
    }
139313
protected function urlCheck($url)
    {
        // first check if url has http:// prefix, if not, add it
        $parsed = parse_url($url);

        if (empty($parsed['scheme'])) {
            $url = 'http://' . ltrim($url, '/');
        }

        $file_headers = get_headers($url);

        if (!strpos($file_headers[0], "404 Not Found") > 0) {
            return true;
        }
        
        return false;
    }
1010178
public function findURL($url)
    {
        $nb_site_target = $this->getItem($url, self::INDEX_URL_STATIC);
        if ($nb_site_target === null) {
            //$nb_site_target = $this->findByRegExpr(self::INDEX_URL_REGEXP, $url);
        }

        return $nb_site_target;
    }
286191
public static function valid($url)
    {
        if (Str::startsWith($url, '//')) {
            return true;
        }

        return filter_var($url, FILTER_VALIDATE_URL) !== false;
    }