Fetches tag identified with provided URL

@static

@param string $url
@param mixed $language

@return array
186802
static public function fetchTagByUrl( $url, $language = false )
    {
        if ( $language )
        {
            if ( !is_array( $language ) )
                $language = array( $language );
            eZContentLanguage::setPrioritizedLanguages( $language );
        }

        $result = eZTagsObject::fetchByUrl( $url );

        if ( $language )
            eZContentLanguage::clearPrioritizedLanguages();

        if ( $result instanceof eZTagsObject )
            return array( 'result' => $result );

        return array( 'result' => false );
    }
658743
function ParseUrl($url) {
	    $content = null;

    	$this->Clear();

		$this->url = htmlspecialchars_decode($url);

	    ob_start();
	    if (function_exists('curl_init')) {
		    //curl is the preferred function
		    $crl = curl_init();
		    curl_setopt($crl, CURLOPT_URL, $url);
		    curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
		    curl_setopt($crl, CURLOPT_CONNECTTIMEOUT, 5);
		    curl_setopt($crl, CURLOPT_TIMEOUT, 20);
		    $FileData = curl_exec($crl);
		    $FileInfo = curl_getinfo($crl);
		    curl_close($crl);
		    if ($FileInfo['http_code'] != 200) {
			    throw new \HttpRequestException($FileInfo['http_code'] . ' error for file: ' . $url);
		    }
	    } else {
		    //see if we can use fopen to get file
		    $fopen_check = ini_get('allow_url_fopen');
		    if (!empty($fopen_check)) {
			    $content = file_get_contents($url);
		    } else {
			    throw new \RuntimeException('CURL_DISABLED');
		    }
	    }
	    ob_end_clean();

		if(strlen($content)) {
			$this->modifyContent($content);
			$this->ParseStr($content);
			return true;
		} else {
			return false;
		}
	}
1062446
public static function getDeliciousTopTags($url = false)
    {
        $url     = parent::getUrl($url);
        $dataUrl = sprintf(Config\Services::DELICIOUS_INFO_URL, urlencode($url));

        $jsonData = parent::_getPage($dataUrl);
        $phpArray = Helper\Json::decode($jsonData, true);

        $ret = array();
        if (isset($phpArray[0]['top_tags']) && 0 < sizeof($phpArray[0]['top_tags'])) {
            foreach($phpArray[0]['top_tags'] as $k => $v) {
                $ret[] = $k;
            }
        }
        return $ret;
    }
172427
public static function getLanguageURL($language) {

        // Initialize the directory.
        $dir = ObjectHelper::getDirectory(JQueryDataTablesBundle::class);
        $dir .= "/Resources/public/datatables-i18n/%language%.json";

        // Initialize the URI.
        $uri = "/bundles/jquerydatatables/datatables-i18n/%language%.json";

        // Initialize the URL.
        $url = StringHelper::replace($uri, ["%language%"], [$language]);

        // Initialize and check the filename.
        $file = StringHelper::replace($dir, ["%language%"], [$language]);
        if (false === file_exists($file)) {
            throw new FileNotFoundException(null, 500, null, $url);
        }

        return $url;
    }
12984
public function getLocalBack($language)
    {
        $backUrl = redirect()->back()->getTargetUrl();
        $current = $this->getCurrentLanguage();
        $start = strpos($backUrl, $current);
        $count = strlen($current);
        if ($backUrl[$start - 1] == '/' && (!isset($backUrl[$start + $count])) || $backUrl[$start + $count] == '/') {
            $backUrl = substr_replace($backUrl, $language, $start, $count);
        }
        return $backUrl;
    }
660341
public static function googleTranslator(Url $url)
    {
        if (($value = $url->getQueryParameter('u'))) {
            return Url::create($value);
        }

        return $url;
    }
199724
static public function httpGet($url)
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($curl, CURLOPT_SSLVERSION, 1);
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_TIMEOUT, 30);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        list($content, $status) = array(curl_exec($curl), curl_getinfo($curl), curl_close($curl));
        return (intval($status["http_code"]) === 200) ? $content : false;
    }
