當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wpl_global::get_menus方法代碼示例

本文整理匯總了PHP中wpl_global::get_menus方法的典型用法代碼示例。如果您正苦於以下問題:PHP wpl_global::get_menus方法的具體用法?PHP wpl_global::get_menus怎麽用?PHP wpl_global::get_menus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在wpl_global的用法示例。


在下文中一共展示了wpl_global::get_menus方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: admin_home

 public function admin_home()
 {
     /** check permission **/
     wpl_global::min_access('administrator');
     $this->submenus = wpl_global::get_menus('submenu', 'backend', 1, 1);
     $this->settings = wpl_global::get_settings();
     /** import tpl **/
     parent::render($this->tpl_path, $this->tpl);
 }
開發者ID:amankatoch,項目名稱:wp-plugin,代碼行數:9,代碼來源:wpl_main.php

示例2: wpl_admin_bar_menu

 /**
  * For creating admin bar menu
  * @author Howard <howard@realtyna.com>
  * @global object $wp_admin_bar
  */
 public function wpl_admin_bar_menu()
 {
     $cur_user_id = wpl_users::get_cur_user_id();
     $cur_user_data = wpl_users::get_user($cur_user_id);
     $cur_role = wpl_users::get_role($cur_user_id, false);
     $wpl_roles = wpl_users::get_wpl_roles();
     $menus = wpl_global::get_menus('menu', 'backend');
     $submenus = wpl_global::get_menus('submenu', 'backend');
     global $wp_admin_bar;
     /** generate pages object **/
     $controller = new wpl_controller();
     if (wpl_users::is_administrator($cur_user_id) or $cur_user_data->data->wpl_data->id) {
         /** add menus **/
         foreach ($menus as $menu) {
             $menu_slug = (!wpl_users::is_administrator($cur_user_id) and $menu->capability != 'current') ? 'wpl_admin_profile' : $menu->menu_slug;
             $wp_admin_bar->add_menu(array('id' => $menu->menu_slug, 'title' => __($menu->menu_title, WPL_TEXTDOMAIN), 'href' => wpl_global::get_wp_admin_url() . 'admin.php?page=' . $menu_slug));
         }
         /** add sub menus **/
         foreach ($submenus as $submenu) {
             if (!wpl_users::has_menu_access($submenu->menu_slug)) {
                 continue;
             }
             if (!wpl_users::is_administrator($cur_user_id) and $submenu->capability != 'current') {
                 continue;
             }
             $menu_title = $submenu->separator ? $controller->wpl_add_separator() . __($submenu->menu_title, WPL_TEXTDOMAIN) : __($submenu->menu_title, WPL_TEXTDOMAIN);
             $wp_admin_bar->add_menu(array('id' => $submenu->menu_slug, 'parent' => $submenu->parent, 'title' => $menu_title, 'href' => wpl_global::get_wp_admin_url() . 'admin.php?page=' . $submenu->menu_slug));
         }
     }
 }
開發者ID:amankatoch,項目名稱:wp-plugin,代碼行數:35,代碼來源:extensions.php


注:本文中的wpl_global::get_menus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。