Returns the list of websites ID associated with a URL.

@param array $urls
@return array list of websites ID
500697
public function getAllSitesIdFromSiteUrl(array $urls)
    {
        $siteUrlTable = Common::prefixTable('site_url');

        $db = $this->getDb();
        $ids = $db->fetchAll(
            'SELECT idsite FROM ' . $this->table . '
                    WHERE main_url IN ( ' . Common::getSqlStringFieldsArray($urls) . ') ' .
            'UNION
                SELECT idsite FROM ' . $siteUrlTable . '
                    WHERE url IN ( ' . Common::getSqlStringFieldsArray($urls) . ') ',

            // Bind
            array_merge( $urls, $urls)
        );

        return $ids;
    }
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);
        }
1273418
protected function getCustomUrl(array $urlParameters = array())
    {
        $urlParameters = $this->addRequestVariablesToUrlParameters($urlParameters);

        if ($this->customUrl && count($urlParameters) > 0)
        {
            $params = http_build_query($urlParameters);

            if ('' != parse_url($this->customUrl, PHP_URL_QUERY))
            {
                // existing query string, append
                return $this->customUrl.'&'.$params;
            }

            return $this->customUrl.'?'.$params;
        }

        return $this->customUrl;
    }
219090
public function several(array $ids)
    {
        $results = [];
        foreach ($this->getEntry($ids) as $cacheId=>$entry) {
            if (!$this->isExpired($entry)) {
                $results[$cacheId] =  $this->getPayload($cacheId, $entry);
            }
        }

        return $results;
    }
769916
protected static function getSiteIdFromUrl($url, array $hosts)
	{
		$host = (preg_match('(^https?://([^/]+))', strtolower($url), $m)) ? $m[1] : '';
		while ($host > '')
		{
			if (isset($hosts[$host]))
			{
				return $hosts[$host];
			}
			$host = preg_replace('(^[^.]*.)', '', $host);
		}

		return '';
	}
617680
protected function getIdsFromHashes(array $hashes)
    {
        $ids = [];

        foreach ($hashes as $hash) {
            $split = explode('.', $hash);
            $ids[] = $split[1];
        }

        return $ids;
    }
686555
private function getItemById(array $ids)
    {
        $ids = array_map('intval', $ids);

        try {
            $stmtResult = $this->neo4jClient->run('MATCH (n) WHERE ID(n) IN {ids} RETURN n', ['ids' => $ids]);
        } catch (\Exception $e) {
            return [];
        }

        $result = [];

        if (!$stmtResult->size()) {
            return $result;
        }

        foreach ($stmtResult->records() as $record) {
            $result[] = $record->get('n');
        }

        return $result;
    }
687207
private function getInstancesList(array $ids)
    {
        $statuses = $instances = $classes = [];

        foreach ($ids as $key => $instance) {
            $instance = $this->getResource($instance);
            if ($instance->isClass()) {
                $instance = $this->getClass($instance);
                $classes[] = $instance;
            } elseif (!$instance->exists()) {
                $statuses[$instance->getUri()] = [
                    'success' => false,
                    'message' => sprintf('Instance "%s" does not exist', $instance->getUri()),
                ];
                break;
            }
            $instances[$key] = $instance;
        }

        return [
            $statuses,
            $instances,
            $classes
        ];
    }
