зеркало из https://github.com/nextcloud/news.git
Improve favicon detection
This commit is contained in:
Родитель
5ab51aa176
Коммит
81e6a72a20
|
@ -44,11 +44,16 @@ class OC_News_Utils {
|
||||||
|
|
||||||
$favicon = $spfeed->get_image_url();
|
$favicon = $spfeed->get_image_url();
|
||||||
//check if this file exists and the size with getimagesize()
|
//check if this file exists and the size with getimagesize()
|
||||||
|
|
||||||
if ($favicon == null) {
|
if ($favicon == null) {
|
||||||
//handle favicon detection
|
//handle favicon detection
|
||||||
|
$favicon = SimplePie_Misc::absolutize_url('/favicon.ico', $url);
|
||||||
|
|
||||||
|
// FIXME check if file exists and is valid
|
||||||
|
if (false === file_get_contents($favicon, 0, null, 0, 1))
|
||||||
|
$favicon = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$feed->setFavicon($favicon);
|
$feed->setFavicon($favicon);
|
||||||
|
|
||||||
return $feed;
|
return $feed;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче