本文整理汇总了PHP中gpOutput::GetMenuArray方法的典型用法代码示例。如果您正苦于以下问题:PHP gpOutput::GetMenuArray方法的具体用法?PHP gpOutput::GetMenuArray怎么用?PHP gpOutput::GetMenuArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gpOutput
的用法示例。
在下文中一共展示了gpOutput::GetMenuArray方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Upgrade_234
/**
* Update the gp_index, gp_titles and menus so that special pages can be renamed
*
*/
function Upgrade_234()
{
global $gp_index, $gp_titles, $gp_menu, $config, $dataDir;
includeFile('tool/gpOutput.php');
$special_indexes = array();
$new_index = array();
$new_titles = array();
foreach ($gp_index as $title => $index) {
$info = $gp_titles[$index];
$type = common::SpecialOrAdmin($title);
if ($type === 'special') {
$special_indexes[$index] = strtolower($title);
$index = strtolower($title);
$info['type'] = 'special';
//some older versions didn't maintain this value well
}
$new_index[$title] = $index;
$new_titles[$index] = $info;
}
$gp_titles = $new_titles;
$gp_index = $new_index;
//update gp_menu
$gp_menu = $this->FixMenu($gp_menu, $special_indexes);
//save pages
if (!admin_tools::SavePagesPHP()) {
return;
}
$config['gpversion'] = '2.3.4';
admin_tools::SaveConfig();
//update alt menus
if (isset($config['menus']) && is_array($config['menus'])) {
foreach ($config['menus'] as $key => $value) {
$menu_file = $dataDir . '/data/_menus/' . $key . '.php';
if (gpFiles::Exists($menu_file)) {
$menu = gpOutput::GetMenuArray($key);
$menu = $this->FixMenu($menu, $special_indexes);
gpFiles::SaveData($menu_file, 'menu', $menu);
}
}
}
}
示例2: getChildpagesfromAnotherMenu
function getChildpagesfromAnotherMenu($menu_id, $labelset)
{
global $gp_titles, $gp_index;
$menu = gpOutput::GetMenuArray($menu_id);
$index = $this->array_find_deep($gp_titles, $labelset);
$page_index = $index[0];
if (!isset($menu[$page_index])) {
return;
}
$titles = common::Descendants($page_index, $menu);
$level = $menu[$page_index]['level'];
foreach ($titles as $index) {
$child_level = $menu[$index]['level'];
if ($child_level != $level + 1) {
continue;
}
$title[] = array_search($index, $gp_index);
if (!$title) {
continue;
}
}
if (!isset($title)) {
return;
}
return $title;
}
示例3: InMenu
/**
* Determine if the page is in a menu
*
*/
public function InMenu($page_index)
{
global $gp_menu, $config;
//show main menu
if (isset($gp_menu[$page_index])) {
return true;
}
foreach ($config['menus'] as $id => $menu_label) {
$array = gpOutput::GetMenuArray($id);
if (isset($array[$page_index])) {
return true;
}
}
return false;
}
示例4: GetNoMenus
/**
* Get an array of titles that is not represented in any of the menus
*
*/
function GetNoMenus()
{
global $gp_index;
//first get all titles in a menu
$menus = $this->GetAvailMenus('menu');
$all_keys = array();
foreach ($menus as $menu_id => $label) {
$menu_array = gpOutput::GetMenuArray($menu_id);
$keys = array_keys($menu_array);
$all_keys = array_merge($all_keys, $keys);
}
$all_keys = array_unique($all_keys);
//then check $gp_index agains $all_keys
foreach ($gp_index as $title => $index) {
if (in_array($index, $all_keys)) {
continue;
}
$avail[] = $title;
}
return $avail;
}
示例5: BreadcrumbNav
static function BreadcrumbNav($arg = '')
{
global $page, $gp_index, $GP_MENU_CLASSES;
$source_menu_array = gpOutput::GetMenuArray($arg);
$output = array();
$thisLevel = -1;
$last_index = '';
$rmenu = array_reverse($source_menu_array);
foreach ($rmenu as $index => $info) {
$level = $info['level'];
if ($thisLevel >= 0) {
if ($thisLevel == $level) {
array_unshift($output, $index);
$last_index = $index;
if ($thisLevel == 0) {
break;
}
$thisLevel--;
}
}
if ($index == $page->gp_index) {
array_unshift($output, $index);
$thisLevel = $level - 1;
$last_index = $index;
}
}
reset($source_menu_array);
//add homepage
$first_index = key($source_menu_array);
if ($last_index != $first_index) {
array_unshift($output, $first_index);
}
self::PrepMenuOutput();
$clean_attributes = array('attr' => '', 'class' => array(), 'id' => '');
$clean_attributes_a = array('href' => '', 'attr' => '', 'value' => '', 'title' => '', 'class' => array());
// opening ul
$attributes_ul = $clean_attributes;
$attributes_ul['class']['menu_top'] = $GP_MENU_CLASSES['menu_top'];
if (self::$edit_area_id) {
$attributes_ul['id'] = self::$edit_area_id;
$attributes_ul['class']['editable_area'] = 'editable_area';
}
self::FormatMenuElement('ul', $attributes_ul);
//
$len = count($output);
for ($i = 0; $i < $len; $i++) {
$index = $output[$i];
$title = common::IndexToTitle($index);
$attributes_li = $clean_attributes;
$attributes_a = $clean_attributes_a;
$attributes_a['href'] = common::GetUrl($title);
$attributes_a['value'] = common::GetLabel($title);
$attributes_a['title'] = common::GetBrowserTitle($title);
if ($title == $page->title) {
$attributes_a['class']['selected'] = $GP_MENU_CLASSES['selected'];
$attributes_li['class']['selected_li'] = $GP_MENU_CLASSES['selected_li'];
}
self::FormatMenuElement('li', $attributes_li);
if ($i < $len - 1) {
self::FormatMenuElement('a', $attributes_a);
} else {
self::FormatMenuElement('a', $attributes_a);
}
echo '</li>';
}
echo '</ul>';
}
示例6: GetExpandMenu
function GetExpandMenu($arg = '')
{
global $page;
$source_menu_array = gpOutput::GetMenuArray($arg);
$menu = array();
$submenu = array();
$foundGroup = false;
foreach ($source_menu_array as $key => $info) {
$level = $info['level'];
if ($level == 0) {
$submenu = array();
$foundGroup = false;
}
if ($key == $page->gp_index) {
$foundGroup = true;
$menu = $menu + $submenu;
//not using array_merge because of numeric indexes
}
if ($foundGroup) {
$menu[$key] = $level;
} elseif ($level == 0) {
$menu[$key] = $level;
} else {
$submenu[$key] = $level;
}
}
gpOutput::OutputMenu($menu, 0, $source_menu_array);
}
示例7: NotTranslated
/**
* Show a list of pages that don't have a translation setting
*
*/
function NotTranslated()
{
global $ml_languages, $gp_index, $config, $gp_menu;
$menu_info['gp_menu'] = $gp_menu;
$menu_labels['gp_menu'] = 'Main Menu';
if (isset($config['menus'])) {
foreach ($config['menus'] as $menu => $label) {
$menu_info[$menu] = gpOutput::GetMenuArray($menu);
$menu_labels[$menu] = $label;
}
}
echo '<h2>Pages Without Translations</h2>';
echo '<table class="bordered full_width"><tr><th>Page</th><th>Menus</th><th> </th></tr>';
foreach ($gp_index as $slug => $page_index) {
if (isset($this->titles[$page_index])) {
continue;
}
echo '<tr><td>';
$title = common::IndexToTitle($page_index);
echo common::Link_Page($title);
echo '</td><td>';
$which_menus = array();
foreach ($menu_info as $menu => $info) {
if (isset($menu[$page_index])) {
$which_menus[] = common::Link('Admin_Menu', $menu_labels[$menu], 'menu=' . $menu, 'name="cnreq"');
}
}
echo implode(', ', $which_menus);
echo '</td><td>';
echo common::Link('Admin_MultiLang', 'Options', 'cmd=title_settings&index=' . $page_index, ' name="gpabox"');
echo '</td></tr>';
}
echo '</table>';
}
示例8: CheckifNavAnother
function CheckifNavAnother()
{
global $config, $page;
if (!array_key_exists("menus", $config)) {
return false;
}
foreach ($config['menus'] as $key => $value) {
$menu = gpOutput::GetMenuArray($key);
//check page in another menu
if (isset($menu[$page->gp_index])) {
$parent = $this->check_parent_another($menu);
if ($parent) {
if ($this->CheckifNav($parent)) {
$this->another_menu = $menu;
}
return $this->CheckifNav($parent);
}
}
}
return false;
}