static function add_meta_boxes($page) { $i = 1; add_meta_box($page . '-contentbox-' . $i++, MainWP_Right_Now::getName(), array(MainWP_Right_Now::getClassName(), 'render'), $page, 'normal', 'core'); if (mainwp_current_user_can('dashboard', 'manage_posts')) { add_meta_box($page . '-contentbox-' . $i++, MainWP_Recent_Posts::getName(), array(MainWP_Recent_Posts::getClassName(), 'render'), $page, 'normal', 'core'); } if (mainwp_current_user_can('dashboard', 'manage_pages')) { add_meta_box($page . '-contentbox-' . $i++, MainWP_Recent_Pages::getName(), array(MainWP_Recent_Pages::getClassName(), 'render'), $page, 'normal', 'core'); } if (mainwp_current_user_can('dashboard', 'manage_security_issues')) { add_meta_box($page . '-contentbox-' . $i++, MainWP_Security_Issues::getMetaboxName(), array(MainWP_Security_Issues::getClassName(), 'renderMetabox'), $page, 'normal', 'core'); } global $mainwpUseExternalPrimaryBackupsMethod; if (empty($mainwpUseExternalPrimaryBackupsMethod)) { add_meta_box($page . '-contentbox-' . $i++, MainWP_Backup_Tasks::getName(), array(MainWP_Backup_Tasks::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++, MainWP_SEO::getName(), array(MainWP_SEO::getClassName(), 'render'), $page, 'normal', 'core'); } } add_meta_box($page . '-contentbox-' . $i++, MainWP_Extensions_Widget::getName(), array(MainWP_Extensions_Widget::getClassName(), 'render'), $page, 'normal', 'core'); add_meta_box($page . '-contentbox-' . $i++, MainWP_Help::getName(), array(MainWP_Help::getClassName(), 'render'), $page, 'normal', 'core'); add_meta_box($page . '-contentbox-' . $i++, MainWP_How_To::getName(), array(MainWP_How_To::getClassName(), 'render'), $page, 'normal', 'core'); $extMetaBoxs = MainWP_System::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'); } }
function mainwp_post_restore() { $this->secure_request('mainwp_post_restore'); MainWP_Recent_Posts::restore(); }
public static function restore() { MainWP_Recent_Posts::action('restore'); die(json_encode(array('result' => __('Post has been restored', 'mainwp')))); }
public static function on_load_page_dashboard() { wp_enqueue_script('common'); wp_enqueue_script('wp-lists'); wp_enqueue_script('postbox'); wp_enqueue_script('dashboard'); wp_enqueue_script('widgets'); $i = 1; add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Right_Now::getName(), array(MainWP_Right_Now::getClassName(), 'render'), self::$page, 'normal', 'core'); if (mainwp_current_user_can('dashboard', 'manage_posts')) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Recent_Posts::getName(), array(MainWP_Recent_Posts::getClassName(), 'render'), self::$page, 'normal', 'core'); } if (mainwp_current_user_can('dashboard', 'manage_pages')) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Recent_Pages::getName(), array(MainWP_Recent_Pages::getClassName(), 'render'), self::$page, 'normal', 'core'); } add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Shortcuts::getName(), array(MainWP_Shortcuts::getClassName(), 'render'), self::$page, 'normal', 'core'); if (mainwp_current_user_can('dashboard', 'manage_security_issues')) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Security_Issues::getMetaboxName(), array(MainWP_Security_Issues::getClassName(), 'renderMetabox'), self::$page, 'normal', 'core'); } if (get_option('mainwp_seo') == 1) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Manage_Sites::getMetaboxName(), array(MainWP_Manage_Sites::getClassName(), 'renderMetabox'), self::$page, 'normal', 'core'); } global $mainwpUseExternalPrimaryBackupsMethod; if (empty($mainwpUseExternalPrimaryBackupsMethod)) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Manage_Backups::getMetaboxName(), array(MainWP_Manage_Backups::getClassName(), 'renderMetabox'), self::$page, 'normal', 'core'); } add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Widget_Plugins::getName(), array(MainWP_Widget_Plugins::getClassName(), 'render'), self::$page, 'normal', 'core'); add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Widget_Themes::getName(), array(MainWP_Widget_Themes::getClassName(), 'render'), self::$page, 'normal', 'core'); add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWP_Notes::getName(), array(MainWP_Notes::getClassName(), 'render'), self::$page, 'normal', 'core'); /** * This hook allows you to add extra metaboxes to the dashboard via the 'mainwp-getmetaboxes' filter. * @link http://codex.mainwp.com/#mainwp-getmetaboxes */ $extMetaBoxs = MainWP_System::Instance()->apply_filter('mainwp-getmetaboxes', array()); $extMetaBoxs = apply_filters('mainwp-getmetaboxs', $extMetaBoxs); foreach ($extMetaBoxs as $metaBox) { add_meta_box(self::$page . '-contentbox-' . $i++, $metaBox['metabox_title'], $metaBox['callback'], self::$page, 'normal', 'core'); } }