mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-23 01:01:20 +00:00
23 lines
527 B
PHP
23 lines
527 B
PHP
<?php
|
|
|
|
if (!function_exists('host_url')) {
|
|
/**
|
|
* Return the host URL to use in views
|
|
*
|
|
* @return string|false
|
|
*/
|
|
function host_url()
|
|
{
|
|
if (isset($_SERVER['HTTP_HOST'])) {
|
|
$protocol =
|
|
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ||
|
|
$_SERVER['SERVER_PORT'] == 443
|
|
? 'https://'
|
|
: 'http://';
|
|
return $protocol . $_SERVER['HTTP_HOST'] . '/';
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|