castopod/app/Helpers/url_helper.php
Yassine Doghri 769ea469c9 refactor: update install logic and add missing cache config step
- add `.env.example` and `INSTALL.md` to castopod bundle for installation docs
- update seeders to be silent on insert errors
- update install layout
- add manual config instructions when .env file is not writable
- fix eslint error in Charts.ts module

closes #32
2020-10-15 14:42:13 +00:00

23 lines
511 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['host'])) {
$protocol =
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ||
$_SERVER['SERVER_PORT'] == 443
? 'https://'
: 'http://';
return $protocol + $_SERVER['host'];
}
return false;
}
}