From e8d81222ff9192900a3fb075fb58a580d530b29e Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Wed, 29 Jan 2020 16:13:05 -0500 Subject: [PATCH] - Fixed Memory caching interfacing. - Fixed a bug within UrlExtension which was triggered only in IIS --- src/Caching/Memory.php | 19 +++++-------------- src/Extension/UrlExtension.php | 10 +++++----- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/Caching/Memory.php b/src/Caching/Memory.php index 09bc84b..c915aa9 100644 --- a/src/Caching/Memory.php +++ b/src/Caching/Memory.php @@ -2,21 +2,12 @@ namespace Picea\Caching; +use Picea\Compiler\Context; + class Memory implements Cache { + public function compiled(string $viewPath) : bool { return false; } - public function handle(string $fileName) : bool - { - #if ( file_exists($path = $this->filePath($fileName)) ) { - # require_once($path); - #} + public function load(string $viewPath, ...$arguments) : object { return new \StdClass(); } - return false; - } - - public function load() {} - - public function saveFile(string $fileName) : bool - { - - } + public function save(Context $context) : bool { return true; } } diff --git a/src/Extension/UrlExtension.php b/src/Extension/UrlExtension.php index f990797..990b737 100644 --- a/src/Extension/UrlExtension.php +++ b/src/Extension/UrlExtension.php @@ -15,7 +15,7 @@ class UrlExtension implements Extension { public array $tokens = [ "url" , "route", "asset" ]; public function __construct(Context $context, string $urlBase = "", string $assetToken = "") { - $this->urlBase = $urlBase; + $this->urlBase = trim($urlBase, "/"); $this->assetToken = $assetToken; $this->register($context); } @@ -110,7 +110,7 @@ class UrlExtension implements Extension { protected function base() : string { - return $this->urlBase ? $this->urlBase . "/" : ""; + return $this->urlBase ? "/" . $this->urlBase : ""; } /** @@ -143,9 +143,9 @@ class UrlExtension implements Extension { ])); return $header - || ( "443" === $_SERVER['SERVER_PORT'] ?? "" ) - || ( "https" === $_SERVER['REQUEST_SCHEME'] ?? "http" ) - || ( "off" !== strtolower($_SERVER['HTTPS'] ?? "off") ); + || ( "443" === ( $_SERVER['SERVER_PORT'] ?? "" ) ) + || ( "https" === ( $_SERVER['REQUEST_SCHEME'] ?? "http") ) + || ( "off" !== ( strtolower($_SERVER['HTTPS'] ?? "off")) ); } protected function prepareRoute(string $route, array &$arguments)