summaryrefslogtreecommitdiff
path: root/src/_base.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/_base.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/_base.php b/src/_base.php
index e029130..add20a8 100644
--- a/src/_base.php
+++ b/src/_base.php
@@ -181,16 +181,25 @@ abstract class Base {
}
/**
+ * @returns the http scheme currently being used
+ */
+ public static function get_scheme(): string
+ {
+ $scheme = 'http';
+ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']))
+ $scheme = $_SERVER['HTTP_X_FORWARDED_PROTO'];
+
+ return $scheme;
+ }
+
+ /**
* Gets a full path url from a relative path
* @param string $path
* @param bool $timestamp
*/
public static function get_url(string $path, bool $timestamp = FALSE): string
{
- $scheme = 'http';
- if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']))
- $scheme = $_SERVER['HTTP_X_FORWARDED_PROTO'];
-
+ $scheme = self::get_scheme();
$host = $_SERVER['HTTP_HOST'];
if (ENVIRONMENT == 'production') {