HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers60/vandeurzenheftrucks.nl/wwwroot/lib/general/menu.class.php
<?php
/**
 * menu.class.php
 * Created by Komma Mediadesign.
 * Author: mike
 * Date: 12/02/14
 */

class Menu
{
    private $_pages = array();

    // Language
    private $_lang = array();
    private $_urls = array();

    public function __construct()
    {
        // Set language and url for conversion
        $Translator = new Translator(URL_LANG);
        $this->_lang = $Translator->get();
        $this->_urls = $Translator->getUrls();

        // Get all the pages
        $this->_pages = array('about','products','inout_service','support','inspection','references','contact');
    }

    /*
     * Create Main Menu
     */
    public function createMain()
    {
        // Start output with home
        $output = '<li data-target="home"';
        if( ! defined('URL_PAGE')) $output .= ' class="active"';
        $output .= '><a class="first-time-only" href="/" data-rel="ajax">Home</a><span class="bg"></span><span class="arrow"></span></li>';

        // Generate output for pages
        foreach($this->_pages as $page)
        {
            // Get Label
            $label = ucfirst($page);
            if(isset($this->_lang[$page])) $label = $this->_lang[$page];

            // Get Url
            $url = $page;
            // Search in URLS
            if(isset($this->_urls[$page]))
            {
                $url = $this->_urls[$page];
            }
            // Search in LANG
            else if(isset($this->_lang[$page]))
            {
                $label = $this->_lang[$page];
                $url = Fn::encodeUrl($label);
            }

            // Add to output
            $output .= '<li data-target="' . $page . '"';
            if( defined('URL_PAGE') && URL_PAGE == $url) $output .= ' class="active"';
            $output .= '><a href="' . LANG_ROOT . $url . '" data-rel="ajax" class="first-time-only">' . $label . '</a><span class="bg"></span><span class="arrow"></span>';

            $output .= '</li>';
        }
        return $output;
    }
}