From 147777af0dbd8869f0b234d97d6d41f97fd69ac9 Mon Sep 17 00:00:00 2001 From: Avior Date: Tue, 16 Apr 2019 16:34:14 +0200 Subject: [PATCH] Removed initCache & Added jsonc_decode functions --- src/AdminPanel/Functions.php | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/AdminPanel/Functions.php b/src/AdminPanel/Functions.php index 04cdea8..2afc4e6 100644 --- a/src/AdminPanel/Functions.php +++ b/src/AdminPanel/Functions.php @@ -1,7 +1,5 @@ $elemnt)) { - $return[$elemnt] = explode("?", $uri[$key])[0]; + $return->$elemnt = explode("?", $uri[$key])[0]; continue; } $elOptions = $options->$elemnt; if (!isset($elOptions->regex) || ($elOptions->regex != null && preg_match($elOptions->regex, $uri[$key]))) { - $return[$elemnt] = explode("?", $uri[$key])[0]; + $return->$elemnt = explode("?", $uri[$key])[0]; continue; } else { return false; @@ -76,20 +74,16 @@ function getModulesJSON() return $t; } -function initCache() +function jsonc_decode($filename, $assoc = false, $depth = 512, $options = 0) { - $json = getModulesJSON(); - foreach ($json as $moduleName => $moduleValues) { - if (isset($moduleValues["routes"])) { - //TODO: - } - if (isset($moduleValues["templateFolder"])) { - Cache::getInstance()->addTemplateFolder( - "/Modules/" . $moduleName . $moduleValues["templateFolder"], - $moduleName - ); - } - // return $moduleValues; - } - return $json; + return json_decode( + preg_replace( + '![ \t]*//.*[ \t]*[\r\n]!', + '', + file_get_contents($filename) + ), + $assoc, + $depth, + $options + ); }