function new_menus() { if (MainWP_Utility::isAdmin()) { //Adding the page to manage your added sites/groups //The first page which will display the post area etc.. MainWP_Security_Issues::initMenu(); MainWP_Manage_Sites::initMenu(); MainWP_Post::initMenu(); MainWP_Page::initMenu(); MainWP_Themes::initMenu(); MainWP_Plugins::initMenu(); MainWP_User::initMenu(); MainWP_Manage_Backups::initMenu(); MainWP_Bulk_Update_Admin_Passwords::initMenu(); MainWP_Manage_Groups::initMenu(); MainWP_Settings::initMenu(); MainWP_Extensions::initMenu(); do_action('mainwp_admin_menu'); MainWP_Documentation::initMenu(); MainWP_Server_Information::initMenu(); MainWP_Child_Scan::initMenu(); MainWP_API_Settings::initMenu(); } }
function prepare_items() { $orderby = null; if (isset($_GET['orderby'])) { if ($_GET['orderby'] == 'task_name') { $orderby = 'name'; } else { if ($_GET['orderby'] == 'type') { $orderby = 'type'; } else { if ($_GET['orderby'] == 'schedule') { $orderby = 'schedule'; } } } if (isset($_GET['order']) && ($_GET['order'] == 'asc' || $_GET['order'] == 'desc')) { $orderby .= ' ' . $_GET['order']; } } $this->items = MainWP_DB::Instance()->getBackupTasksForUser($orderby); if (!MainWP_Manage_Backups::validateBackupTasks($this->items)) { $this->items = MainWP_DB::Instance()->getBackupTasksForUser($orderby); } }
public static function renderNew() { if (!mainwp_current_user_can('dashboard', 'add_backup_tasks')) { mainwp_do_not_have_permissions('add backup tasks'); return; } self::renderHeader('AddNew'); ?> <div class="mainwp_info-box-yellow"><?php _e('We recommend only scheduling 1 site per backup, multiples sites can cause unintended issues.', 'mainwp'); ?> </div> <div id="mainwp_managebackups_add_errors" class="mainwp_error error"></div> <div id="mainwp_managebackups_add_message" class="mainwp_updated updated" style="display: none"></div> <div class="error below-h2" style="display: none;" id="ajax-error-zone"></div> <div id="ajax-information-zone" class="updated" style="display: none;"></div> <div id="mainwp_managbackups_cont"> <form method="POST" action="" id="mainwp_managebackups_add_form"> <?php MainWP_Manage_Backups::renderNewEdit(null); ?> <p class="submit"> <input type="button" name="mainwp_managebackups_add" id="mainwp_managebackups_add" class="button-primary button button-hero" value="<?php _e('Add New Task', 'mainwp'); ?> "/> </p> </form> </div> <?php self::renderFooter('AddNew'); }
function mainwp_backuptask_run_site() { try { $this->secure_request('mainwp_backuptask_run_site'); if (!isset($_POST['site_id']) || !MainWP_Utility::ctype_digit($_POST['site_id']) || !isset($_POST['task_id']) || !MainWP_Utility::ctype_digit($_POST['task_id'])) { throw new MainWP_Exception('Invalid request'); } die(json_encode(array('result' => MainWP_Manage_Backups::backup($_POST['task_id'], $_POST['site_id'], $_POST['fileNameUID'])))); } catch (MainWP_Exception $e) { die(json_encode(array('error' => array('message' => $e->getMessage(), 'extra' => $e->getMessageExtra())))); } }
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'); } }