Пример #1
0
 /**
  * Register additional menu items in the dashboard.
  *
  * @since  4.6.0
  */
 public static function admin_menus()
 {
     global $submenu;
     // correct_level checks:
     // PO_GLOBAL is true .. We have to be on network-admin/main blog.
     // PO_GLOBAL is false .. we have to be NOT on network-admin.
     if (!self::correct_level()) {
         return;
     }
     if (is_network_admin()) {
         lib2()->array->equip_request('popup_network');
         if ('hide' === $_REQUEST['popup_network']) {
             IncPopupDatabase::set_flag('network_dismiss', true);
             wp_safe_redirect(admin_url('network'));
             die;
         } else {
             if ('show' === $_REQUEST['popup_network']) {
                 IncPopupDatabase::set_flag('network_dismiss', false);
             }
         }
         if (true == IncPopupDatabase::get_flag('network_dismiss')) {
             return;
         }
         add_menu_page(__('PopUp', PO_LANG), __('PopUp', PO_LANG), IncPopupPosttype::$perms, IncPopupItem::POST_TYPE . '-list', array('IncPopup', 'network_menu_notice'), PO_IMG_URL . 'icon.png', IncPopupPosttype::$menu_pos);
         add_submenu_page(IncPopupItem::POST_TYPE . '-list', __('Add New', PO_LANG), __('Add New', PO_LANG), IncPopupPosttype::$perms, IncPopupItem::POST_TYPE . '-create', array('IncPopup', 'network_menu_notice'));
         add_submenu_page(IncPopupItem::POST_TYPE . '-list', __('Settings', PO_LANG), __('Settings', PO_LANG), IncPopupPosttype::$perms, IncPopupItem::POST_TYPE . '-settings', array('IncPopup', 'network_menu_notice'));
         $submenu[IncPopupItem::POST_TYPE . '-list'][0][0] = _x('Global PopUps', 'Post Type General Name', PO_LANG);
     } else {
         add_submenu_page('edit.php?post_type=' . IncPopupItem::POST_TYPE, __('Settings', PO_LANG), __('Settings', PO_LANG), IncPopupPosttype::$perms, 'settings', array('IncPopup', 'handle_settings_page'));
     }
 }