forked from Adleraci/adlerka.top
dokelu
This commit is contained in:
parent
5a087db6d2
commit
7f6afabab2
@ -23,7 +23,7 @@ function getEndpoint($endpoint_name): string
|
|||||||
|
|
||||||
$endpoint_file = $routerConfig["endpoint_dir"] . $routerRequest["subdomain"] . "/" . $endpoint_name . ".php";
|
$endpoint_file = $routerConfig["endpoint_dir"] . $routerRequest["subdomain"] . "/" . $endpoint_name . ".php";
|
||||||
|
|
||||||
$endpoint_file_global = $routerConfig["endpoint_dir"] . "global/" . $endpoint_name . ".php";
|
$endpoint_file_global = $routerConfig["endpoint_dir"] . "account/" . $endpoint_name . ".php";
|
||||||
|
|
||||||
if (file_exists($endpoint_file_global)){
|
if (file_exists($endpoint_file_global)){
|
||||||
$output = runEndpoint($endpoint_file_global);
|
$output = runEndpoint($endpoint_file_global);
|
||||||
|
@ -18,21 +18,10 @@ function generateNavigation(): string
|
|||||||
$pages_dir = array_diff(scandir($routerConfig["page_dir"] . $site_dir), array('.', '..'));
|
$pages_dir = array_diff(scandir($routerConfig["page_dir"] . $site_dir), array('.', '..'));
|
||||||
|
|
||||||
$site_name = str_replace("_", " ", $site_dir);
|
$site_name = str_replace("_", " ", $site_dir);
|
||||||
if ($site_name == "global") {
|
|
||||||
$site_name = "misc";
|
|
||||||
$site_subdomain = $routerConfig["default_site"];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$site_subdomain = $site_dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($site_name == "smp") {
|
$site_name = ucfirst($site_name);
|
||||||
$site_name = "SMP";
|
|
||||||
} else{
|
|
||||||
$site_name = ucfirst($site_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
$site_location = $routerConfig["protocol"] . $site_subdomain . "." . $routerRequest["domain"] . "." . $routerRequest["tld"] . "/" . $routerConfig["default_page"];
|
$site_location = $routerConfig["protocol"] . $site_dir . "." . $routerRequest["domain"] . "." . $routerRequest["tld"] . "/" . $routerConfig["default_page"];
|
||||||
|
|
||||||
if ($routerRequest["subdomain"] == $site_dir) {
|
if ($routerRequest["subdomain"] == $site_dir) {
|
||||||
//this is the current page
|
//this is the current page
|
||||||
@ -52,7 +41,7 @@ function generateNavigation(): string
|
|||||||
$page_class = "class=\"navpage_link active\"";
|
$page_class = "class=\"navpage_link active\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
$page_location = $routerConfig["protocol"] . $site_subdomain . "." . $routerRequest["domain"] . "." . $routerRequest["tld"] . "/" . $page_dir;
|
$page_location = $routerConfig["protocol"] . $site_dir . "." . $routerRequest["domain"] . "." . $routerRequest["tld"] . "/" . $page_dir;
|
||||||
|
|
||||||
$page_name = str_replace("_", " ", $page_dir);
|
$page_name = str_replace("_", " ", $page_dir);
|
||||||
$page_name = explode(".", $page_name)[0];
|
$page_name = explode(".", $page_name)[0];
|
||||||
|
18
lib/page.php
18
lib/page.php
@ -44,24 +44,10 @@ function getPage($page_name = null): array|false|string
|
|||||||
$dynamic_page_file = $routerConfig["page_dir"] . $routerRequest["subdomain"] . "/" . $page_name . ".php";
|
$dynamic_page_file = $routerConfig["page_dir"] . $routerRequest["subdomain"] . "/" . $page_name . ".php";
|
||||||
$page_file = $routerConfig["page_dir"] . $routerRequest["subdomain"] . "/" . $page_name . ".html";
|
$page_file = $routerConfig["page_dir"] . $routerRequest["subdomain"] . "/" . $page_name . ".html";
|
||||||
|
|
||||||
$dynamic_page_file_global = $routerConfig["page_dir"] . "global/" . $page_name . ".php";
|
|
||||||
$page_file_global = $routerConfig["page_dir"] . "global/" . $page_name . ".html";
|
|
||||||
|
|
||||||
$skeleton = file_get_contents($routerConfig["template_dir"] . "skeleton.html");
|
$skeleton = file_get_contents($routerConfig["template_dir"] . "skeleton.html");
|
||||||
$nav = file_get_contents($routerConfig["template_dir"] . "nav.html");
|
$nav = file_get_contents($routerConfig["template_dir"] . "nav.html");
|
||||||
|
|
||||||
if (file_exists($dynamic_page_file_global)){
|
if (file_exists($dynamic_page_file)){
|
||||||
$pageMetadata = renderDynamicPage($dynamic_page_file_global);
|
|
||||||
$page = $pageMetadata["output"];
|
|
||||||
|
|
||||||
}
|
|
||||||
elseif (file_exists($page_file_global)){
|
|
||||||
$page_tmp = file_get_contents($page_file_global);
|
|
||||||
|
|
||||||
$pageMetadata = parsePageTag($page_tmp);
|
|
||||||
$page = $pageMetadata["output"];
|
|
||||||
}
|
|
||||||
elseif (file_exists($dynamic_page_file)){
|
|
||||||
$pageMetadata = renderDynamicPage($dynamic_page_file);
|
$pageMetadata = renderDynamicPage($dynamic_page_file);
|
||||||
|
|
||||||
$page = $pageMetadata["output"];
|
$page = $pageMetadata["output"];
|
||||||
@ -143,11 +129,9 @@ function getPage($page_name = null): array|false|string
|
|||||||
|
|
||||||
if(!empty($pageMetadata["parameters"]["page_script"])){
|
if(!empty($pageMetadata["parameters"]["page_script"])){
|
||||||
$script_location = $pageMetadata["parameters"]["page_script"];
|
$script_location = $pageMetadata["parameters"]["page_script"];
|
||||||
echo $script_location;
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$script_location = "assets/scripts/$site_name/$page_name.js";
|
$script_location = "assets/scripts/$site_name/$page_name.js";
|
||||||
echo $script_location;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file_exists($style_location)) {
|
if(file_exists($style_location)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user