forked from Adleraci/adlerka.top
Test page title
This commit is contained in:
parent
3344d7412c
commit
9a2afd7528
@ -1,10 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function getDynamicPermission($file): int {
|
|
||||||
|
function getDynamicMetadata($file): array{
|
||||||
|
$page_tmp = include($file);
|
||||||
|
return $page_tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDynamicPermission($params): int {
|
||||||
global $routerConfig;
|
global $routerConfig;
|
||||||
try {
|
try {
|
||||||
$page_tmp = include($file);
|
$permission_level = $params["minimal_permission_level"];
|
||||||
$permission_level = $page_tmp["parameters"]["minimal_permission_level"];
|
|
||||||
|
|
||||||
if (!is_numeric($permission_level) || $permission_level <= 0) {
|
if (!is_numeric($permission_level) || $permission_level <= 0) {
|
||||||
$permission_level = $routerConfig["page"]["default_permissions"];
|
$permission_level = $routerConfig["page"]["default_permissions"];
|
||||||
@ -59,6 +64,7 @@ function generateNavigation(): string
|
|||||||
$page_name = str_replace("_", " ", $page_basename);
|
$page_name = str_replace("_", " ", $page_basename);
|
||||||
$page_name = explode(".", $page_name)[0];
|
$page_name = explode(".", $page_name)[0];
|
||||||
$page_name = ucfirst($page_name);
|
$page_name = ucfirst($page_name);
|
||||||
|
|
||||||
$page_file_path = $routerConfig["page_dir"] . $site_dir . "/" . $page_file ;
|
$page_file_path = $routerConfig["page_dir"] . $site_dir . "/" . $page_file ;
|
||||||
if($page_file_tmp[1] == "html"){
|
if($page_file_tmp[1] == "html"){
|
||||||
$page_tmp = file_get_contents($page_file_path);
|
$page_tmp = file_get_contents($page_file_path);
|
||||||
@ -70,9 +76,17 @@ function generateNavigation(): string
|
|||||||
else{
|
else{
|
||||||
$page_required_permission = $routerConfig["page"]["default_permissions"];
|
$page_required_permission = $routerConfig["page"]["default_permissions"];
|
||||||
}
|
}
|
||||||
|
if(!empty($pageMetadata["parameters"]["page_title"])){
|
||||||
|
$page_name = $pageMetadata["parameters"]["page_title"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elseif($page_file_tmp[1] == "php"){
|
elseif($page_file_tmp[1] == "php"){
|
||||||
$page_required_permission = getDynamicPermission($page_file_path);
|
$pageMetadata = getDynamicMetadata($page_file_path);
|
||||||
|
$page_required_permission = getDynamicPermission($pageMetadata);
|
||||||
|
|
||||||
|
if(!empty($pageMetadata["parameters"]["page_title"])){
|
||||||
|
$page_name = $pageMetadata["parameters"]["page_title"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$page_required_permission = $routerConfig["page"]["default_permissions"];
|
$page_required_permission = $routerConfig["page"]["default_permissions"];
|
||||||
|
Loading…
Reference in New Issue
Block a user