1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00
This commit is contained in:
Daniel Neto 2024-10-18 15:46:34 -03:00
parent 22f7217ed6
commit bf6d700807

View file

@ -30,13 +30,17 @@ foreach ($referrers as $key => $value) {
// Parse the URL to get the host (domain) // Parse the URL to get the host (domain)
$parsedUrl = parse_url($value['external_referrer'], PHP_URL_HOST); $parsedUrl = parse_url($value['external_referrer'], PHP_URL_HOST);
if ($parsedUrl) { if ($parsedUrl) {
$referrersTypes[] = $parsedUrl; // Remove 'www.' prefix if it exists
$domain = preg_replace('/^www\./', '', $parsedUrl);
$referrersTypes[] = $domain;
} }
} }
} }
// Make sure the $referrersTypes is unique // Make sure the $referrersTypes is unique and sorted alphabetically
$referrersTypes = array_unique($referrersTypes); $referrersTypes = array_unique($referrersTypes);
sort($referrersTypes);
?> ?>