2018-11-21 12:40:34 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2021-06-08 07:59:39 +00:00
|
|
|
* Get an associative array with localeCodes as keys and translated URLs of current page as value
|
|
|
|
*/
|
2018-11-21 12:40:34 +00:00
|
|
|
function getLocalizedURLArray()
|
|
|
|
{
|
|
|
|
$localesOrdered = LaravelLocalization::getLocalesOrder();
|
|
|
|
$localizedURLs = array();
|
|
|
|
foreach ($localesOrdered as $localeCode => $properties) {
|
|
|
|
$localizedURLs[$localeCode] = LaravelLocalization::getLocalizedURL($localeCode, null, [], true);
|
|
|
|
}
|
|
|
|
return $localizedURLs;
|
|
|
|
}
|
2021-06-08 07:59:39 +00:00
|
|
|
|
|
|
|
function get_domain($host)
|
|
|
|
{
|
|
|
|
$myhost = strtolower(trim($host));
|
|
|
|
$count = substr_count($myhost, '.');
|
|
|
|
if ($count === 2) {
|
|
|
|
if (strlen(explode('.', $myhost)[1]) > 3) {
|
|
|
|
$myhost = explode('.', $myhost, 2)[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if ($count > 2) {
|
|
|
|
$myhost = get_domain(explode('.', $myhost, 2)[1]);
|
|
|
|
}
|
2021-06-15 19:52:52 +00:00
|
|
|
$myhost = preg_replace( "#^[^:/.]*[:/]+#i", "", $myhost);
|
2021-06-08 07:59:39 +00:00
|
|
|
return $myhost;
|
|
|
|
}
|