diff options
Diffstat (limited to 'lib/favicons.php')
| -rw-r--r-- | lib/favicons.php | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/favicons.php b/lib/favicons.php index fd03f61c8..abaa5e63a 100644 --- a/lib/favicons.php +++ b/lib/favicons.php @@ -2,7 +2,7 @@ const FAVICONS_DIR = DATA_PATH . '/favicons/'; const DEFAULT_FAVICON = PUBLIC_PATH . '/themes/icons/default_favicon.ico'; -function isImgMime($content) { +function isImgMime(string $content): bool { //Based on https://github.com/ArthurHoaro/favicon/blob/3a4f93da9bb24915b21771eb7873a21bde26f5d1/src/Favicon/Favicon.php#L311-L319 if ($content == '') { return false; @@ -21,7 +21,8 @@ function isImgMime($content) { return $isImage; } -function downloadHttp(&$url, $curlOptions = array()) { +/** @param array<int,int|bool> $curlOptions */ +function downloadHttp(string &$url, array $curlOptions = []): string { syslog(LOG_INFO, 'FreshRSS Favicon GET ' . $url); $url = checkUrl($url); if (!$url) { @@ -49,7 +50,7 @@ function downloadHttp(&$url, $curlOptions = array()) { return $info['http_code'] == 200 ? $response : ''; } -function searchFavicon(&$url) { +function searchFavicon(string &$url): string { $dom = new DOMDocument(); $html = downloadHttp($url); if ($html != '' && @$dom->loadHTML($html, LIBXML_NONET | LIBXML_NOERROR | LIBXML_NOWARNING)) { @@ -84,7 +85,7 @@ function searchFavicon(&$url) { return ''; } -function download_favicon($url, $dest) { +function download_favicon(string $url, string $dest): bool { $url = trim($url); $favicon = searchFavicon($url); if ($favicon == '') { |