265747
public function find($url)
    {
        $catalogue = $this->getCatalogue();

        if ($catalogue instanceof ComActivitiesActivityTranslatorCatalogueInterface)
        {
            // Locate files using fallback locale
            $locale  = $this->getLocaleFallback();
            $locator = $this->getObject('translator.locator.factory')->createLocator($url);
            $result  = $locator->setLocale($locale)->locate($url, $locale);
        }
        else $result = $this->getDelegate()->find($url);

        return $result;
    }
1225844
static public function fetchByUrl( $url, $mainTranslation = false )
    {
        $urlArray = is_array( $url ) ? $url : explode( '/', ltrim( $url, '/' ) );
        if ( !is_array( $urlArray ) || empty( $urlArray ) )
            return null;

        $parentID = 0;
        for ( $i = 0; $i < count( $urlArray ) - 1; $i++ )
        {
            /** @var eZTagsObject[] $tags */
            $tags = self::fetchList(
                array(
                    'parent_id' => $parentID,
                    'main_tag_id' => 0,
                    'keyword' => urldecode( trim( $urlArray[$i] ) )
                ),
                null,
                null,
                $mainTranslation
            );

            if ( !is_array( $tags ) || empty( $tags ) )
                return null;

            $parentID = $tags[0]->attribute( 'id' );
        }

        $tags = self::fetchList(
            array(
                'parent_id' => $parentID,
                'keyword' => urldecode( trim( $urlArray[count( $urlArray ) - 1] ) )
            ),
            null,
            null,
            $mainTranslation
        );

        if ( !is_array( $tags ) || empty( $tags ) )
            return null;

        return $tags[0];
    }
1149048
public function getContent($url)
    {
        $cache = $this->getCache($url);
        if ($cache->isCached('content')) {
            $content = $cache->retrieve('content');
        } else {
            $content = $this->downloader->getContent($url);
            foreach ($this->getStrippedHtmlTags() as $strippedHtmlTag) {
                $content = preg_replace("/<{$strippedHtmlTag}.*?>.*?<\/{$strippedHtmlTag}>/is", "", $content);
            }
            $cache->store('content', $content);
        }
        return $content;
    }
247663
static protected function fetchData(string $url): array {
        $url  .= '.json?key=' . urlencode(RC::get('redmineApiKey'));
        $data = file_get_contents($url);
        if ($data) {
            $data = (array) json_decode($data);
            $data = array_pop($data);
            return (array) $data;
        }
        throw new RuntimeException('Fetching data failed');
    }
418719
public function predictUrl($url, $modelType, $language = null)
    {
        return $this->predict(['url' => $url], $modelType, $language);
    }
736654
protected static function getUrl($url)
    {
        Craft::debug('Fetching JSON from: '.$url, __METHOD__);

        $ch = curl_init();
        curl_setopt_array(
            $ch,
            [
                CURLOPT_URL => $url,
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_FOLLOWLOCATION => true,
                CURLOPT_MAXREDIRS => 5,
                CURLOPT_CONNECTTIMEOUT => 5,
            ]
        );
        $data = curl_exec($ch);

        $errorNumber = curl_errno($ch);
        $errorMessage = curl_error($ch);
        curl_close($ch);

        if ($errorNumber > 0) {
            Craft::warning('cURL got an error: '.$errorNumber.', '.$errorMessage, __METHOD__);
            return false;
        }

        return $data;
    }
1316773
private function _get($url)
    {
        curl_setopt($this->_curlHandle, CURLOPT_HTTPGET, true);
        curl_setopt($this->_curlHandle, CURLOPT_CUSTOMREQUEST, 'GET');
        return $this->_curlHelper($url);
    }
424047
public static function getSubDomain($url)
    {
        $urlInfo = static::info($url);

        return ArrayHelper::get($urlInfo, 'sub', null, true);
    }
1273167
public function get($language)
    {
        $result = array();
        if (isset($this->{$language})) {
            $result = $this->{$language};
        }
        if ($language !== 'nl' && isset($this->nl)) {
            $result += $this->nl;
        }
        return $result;
    }
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;
	}