summaryrefslogtreecommitdiff
path: root/include/Menu.class.php
blob: 3a615953d7379b99e96265b0a782acd97b90e150 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

class Menu {

    public static function getItems() {
        return Env::get('menu', 'items');
    }

    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) {
                        $activeContent = $link['_'];
                        break;
                    }
                }
            } else {
                if (trim($link, '/') === $pageID) {
                    $activeContent = $link;
                }
            }
        }
        return $activeContent;
    }
    
}

?>