- Merged with new code-base

This commit is contained in:
Dave M. 2023-03-30 14:46:52 -04:00
parent 1611ebe047
commit 44b0283938
1 changed files with 11 additions and 3 deletions

View File

@ -16,20 +16,26 @@ PATTERN;
protected string $urlBase;
protected string $appUrl;
protected string $assetToken;
protected array $routes;
protected array $routesTarget;
protected bool $forceSSL = false;
public array $tokens = [ "url" , "route", "asset", "slug" ];
#[\Deprecated]
protected bool $enforceExistingArguments = true;
public function __construct(string $urlBase = "", string $assetToken = "") {
public function __construct(string $urlBase = "", string $assetToken = "", string $appUrl = "", bool $forceSSL = false) {
$this->urlBase = trim($urlBase, "/");
$this->assetToken = $assetToken;
$this->appUrl = $appUrl;
$this->forceSSL = $forceSSL;
}
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token, array $options = []) : string
@ -169,7 +175,7 @@ PATTERN;
protected function scheme() : string
{
return ( $this->isHttps() ? "https" : "http" ) . "://";
return ( $this->forceSSL || $this->isHttps() ? "https" : "http" ) . "://";
}
protected function base() : string
@ -188,7 +194,9 @@ PATTERN;
protected function domain() : string
{
return strtolower($_SERVER['HTTP_HOST']);
$port = $this->isDefaultPort() ? "" : ":" . $_SERVER['SERVER_PORT'];
return strtolower($this->appUrl ? $this->appUrl . $port : $_SERVER['HTTP_HOST']);
}
protected function isDefaultPort() : bool