Registers an URL to the URL database and returns the URL id.
If URL is already present, the method will check the checksum and update the URL if needed
@param string $url
@return int
338746
static function registerURL( $url )
    {
        $urlID = null;
        $urlObject = self::fetchByUrl( $url );

        if ( !$urlObject instanceof eZURL )
        {
            // store URL
            $urlObject = self::create( $url );
            $urlObject->store();
            $urlID = $urlObject->attribute( 'id' );
        }
        else
        {
            // Mismatch => most likely case sensitivity difference, so update the url
            if ( $urlObject->attribute( 'url' ) !== $url )
            {
                $urlObject->setAttribute( 'url', $url );
                $urlObject->setAttribute( 'original_url_md5', md5( $url ) );
                $urlObject->setAttribute( 'modified', time() );
                $urlObject->store( array( 'url', 'original_url_md5', 'modified' ) );
            }

            $urlID = $urlObject->attribute( 'id' );
        }

        return $urlID;
    }
1024111
public static function setUrl($url) {

		if(false === is_string($url) && false === $url instanceof URLParser) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or instance of sFire\\Utils\\URLParser, "%s" given', __METHOD__, gettype($url)), E_USER_ERROR);
		}

		if(true === is_string($url)) {
			$url = new URLParser($url);
		}

		static :: $url = $url;
		return $url;
	}
86211
protected static function parseUrl($url)
    {
        $components = @parse_url($url);
        if (! empty($components)) {
            return $components;
        }

        if (is_null(static::$is_parse_url_bugged)) {
            static::$is_parse_url_bugged = ! is_array(@parse_url("//example.org:80"));
        }

        //bugfix for https://bugs.php.net/bug.php?id=68917
        if (static::$is_parse_url_bugged &&
            strpos($url, '/') === 0 &&
            is_array($components = @parse_url('http:'.$url))
        ) {
            unset($components['scheme']);
            return $components;
        }
        throw new RuntimeException(sprintf("The given URL: `%s` could not be parse", $url));
    }
780171
private function getId(Url $url)
        {
            if ($url->hasQueryParameter('story_fbid')) {
                $this->isEmbeddable = true;

                return $url->getQueryParameter('story_fbid');
            }

            if ($url->hasQueryParameter('fbid')) {
                return $url->getQueryParameter('fbid');
            }

            if ($url->hasQueryParameter('id')) {
                return $url->getQueryParameter('id');
            }

            if ($url->getDirectoryPosition(0) === 'events') {
                $this->isEmbeddable = true;

                return $url->getDirectoryPosition(1);
            }

            if ($url->getDirectoryPosition(0) === 'pages') {
                return $url->getDirectoryPosition(2);
            }

            if ($url->getDirectoryPosition(1) === 'posts') {
                $this->isEmbeddable = true;

                return $url->getDirectoryPosition(2);
            }

            if ($url->getDirectoryPosition(2) === 'posts') {
                $this->isEmbeddable = true;

                return $url->getDirectoryPosition(3);
            }

            return $url->getDirectoryPosition(0);
        }
131981
public static function getEquityLinkCount($url = false)
    {
        $data = static::getCols('2048', $url);
        return (parent::noDataDefaultValue() == $data) ? $data :
            $data['uid'];
    }
806175
public function registerUrl($url, $flush = false)
    {
        if ($flush) {
            $this->urls = [];
        }

        if (is_array($url)) {
            $this->log->debug('Registered urls', $url);
            $this->urls = array_merge($this->urls, $url);
        } else {
            $this->log->debug("Registered url -> $url");
            $this->urls[] = $url;
        }
    }
898229
public static function validate_url(String $url)
    {
        // https://mathiasbynens.be/demo/url-regex
        // @diegoperini (502 chars)
        $regex = '_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.1';
        $regex .= '68(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d';
        $regex .= '|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?';
        $regex .= ':[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,})))(?::\d{2,5})?(?:/[^\s]*)?$_iuS';

        if (preg_match($regex, $url))
            return true;

        return false;
    }
674495
public static function fixUri($url) {
        $url = preg_replace('#/+|\\\+#', '/', $url);

        if ($url[0] == '/') {
            $url = substr($url, 1, strlen($url));
        } if (substr($url, -1) == '/') {
            $url = substr($url, 0, strlen($url) - 1);
        }

        return $url;
    }
667776
private function http_get($url){
        $oCurl = curl_init();
        if(stripos($url,"https://")!==FALSE){
            curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);
            curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, FALSE);
            curl_setopt($oCurl, CURLOPT_SSLVERSION, 1); //CURL_SSLVERSION_TLSv1
        }
        curl_setopt($oCurl, CURLOPT_URL, $url);
        curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );
        $sContent = curl_exec($oCurl);
        $aStatus = curl_getinfo($oCurl);
        curl_close($oCurl);
        if(intval($aStatus["http_code"])==200){
            return $sContent;
        }else{
            return false;
        }
    }
1024168
private function checkNumberRedirects($url)
    {
        ++self::$nbRedirect;

        // keep initial url in case of endless redirect
        if ('' === self::$initialUrl) {
            self::$initialUrl = $url;
        }

        if (self::$nbRedirect > $this->config['max_redirect']) {
            $this->logger->warning('Endless redirect: ' . self::$nbRedirect . ' on "{url}"', ['url' => $url]);

            return false;
        }

        return true;
    }
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;
    }
1312558
public function parseUrl($url) {
		$url = parse_url($url);
		$url['vars'] = array();
		if (!isset($url['fragment'])) {
			$url['fragment'] = null;
		}
		if (isset($url['query'])) {
			parse_str($url['query'], $url['vars']);
		}

		return $url;
	}
32533
public static function get_url_id($url)
    {
        $service = self::identify_service($url);
        //TODO use a function for this, it is duplicated
        if ($service == self::YOUTUBE) {
            return self::get_youtube_id($url);
        } elseif ($service == self::VIMEO) {
            return self::get_vimeo_id($url);
        } elseif ($service == self::TWENTYTHREE) {
            return self::get_vimeo_id($url);
        }
        return null;
    }
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;
    }
1085159
public function verify($url)
    {
        $url = parse_url($url);
        if ($url === false) {
            throw new \Exception('Bad url to match (not an url ?)');
        }

        $path = isset($url['path']) ? $url['path'] : '';

        if ((bool) preg_match($this->pattern, $path, $matches)) {
            array_shift($matches);

            foreach ($matches as $position => $value) {
                $this->parameterCollection->getByPosition($position)
                    ->setValue($value);
            }

            return true;
        }

        return false;
    }
1286966
public function url_to_id($url){
    if ( $file = $this->url_to_real($url) ){
      return $this->real_to_id($file);
    }
    return false;
  }
790140
public static function getFromUrl($url)
    {
        // check is valid url
        if (!filter_var($url, FILTER_VALIDATE_URL) || !function_exists('curl_init')) {
            return null;
        }

        // initialize curl & set required options and target url
        $curl = \curl_init();
        \curl_setopt($curl, CURLOPT_URL, $url);
        if (Str::startsWith('https', $url)) {
            \curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
            \curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        }
        \curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        \curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
        \curl_setopt($curl, CURLOPT_HEADER, 0);
        \curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)');
        \curl_setopt($curl, CURLOPT_FAILONERROR, true);
        \curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
        \curl_setopt($curl, CURLOPT_AUTOREFERER, true);
        \curl_setopt($curl, CURLOPT_TIMEOUT, 10);
        $content = \curl_exec($curl);
        \curl_close($curl);

        return $content;
    }