diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-10-08 15:24:19 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-10-08 15:24:19 +0200 |
commit | 483d2551eaea6ffc3f7e13c8ea9c3ea215fadff0 (patch) | |
tree | dbc064b807becd290f772d383789beb24b943701 /utility | |
parent | 331b832fc0f48015ee49743352f654fcceea781b (diff) |
get rid of simplepie absolute url function and use Net url2
Diffstat (limited to 'utility')
-rw-r--r-- | utility/faviconfetcher.php | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/utility/faviconfetcher.php b/utility/faviconfetcher.php index 8a285a47b..850a7f576 100644 --- a/utility/faviconfetcher.php +++ b/utility/faviconfetcher.php @@ -49,25 +49,8 @@ class FaviconFetcher { if($faviconUrl && $this->isImage($faviconUrl)) { return $faviconUrl; } elseif ($url) { - // try /favicon.ico as fallback - $parts = parse_url($url); - - // malformed url - if ($parts === false || !array_key_exists('host', $parts)) { - return null; - } - - $port = ''; - if (array_key_exists("port", $parts)) { - $port = $parts['port']; - } - - $scheme = 'http'; - if (array_key_exists("scheme", $parts)) { - $scheme = $parts['scheme']; - } - - $faviconUrl = $scheme . "://" . $parts['host'] . $port . "/favicon.ico"; + $base = new \Net_URL2($url); + $faviconUrl = (string) $base->resolve('/favicon.ico'); if($this->isImage($faviconUrl)) { return $faviconUrl; @@ -117,7 +100,8 @@ class FaviconFetcher { if ($elements->length > 0) { /** @noinspection PhpUndefinedMethodInspection */ $iconPath = $this->getAttribute($elements->item(0), 'href'); - $absPath = \SimplePie_Misc::absolutize_url($iconPath, $url); + $base = new \Net_URL2($url); + $absPath = (string) $base->resolve($iconPath, $url); return $absPath; } } @@ -178,9 +162,3 @@ class FaviconFetcher { } } - -/** - * Thrown when no valid url was found by faviconfetcher - */ -class NoValidUrlException extends \Exception { -} |