Retrieves the title of the embed url
@param - $url: the url of the "player"
@return - string
@todo - do some real world testing.
7011
public function getTitle($url) {
        return Template::raw(VideoEmbedder::$plugin->service->getInfo($url)->title);
    }
1240881
public static function linkUrl($url, $title = null, $attributes = array())
    {
        $title = ($title) ? $title : $url;
        $compiled = '';
        if (count($attributes)) {
            $compiled = '';
            foreach ($attributes as $key => $val) {
                $compiled .= ' ' . $key . '="' .  htmlspecialchars((string) $val, ENT_QUOTES, "UTF-8", true) . '"';
            }
        }
        return '<a href="'.$url.'"'.$compiled.'>'.$title.'</a>';
    }
945975
private static function get_filename_from_url( $url ) {
		$url_parts   = explode( '/', $url );
		$parts_count = count( $url_parts );
		if ( 1 < $parts_count ) {
			return $url_parts[ count( $url_parts ) - 1 ];
		}
		return $url;
	}
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;
    }
1039619
public function getPathFromUrl($url)
    {
        $basename = $this->storageUrl ? basename($this->storageUrl) : basename($this->storageDir);
        $basename && $url = preg_replace("/(.*$basename\/)/", '', $url);
        return $url;
    }
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;
    }
87464
public function embedCodeFor(string $url)
    {
        if (!$parsedUrl = $this->embedder->parseUrl($url)) {
            return null;
        }

        return $parsedUrl->getEmbedCode();
    }
984726
public function getName()
    {
        if ($this->getEmbed()->title) {
            return $this->getEmbed()->title;
        }

        return preg_replace('/\?.*/', '', basename($this->getEmbed()->getUrl()));
    }
700467
public static function getRobotsTxtURL($url)
  {
    $url_parts = PHPCrawlerUtils::splitURL($url); 
    $robots_txt_url = $url_parts["protocol"].$url_parts["host"].":".$url_parts["port"] . "/robots.txt";
    
    return $robots_txt_url;
  }
848710
public static function getHostFromUrl($url)
    {
        $parsedUrl = parse_url($url);

        if (empty($parsedUrl['host'])) {
            return;
        }

        return Common::mb_strtolower($parsedUrl['host']);
    }
490727
public function getProviderName($url) {
        return Template::raw(VideoEmbedder::$plugin->service->getInfo($url)->providerName);
    }
915711
public static function getHostname($url)
    {
        if (!isset(self::$cache[$url]['hostname'])) {
            self::$cache[$url]['hostname'] = self::parseUrl($url, PHP_URL_HOST);
        }

        return self::$cache[$url]['hostname'];
    }
974233
public function getTitle($bForceLocal = false)
        {
            if (true === $this->isReady) {
                if (true === $bForceLocal) {
                    $sMatch = IMDBHelper::matchRegex($this->sSource, self::IMDB_TITLE_ORIG, 1);

                    if (false !== $sMatch && "" !== $sMatch) {
                        return IMDBHelper::cleanString($sMatch);
                    }
                }

                $sMatch = IMDBHelper::matchRegex($this->sSource, self::IMDB_TITLE, 1);
                $sMatch = preg_replace('~\(\d{4}\)$~Ui', '', $sMatch);

                if (false !== $sMatch && "" !== $sMatch) {
                    return IMDBHelper::cleanString($sMatch);
                }
            }

            return $this->sNotFound;
        }
596959
protected function getProtocolLength($url)
    {
        if (substr_compare($url, 'http://', 0, 7, true) === 0) {
            return 7;
        }
        if (substr_compare($url, 'https://', 0, 8, true) === 0) {
            return 8;
        }
        if (substr_compare($url, '//', 0, 2, false) === 0) {
            return 2;
        }

        return null;
    }
1178629
protected function getPackageNameByRepositoryUrl($url)
    {
        $package = trim(basename($url, '.git'));
        $vendor = trim(basename(dirname($url), '.git'));

        return strtolower($vendor.'/'.$package);
    }
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;
  }
600115
protected function getUrlContent($url)
    {
        $contents = '';
        $time = (int) self::MAX_TIMEOUT_MINS * 60;

        $timeout = stream_context_create(array(
            'http' => array(
                'timeout' => $time,
            ),
        ));
        set_time_limit($time);
        ini_set('max_execution_time', $time);

        // check if the URL is valid
        if($this->isValidUrl($url)) {
            // make sure we are not getting 404 when accessing the page
            if( (int) $this->getUrlStatus($url) != self::HTTP_NOT_OK ) {
                // ge the contents of the page
                $contents = @file_get_contents($url, false, $timeout);

                // if the contents has results
                if($contents === true) {
                    // convert encodings
                    $contents = mb_convert_encoding($contents, 'HTML-ENTITIES', self::ENCODING);
                }
            }
        }



        return $contents;
    }