コード例 #1
0
 public static function initMenu()
 {
     self::$page = MainWPManageSitesView::initMenu();
     add_submenu_page('mainwp_tab', __('Sites Help', 'mainwp'), '<div class="mainwp-hidden">' . __('Sites Help', 'mainwp') . '</div>', 'read', 'SitesHelp', array(MainWPManageSites::getClassName(), 'QSGManageSites'));
     if (isset($_REQUEST['dashboard'])) {
         global $current_user;
         delete_user_option($current_user->ID, 'screen_layout_toplevel_page_managesites');
         add_filter('screen_layout_columns', array(self::getClassName(), 'on_screen_layout_columns'), 10, 2);
         $val = get_user_option('screen_layout_' . self::$page);
         if (!MainWPUtility::ctype_digit($val)) {
             global $current_user;
             update_user_option($current_user->ID, 'screen_layout_' . self::$page, 2, true);
         }
         add_action('load-' . MainWPManageSites::$page, array(MainWPManageSites::getClassName(), 'on_load_page_dashboard'));
     } else {
         //            add_action('load-'.MainWPManageSites::$page, array(MainWPManageSites::getClassName(), 'on_load_page_manage'));
         add_action('load-' . MainWPManageSites::$page, array(MainWPManageSites::getClassName(), 'add_options'));
     }
     add_submenu_page('mainwp_tab', 'Sites', '<div class="mainwp-hidden">Sites</div>', 'read', 'SiteOpen', array(MainWPSiteOpen::getClassName(), 'render'));
     add_submenu_page('mainwp_tab', 'Sites', '<div class="mainwp-hidden">Sites</div>', 'read', 'SiteRestore', array(MainWPSiteOpen::getClassName(), 'renderRestore'));
     self::$subPages = apply_filters('mainwp-getsubpages-sites', array());
     if (isset(self::$subPages) && is_array(self::$subPages)) {
         foreach (self::$subPages as $subPage) {
             add_submenu_page('mainwp_tab', $subPage['title'], '<div class="mainwp-hidden">' . $subPage['title'] . '</div>', 'read', 'ManageSites' . $subPage['slug'], $subPage['callback']);
         }
     }
 }