950991
public function lookup($url)
  {
    $result = array();
    // get url's to check
    $canon_url = GoogleSafeBrowsing_Lookup_URL::googleCanonicalize($url);
    if(is_null($canon_url)){
      // unable to canonicalize, nothing we can do
      $this->debugLog('lookup('.$url.'): cannot canonicalize url, skipping');
      return $result;
    }
    $lookup_urls = GoogleSafeBrowsing_Lookup_URL::googleGetLookupExpressions($canon_url);
    
    $lookup_hashes = array();
    foreach($lookup_urls as $lookup_url){
      $lookup_hashes[]=GoogleSafeBrowsing_Lookup_URL::hash($lookup_url);
      //$this->debugLog(bin2hex($lookup_hashes[count($lookup_hashes)-1])." $lookup_url");
    }
    
    $found_hashes=$this->storage->hasPrefix($lookup_hashes);
    
    $matched_lists=array();
    // full hash lookups
    foreach($found_hashes as $found_hash){
      $this->debugLog('lookup('.$url.'): found hash prefix for '.bin2hex($found_hash));
      $lookup_result=$this->storage->isListedInCache($found_hash);
      if(is_null($lookup_result)){
        $lookup_result=array();
        // not cached, query google
        $collection=$this->api->getHash(substr($found_hash,0,4),$this->storage->getLists());
        if(count($collection->list_hashes)==0){
          // no hashes found, can happen, so insert dummy record for this prefix
          // so we can use the cached result (empty)
          $this->storage->addHashInCache($found_hash,$lookup_result,null,(int)$collection->cache);
        }else{
          // full length hashes found
          foreach($collection->list_hashes as $list_hash){
            $this->debugLog('lookup('.$url.'): remote lookup found full length hashes in list '.$list_hash->list_name);
            foreach($list_hash->hashes as $hash){
              $this->debugLog('lookup('.$url.'):   hash '.bin2hex($hash->hash));
              // cache in db
              $cache_seconds=(int)$collection->cache;
              if(isset($hash->cache) && $hash->cache){
                $cache_seconds=(int)$hash->cache;
              }
              $this->storage->addHashInCache($hash->hash,array($list_hash->list_name),$hash->raw_meta,$cache_seconds);
              if($hash->hash==$found_hash){
                // full length hash match
                if(!in_array($list_hash->list_name, $lookup_result)){
                  $lookup_result[]=$list_hash->list_name;
                }
              }
            }
          }
        }
      }// end cached if/else
      // $lookup_result is array of listnames (can be empty if not listed)
      foreach($lookup_result as $matched_list){
        $matched_lists[$matched_list]=true;
      }
    }
    if(count($matched_lists)>0){
      $this->debugLog('lookup('.$url.'): listed in '.implode(', ',array_keys($matched_lists)));
    }
    return array_keys($matched_lists);
  }
742270
public function getAliasSiteUrlsFromId($idSite)
    {
        $db     = $this->getDb();
        $result = $db->fetchAll("SELECT url FROM " . Common::prefixTable("site_url") . "
                                 WHERE idsite = ?", $idSite);

        $urls = array();
        foreach ($result as $url) {
            $urls[] = $url['url'];
        }

        return $urls;
    }
545860
public static function getParamsAsArray($url)
    {
        $query = parse_url($url, PHP_URL_QUERY);
        if (!$query) {
            return [];
        }
        $params = [];
        parse_str($query, $params);

        return $params;
    }
503517
public function purgeUrls(array $urls)
    {
        // prefix urls
        $zoneUrls = array_map(function ($url) {
            return $this->zoneUrl . $url;
        }, $urls);

        return $this->sendRequest('DELETE', 'purgeurl', [
                'urls' => $zoneUrls
            ]
        );
    }
904356
protected function getOptionLinks(array $urls)
    {
        $html = '';

        foreach ($urls as $page => $url) {
            $html .= $this->getOption($url, $page);
        }

        return $html;
    }
909048
protected function setUrls (array $urls)
	{
		foreach ($urls as $key => $value) $this->urls[$key] = $value;
	}
1014683
static function combine_query($urls)
    {
        $url = array();
        foreach ($urls as $k => $v)
        {
            if (!empty($k))
            {
                $url[] = $k . self::$url_key_join . urlencode($v);
            }
        }
        return implode(self::$url_param_join, $url);
    }
109561
protected function parseQueryParams($url)
    {
        $queries = [];

        $querySegment = \parse_url($url, PHP_URL_QUERY);
        \parse_str($querySegment, $queries);

        return $queries;
    }
171439
public static function getId($url)
    {
        if (strpos($url, 'youtube.com') !== false) {
            $url = parse_url($url);

            if (empty($url['query'])) {
                return false;
            }

            parse_str($url['query'], $url);

            return empty($url['v']) ? false : $url['v'];
        }

        if (preg_match('/youtu\.be\/([^?]+)/', $url, $matches)) {
            return $matches[1];
        }

        return false;
    }