mirror of
https://github.com/LinkStackOrg/LinkStack.git
synced 2025-02-07 23:58:57 +01:00
Improved favicon API
This commit is contained in:
parent
63d53752b9
commit
699ed0ae4a
@ -2412,8 +2412,21 @@ if(!function_exists('get_headers'))
|
||||
}
|
||||
|
||||
$headers = get_headers($urlICO, 1);
|
||||
$headersImage = get_headers($urlICO);
|
||||
|
||||
if ($headers[0] == 'HTTP/1.1 200 OK' or $headers[0] == 'HTTP/1.1 301 Moved Permanently') {
|
||||
foreach ($headersImage as $header) {
|
||||
if (stripos($header, 'Content-Type:') === 0) {
|
||||
if (stripos($header, 'image/') !== false) {
|
||||
$isIco = true;
|
||||
} else {
|
||||
$isIco = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($headers[0] == 'HTTP/1.1 200 OK' or $headers[0] == 'HTTP/1.1 301 Moved Permanently') and $isIco === true) {
|
||||
$favicon = $urlICO;
|
||||
} else {
|
||||
|
||||
@ -2445,6 +2458,8 @@ if(!file_exists(base_path("studio/favicon/icons")."/".$id.".".$extension)){
|
||||
}
|
||||
} catch (exception $e) {}
|
||||
|
||||
$favicon = preg_replace('/([^:])(\/{2,})/', '$1/', $favicon);
|
||||
|
||||
return $favicon;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user