2020-10-08 16:38:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
if (!function_exists('host_url')) {
|
|
|
|
/**
|
|
|
|
* Return the host URL to use in views
|
|
|
|
*
|
|
|
|
* @return string|false
|
|
|
|
*/
|
|
|
|
function host_url()
|
|
|
|
{
|
2020-10-19 16:47:22 +00:00
|
|
|
if (isset($_SERVER['HTTP_HOST'])) {
|
2020-10-08 16:38:30 +00:00
|
|
|
$protocol =
|
|
|
|
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ||
|
|
|
|
$_SERVER['SERVER_PORT'] == 443
|
|
|
|
? 'https://'
|
|
|
|
: 'http://';
|
2020-10-19 16:47:22 +00:00
|
|
|
return $protocol . $_SERVER['HTTP_HOST'] . '/';
|
2020-10-08 16:38:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2020-11-04 17:03:20 +00:00
|
|
|
|
|
|
|
if (!function_exists('current_season_url')) {
|
|
|
|
/**
|
|
|
|
* Return the podcast URL with season number to use in views
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function current_season_url()
|
|
|
|
{
|
|
|
|
$season_query_string = '';
|
|
|
|
if (isset($_GET['season'])) {
|
|
|
|
$season_query_string = '?season=' . $_GET['season'];
|
|
|
|
} elseif (isset($_GET['year'])) {
|
|
|
|
$season_query_string = '?year=' . $_GET['year'];
|
|
|
|
}
|
|
|
|
return current_url() . $season_query_string;
|
|
|
|
}
|
|
|
|
}
|