mirror of
https://github.com/Aviortheking/DeltaCMS.git
synced 2025-04-23 03:12:14 +00:00
Removed initCache & Added jsonc_decode functions
This commit is contained in:
parent
bf80fe298a
commit
147777af0d
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use AdminPanel\Classes\Cache;
|
|
||||||
|
|
||||||
function ping()
|
function ping()
|
||||||
{
|
{
|
||||||
return "pong";
|
return "pong";
|
||||||
@ -24,7 +22,7 @@ function slugEqualToURI($slug, $uri, $options)
|
|||||||
{
|
{
|
||||||
$uri = explode("/", trim($uri, "\/"));
|
$uri = explode("/", trim($uri, "\/"));
|
||||||
$slug = explode("/", trim($slug, '\/'));
|
$slug = explode("/", trim($slug, '\/'));
|
||||||
$return = array();
|
$return = new stdClass();
|
||||||
|
|
||||||
if (count($uri) != count($slug)) {
|
if (count($uri) != count($slug)) {
|
||||||
return false;
|
return false;
|
||||||
@ -35,12 +33,12 @@ function slugEqualToURI($slug, $uri, $options)
|
|||||||
$elemnt = preg_replace("/{|}/", "", $value);
|
$elemnt = preg_replace("/{|}/", "", $value);
|
||||||
// dd($options);
|
// dd($options);
|
||||||
if (!isset($options->$elemnt)) {
|
if (!isset($options->$elemnt)) {
|
||||||
$return[$elemnt] = explode("?", $uri[$key])[0];
|
$return->$elemnt = explode("?", $uri[$key])[0];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$elOptions = $options->$elemnt;
|
$elOptions = $options->$elemnt;
|
||||||
if (!isset($elOptions->regex) || ($elOptions->regex != null && preg_match($elOptions->regex, $uri[$key]))) {
|
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;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -76,20 +74,16 @@ function getModulesJSON()
|
|||||||
return $t;
|
return $t;
|
||||||
}
|
}
|
||||||
|
|
||||||
function initCache()
|
function jsonc_decode($filename, $assoc = false, $depth = 512, $options = 0)
|
||||||
{
|
{
|
||||||
$json = getModulesJSON();
|
return json_decode(
|
||||||
foreach ($json as $moduleName => $moduleValues) {
|
preg_replace(
|
||||||
if (isset($moduleValues["routes"])) {
|
'![ \t]*//.*[ \t]*[\r\n]!',
|
||||||
//TODO:
|
'',
|
||||||
}
|
file_get_contents($filename)
|
||||||
if (isset($moduleValues["templateFolder"])) {
|
),
|
||||||
Cache::getInstance()->addTemplateFolder(
|
$assoc,
|
||||||
"/Modules/" . $moduleName . $moduleValues["templateFolder"],
|
$depth,
|
||||||
$moduleName
|
$options
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// return $moduleValues;
|
|
||||||
}
|
|
||||||
return $json;
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user