/** * Return the data for the requested menu, return the main menu if the requested menu doesn't exist * @param string $id String identifying the requested menu * @return array menu data */ static function GetMenuArray($id) { global $dataDir, $gp_menu; $menu_file = $dataDir . '/data/_menus/' . $id . '.php'; if (empty($id) || !gpFiles::Exists($menu_file)) { return gpPlugin::Filter('GetMenuArray', array($gp_menu)); } $menu = gpFiles::Get('_menus/' . $id, 'menu'); if (gpFiles::$last_version && version_compare(gpFiles::$last_version, '3.0b1', '<')) { $menu = gpOutput::FixMenu($menu); } return gpPlugin::Filter('GetMenuArray', array($menu)); }
/** * Return the data for the requested menu, return the main menu if the requested menu doesn't exist * @param string $id String identifying the requested menu * @return array menu data */ function GetMenuArray($id) { global $dataDir, $gp_menu, $config; $menu_file = $dataDir . '/data/_menus/' . $id . '.php'; if (!file_exists($menu_file)) { return gpPlugin::Filter('GetMenuArray', array($gp_menu)); } $menu = array(); $fileVersion = false; require $menu_file; if ($fileVersion && version_compare($fileVersion, '3.0b1', '<')) { $menu = gpOutput::FixMenu($menu); } return gpPlugin::Filter('GetMenuArray', array($menu)); }
/** * Set global variables ( $gp_index, $gp_titles, $gp_menu and $gpLayouts ) from _site/pages.php * */ static function GetPagesPHP() { global $gp_index, $gp_titles, $gp_menu, $gpLayouts, $config; $gp_index = array(); $pages = gpFiles::Get('_site/pages'); //update for < 2.0a3 if (array_key_exists('gpmenu', $pages) && array_key_exists('gptitles', $pages) && !array_key_exists('gp_titles', $pages) && !array_key_exists('gp_menu', $pages)) { foreach ($pages['gptitles'] as $title => $info) { $index = common::NewFileIndex(); $gp_index[$title] = $index; $gp_titles[$index] = $info; } foreach ($pages['gpmenu'] as $title => $level) { $index = $gp_index[$title]; $gp_menu[$index] = array('level' => $level); } return; } $gpLayouts = $pages['gpLayouts']; $gp_index = $pages['gp_index']; $gp_titles = $pages['gp_titles']; $gp_menu = $pages['gp_menu']; if (!is_array($gp_menu)) { common::stop(); } //update for 3.5, if (!isset($gp_titles['special_gpsearch'])) { $gp_titles['special_gpsearch'] = array(); $gp_titles['special_gpsearch']['label'] = 'Search'; $gp_titles['special_gpsearch']['type'] = 'special'; $gp_index['Search'] = 'special_gpsearch'; //may overwrite special_search settings } //fix the gpmenu if (version_compare(gpFiles::$last_version, '3.0b1', '<')) { $gp_menu = gpOutput::FixMenu($gp_menu); // fix gp_titles for gpEasy 3.0+ // just make sure any ampersands in the label are escaped foreach ($gp_titles as $key => $value) { if (isset($gp_titles[$key]['label'])) { $gp_titles[$key]['label'] = common::GetLabelIndex($key, true); } } } //title related configuration settings if (empty($config['homepath_key'])) { $config['homepath_key'] = key($gp_menu); } $config['homepath'] = common::IndexToTitle($config['homepath_key']); }
/** * Set global variables ( $gp_index, $gp_titles, $gp_menu and $gpLayouts ) from _site/pages.php * */ function GetPagesPHP() { global $gp_index, $gp_titles, $gp_menu, $dataDir, $gpLayouts; $gp_index = array(); $pages = array(); require $dataDir . '/data/_site/pages.php'; $GLOBALS['fileModTimes']['pages.php'] = $fileModTime; $gpLayouts = $pages['gpLayouts']; //update for < 2.0a3 if (isset($pages['gpmenu']) && isset($pages['gptitles'])) { //1.7b2 if (!isset($pages['gptitles']['Special_Missing'])) { $pages['gptitles']['Special_Missing']['type'] = 'special'; $pages['gptitles']['Special_Missing']['label'] = 'Missing'; } foreach ($pages['gptitles'] as $title => $info) { $index = common::NewFileIndex(); $gp_index[$title] = $index; $gp_titles[$index] = $info; } foreach ($pages['gpmenu'] as $title => $level) { $index = $gp_index[$title]; $gp_menu[$index] = array('level' => $level); } return; } $gp_index = $pages['gp_index']; $gp_titles = $pages['gp_titles']; $gp_menu = $pages['gp_menu']; //fix the gpmenu if (version_compare($fileVersion, '3.0b1', '<')) { $gp_menu = gpOutput::FixMenu($gp_menu); // fix gp_titles for gpEasy 3.0+ // just make sure any ampersands in the label are escaped foreach ($gp_titles as $key => $value) { if (isset($gp_titles[$key]['label'])) { $gp_titles[$key]['label'] = common::GetLabelIndex($key, true); } } } }