summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2026-02-27 09:33:49 -0500
committerFreya Murphy <freya@freyacat.org>2026-02-27 09:33:49 -0500
commit4fbb1ea607a233db891b147536d4d2aa649b2e44 (patch)
treebf8c457d6ded802469c7a91dbec5a5874de45fd8 /src
parentfix compose override path (diff)
downloadcrimson-4fbb1ea607a233db891b147536d4d2aa649b2e44.tar.gz
crimson-4fbb1ea607a233db891b147536d4d2aa649b2e44.tar.bz2
crimson-4fbb1ea607a233db891b147536d4d2aa649b2e44.zip
add function to get http scheme
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') {