mirror of
https://github.com/LinkStackOrg/LinkStack.git
synced 2025-04-29 17:38:50 +02:00
Update favicon.blade.php
This commit is contained in:
parent
3609d1477a
commit
e201b4cbb1
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
use App\Models\Link;
|
use App\Models\Link;
|
||||||
|
|
||||||
|
if (!function_exists('getFaviconURL')) {
|
||||||
function getFaviconURL($url)
|
function getFaviconURL($url)
|
||||||
{
|
{
|
||||||
$ch = curl_init($url);
|
$ch = curl_init($url);
|
||||||
@ -61,7 +62,9 @@ function getFaviconURL($url)
|
|||||||
}
|
}
|
||||||
return $faviconURL;
|
return $faviconURL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('getRedirectUrlFromHeaders')) {
|
||||||
function getRedirectUrlFromHeaders($headers)
|
function getRedirectUrlFromHeaders($headers)
|
||||||
{
|
{
|
||||||
if (preg_match('/^Location:\s+(.*)$/mi', $headers, $matches)) {
|
if (preg_match('/^Location:\s+(.*)$/mi', $headers, $matches)) {
|
||||||
@ -69,7 +72,9 @@ function getRedirectUrlFromHeaders($headers)
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('extractFaviconUrlFromDOM')) {
|
||||||
function extractFaviconUrlFromDOM($dom)
|
function extractFaviconUrlFromDOM($dom)
|
||||||
{
|
{
|
||||||
$xpath = new DOMXPath($dom);
|
$xpath = new DOMXPath($dom);
|
||||||
@ -90,13 +95,17 @@ function extractFaviconUrlFromDOM($dom)
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('checkURLExists')) {
|
||||||
function checkURLExists($url)
|
function checkURLExists($url)
|
||||||
{
|
{
|
||||||
$headers = @get_headers($url);
|
$headers = @get_headers($url);
|
||||||
return ($headers && strpos($headers[0], '200') !== false);
|
return ($headers && strpos($headers[0], '200') !== false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('extractFaviconUrlWithRegex')) {
|
||||||
function extractFaviconUrlWithRegex($html)
|
function extractFaviconUrlWithRegex($html)
|
||||||
{
|
{
|
||||||
// Check for the historical rel="shortcut icon"
|
// Check for the historical rel="shortcut icon"
|
||||||
@ -113,7 +122,9 @@ function extractFaviconUrlWithRegex($html)
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('getAbsoluteUrl')) {
|
||||||
function getAbsoluteUrl($baseUrl, $relativeUrl)
|
function getAbsoluteUrl($baseUrl, $relativeUrl)
|
||||||
{
|
{
|
||||||
$parsedUrl = parse_url($baseUrl);
|
$parsedUrl = parse_url($baseUrl);
|
||||||
@ -130,7 +141,9 @@ function getAbsoluteUrl($baseUrl, $relativeUrl)
|
|||||||
return "$basePath/$relativeUrl"; // Path-relative URL
|
return "$basePath/$relativeUrl"; // Path-relative URL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('getFavIcon')) {
|
||||||
function getFavIcon($id)
|
function getFavIcon($id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -170,4 +183,4 @@ function getFavIcon($id)
|
|||||||
return url('assets/favicon/icons/' . $filename);
|
return url('assets/favicon/icons/' . $filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user