miniflux-legacy/app/helpers/favicon.php

30 lines
631 B
PHP
Raw Normal View History

2016-08-18 04:16:13 +02:00
<?php
2016-08-25 03:17:58 +02:00
namespace Miniflux\Helper;
2016-08-18 04:16:13 +02:00
function favicon_extension($type)
{
$types = array(
'image/png' => '.png',
'image/gif' => '.gif',
'image/x-icon' => '.ico',
'image/jpeg' => '.jpg',
'image/jpg' => '.jpg'
);
if (array_key_exists($type, $types)) {
return $types[$type];
} else {
return '.ico';
}
}
function favicon(array $favicons, $feed_id)
{
if (! empty($favicons[$feed_id])) {
return '<img src="'.FAVICON_URL_PATH.'/'.$favicons[$feed_id]['hash'].favicon_extension($favicons[$feed_id]['type']).'" class="favicon">';
2016-08-18 04:16:13 +02:00
}
return '';
}