summaryrefslogtreecommitdiffstats
path: root/utility
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-14 00:30:01 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-14 00:30:01 +0200
commitb4818a403ac7890dd5436d505f9a4e6135cbe8e4 (patch)
tree24294ec96e6b2c7ecf5fe0738db300c2464e9f28 /utility
parent36dc56717ab1a32a73377dad9875ce82ddf59f32 (diff)
also check https for favicons
Diffstat (limited to 'utility')
-rw-r--r--utility/feedfetcher.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/utility/feedfetcher.php b/utility/feedfetcher.php
index d07b5f0f9..4b91865f5 100644
--- a/utility/feedfetcher.php
+++ b/utility/feedfetcher.php
@@ -158,15 +158,8 @@ class FeedFetcher implements IFeedFetcher {
private function discoverFavicon($url) {
- // try the /favicon.ico
$url = rtrim($url, '/');
- $baseFavicon = $url . '/favicon.ico';
- if($this->isValidFavIcon($baseFavicon)){
- return $baseFavicon;
- }
-
-
//try to extract favicon from web page
$page = $this->api->getUrlContent($url);
@@ -186,12 +179,14 @@ class FeedFetcher implements IFeedFetcher {
// if it does not start with http, add it
if (strpos($favicon, 'http') !== 0){
$favicon = 'http://' . $favicon;
- }
+ $httpsFavicon = 'https://' . $favicon;
+ }
// if its already valid, return it
if ($this->isValidFavIcon($favicon)){
return $favicon;
-
+ } elseif ($this->isValidFavIcon($httpsFavicon)){
+ return $httpsFavicon;
// assume its a realtive path or absolute path
} else {
// add slash to make it absolute
@@ -206,6 +201,14 @@ class FeedFetcher implements IFeedFetcher {
}
}
}
+
+ // try the /favicon.ico as a last resort
+ $parseUrl = parse_url($url);
+ $baseFavicon = $parseUrl['scheme'] . '://' . $parseUrl['host'] . '/favicon.ico';
+ if($this->isValidFavIcon($baseFavicon)){
+ return $baseFavicon;
+ }
+
return null;
}
} \ No newline at end of file