本文整理汇总了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);
}
示例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));
}
}
}