mirror of
https://github.com/Aviortheking/DeltaCMS.git
synced 2025-04-23 19:32:13 +00:00
.gitignore ignores some launch files changelog.md, readme.md added end file line public.php moved started the work on it router.php added require to functions & moved the function in the file set an ini value to show errors defied some constants moved the public page management to public/public.php exampleModule -> headGenerator.php started working on module management *.json reworked files function.php added this file to manages cores functions website.php the Website Object for theme & modules page.php created a test theme
56 lines
1.1 KiB
PHP
56 lines
1.1 KiB
PHP
<?php
|
|
|
|
function loadJSON($file) {
|
|
return json_decode(file_get_contents($file), true);
|
|
}
|
|
|
|
function getWebPage($useCache) {
|
|
$fileCache = ROOT . "/cache" . URL . ".html";
|
|
|
|
if($useCache && file_exists($fileCache)) {
|
|
return file_get_contents($fileCache);
|
|
}
|
|
|
|
// var_dump(URL);
|
|
$fileURI = ROOT . "/pages" . URL . ".json";
|
|
$json = loadJSON($fileURI);
|
|
$template = $json["template"];
|
|
|
|
$json["template"] = null;
|
|
|
|
define("PAGE", $json);
|
|
|
|
$templates = loadJSON(ROOT . "/admin/settings/templates.json");
|
|
|
|
require_once ROOT . "/admin/themes/" . SETTINGS["theme"] . "/" . $templates[$template]["URI"];
|
|
|
|
$function = $templates[$template]["function"];
|
|
|
|
if(function_exists($function)) {
|
|
$content = $function();
|
|
|
|
if($useCache && $templates[$template]["static"]) file_put_contents($fileCache, $content);
|
|
|
|
return $content;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
function endsWith($haystack, $needle) {
|
|
$length = strlen($needle);
|
|
if ($length == 0) {
|
|
return true;
|
|
}
|
|
|
|
return (substr($haystack, -$length) === $needle);
|
|
}
|
|
|
|
/*
|
|
function generateWebPage()
|
|
load pages/page.json
|
|
load variables for theme
|
|
generate the basic web page
|
|
*/
|
|
|
|
?>
|