function is_https()
{
return isset($_SERVER["HTTPS"]) && !empty($_SERVER["HTTPS"]) && strtolower(getenv("HTTPS")) != "off";
}
function get_host($strict_mode = false)
{
if($strict_mode === true)
{
if(self::str_contains(getenv("HTTP_HOST"), ":"))
{
$host = explode(":", getenv("HTTP_HOST"));
$host = array_reverse($host);
return end($host);
}
else
{
return getenv("HTTP_HOST");
}
}
else
{
return getenv("HTTP_HOST");
}
}
function get_current_url($host_strict_mode = false)
{
$url = is_ssl() ? "https://" : "http://";
$url .= get_host($host_strict_mode);
if(getenv("SERVER_PORT") != 80)
{
$url .= ":" . getenv("SERVER_PORT");
}
if(!isset($_SERVER["REQUEST_URI"]))
{
$url .= substr(getenv("PHP_SELF"), 1);
if(isset($_SERVER["QUERY_STRING"]))
{
$url .= "?" . getenv("QUERY_STRING");
}
}
else
{
$url .= getenv("REQUEST_URI");
}
return $url;
}