summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-03-15 00:19:18 +0100
committeremkael <emkael@tlen.pl>2017-03-15 00:19:18 +0100
commit36c5069a85a136d6ccad7e9260f98c7b4512b6a4 (patch)
treeb009e3b1f29d767c7a21bf577aafba5efe56d169 /include
parent2f00a0eaabab8f484b54229d450d2dd6d5988cdc (diff)
* page ID extraction refactored
Diffstat (limited to 'include')
-rw-r--r--include/Menu.class.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/Menu.class.php b/include/Menu.class.php
index 3a61595..acb2629 100644
--- a/include/Menu.class.php
+++ b/include/Menu.class.php
@@ -6,25 +6,29 @@ class Menu {
return Env::get('menu', 'items');
}
+ private static function _getPageID($url) {
+ return trim(explode('#', $url)[0], '/');
+ }
+
public static function getActiveLink($pageID) {
$activeContent = $pageID;
foreach (self::getItems() as $item => $link) {
if (is_array($link)) {
foreach ($link as $subitem => $sublink) {
- if (trim($sublink, '/') === $pageID) {
+ if (self::_getPageID($sublink) === $pageID) {
$activeContent = $link['_'];
break;
}
}
} else {
- if (trim($link, '/') === $pageID) {
+ if (self::_getPageID($link) === $pageID) {
$activeContent = $link;
}
}
}
return $activeContent;
}
-
+
}
?>