예제 #1
0
 static function add_meta_boxes($page)
 {
     $i = 1;
     add_meta_box($page . '-contentbox-' . $i++, MainWPRightNow::getName(), array(MainWPRightNow::getClassName(), 'render'), $page, 'normal', 'core');
     if (mainwp_current_user_can("dashboard", "manage_posts")) {
         add_meta_box($page . '-contentbox-' . $i++, MainWPRecentPosts::getName(), array(MainWPRecentPosts::getClassName(), 'render'), $page, 'normal', 'core');
     }
     if (mainwp_current_user_can("dashboard", "manage_pages")) {
         add_meta_box($page . '-contentbox-' . $i++, MainWPRecentPages::getName(), array(MainWPRecentPages::getClassName(), 'render'), $page, 'normal', 'core');
     }
     if (mainwp_current_user_can("dashboard", "manage_security_issues")) {
         add_meta_box($page . '-contentbox-' . $i++, MainWPSecurityIssues::getMetaboxName(), array(MainWPSecurityIssues::getClassName(), 'renderMetabox'), $page, 'normal', 'core');
     }
     global $mainwpUseExternalPrimaryBackupsMethod;
     if (empty($mainwpUseExternalPrimaryBackupsMethod)) {
         add_meta_box($page . '-contentbox-' . $i++, MainWPBackupTasks::getName(), array(MainWPBackupTasks::getClassName(), 'render'), $page, 'normal', 'core');
     }
     if (mainwp_current_user_can("dashboard", "see_seo_statistics")) {
         if (get_option('mainwp_seo') == 1) {
             add_meta_box($page . '-contentbox-' . $i++, MainWPSEO::getName(), array(MainWPSEO::getClassName(), 'render'), $page, 'normal', 'core');
         }
     }
     add_meta_box($page . '-contentbox-' . $i++, MainWPExtensionsWidget::getName(), array(MainWPExtensionsWidget::getClassName(), 'render'), $page, 'normal', 'core');
     add_meta_box($page . '-contentbox-' . $i++, MainWPHelp::getName(), array(MainWPHelp::getClassName(), 'render'), $page, 'normal', 'core');
     //add_meta_box($page.'-contentbox-' . $i++, MainWPNews::getName(), array(MainWPNews::getClassName(), 'render'), $page, 'normal', 'core');
     $extMetaBoxs = MainWPSystem::Instance()->apply_filter('mainwp-getmetaboxes', array());
     $extMetaBoxs = apply_filters('mainwp-getmetaboxs', $extMetaBoxs);
     foreach ($extMetaBoxs as $metaBox) {
         add_meta_box($page . '-contentbox-' . $i++, $metaBox['metabox_title'], $metaBox['callback'], $page, 'normal', 'core');
     }
 }
예제 #2
0
 function mainwp_extension_change_view()
 {
     $this->secure_request('mainwp_extension_change_view');
     try {
         die(json_encode(MainWPExtensionsWidget::changeDefaultView()));
     } catch (MainWPException $e) {
         die(json_encode(array('error' => array('message' => $e->getMessage(), 'extra' => $e->getMessageExtra()))));
     } catch (Exception $e) {
         die(json_encode(array('error' => array('message' => $e->getMessage()))));
     }
 }