public static function render() { ?> <div id="rightnow_list" xmlns="http://www.w3.org/1999/html"><?php MainWP_Right_Now::renderSites(); ?> </div> <?php }
public function __construct($mainwp_plugin_file) { MainWP_System::$instance = $this; $this->update(); $this->plugin_slug = plugin_basename($mainwp_plugin_file); list($t1, $t2) = explode('/', $this->plugin_slug); $this->slug = str_replace('.php', '', $t2); if (is_admin()) { include_once ABSPATH . 'wp-admin' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'plugin.php'; //Version information from wordpress $pluginData = get_plugin_data($mainwp_plugin_file); $this->current_version = $pluginData['Version']; $currentVersion = get_option('mainwp_plugin_version'); if (version_compare($currentVersion, $this->current_version, '<')) { update_option('mainwp_reset_user_tips', array()); MainWP_Utility::update_option('mainwp_reset_user_cookies', array()); //delete_option('mainwp_api_sslVerifyCertificate'); } MainWP_Utility::update_option('mainwp_plugin_version', $this->current_version); } if (!defined('MAINWP_VERSION')) { define('MAINWP_VERSION', $this->current_version); } if (get_option('mainwp_upgradeVersionInfo') != '' && get_option('mainwp_upgradeVersionInfo') != null) { $this->upgradeVersionInfo = unserialize(get_option('mainwp_upgradeVersionInfo')); } else { $this->upgradeVersionInfo = null; } $this->handleSettingsPost(); $ssl_api_verifyhost = get_option('mainwp_api_sslVerifyCertificate') === false || get_option('mainwp_api_sslVerifyCertificate') == 1 ? 1 : 0; if ($ssl_api_verifyhost == 0) { add_filter('http_request_args', array(MainWP_Extensions::getClassName(), 'noSSLFilterExtensionUpgrade'), 99, 2); } MainWP_Extensions::init(); add_action('in_plugin_update_message-' . $this->plugin_slug, array($this, 'in_plugin_update_message'), 10, 2); add_action('init', array(&$this, 'localization')); // define the alternative API for updating checking add_filter('site_transient_update_plugins', array(&$this, 'check_update_custom')); // Define the alternative response for information checking add_filter('pre_set_site_transient_update_plugins', array(&$this, 'pre_check_update_custom')); add_filter('plugins_api', array(&$this, 'check_info'), 10, 3); $this->metaboxes = new MainWP_Meta_Boxes(); MainWP_Main::get(); //init main dashboard MainWP_Manage_Sites::init(); new MainWP_Hooks(); //Init the hooks //Change menu & widgets add_action('admin_menu', array(&$this, 'new_menus')); //Change footer add_filter('update_footer', array(&$this, 'update_footer'), 15); //Add js add_action('admin_head', array(&$this, 'admin_head')); add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_styles')); add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts')); //Add body class add_action('admin_body_class', array(&$this, 'admin_body_class')); //Handle the bulkpost add_action('publish_bulkpost', array(&$this, 'publish_bulkpost')); add_action('save_post', array(&$this, 'save_bulkpost')); add_action('save_post', array(&$this, 'save_bulkpage')); add_action('add_meta_boxes_bulkpost', array('MainWP_Post', 'addStickyOption')); //Handle the bulkpage add_action('publish_bulkpage', array(&$this, 'publish_bulkpage')); //Add meta boxes for the bulkpost add_action('admin_init', array(&$this, 'admin_init')); //Create the post types for bulkpost/... add_action('init', array(&$this, 'create_post_type')); add_action('init', array(&$this, 'parse_init')); add_action('init', array(&$this, 'init'), 9999); add_action('admin_init', array($this, 'admin_redirects')); //Remove the pages from the menu which I use in AJAX add_action('admin_menu', array(&$this, 'admin_menu')); add_action('admin_menu', array(&$this, 'remove_wp_menus')); //Add custom error messages add_filter('post_updated_messages', array(&$this, 'post_updated_messages')); add_action('login_form', array(&$this, 'login_form')); add_action('admin_print_styles', array(&$this, 'admin_print_styles')); add_filter('admin_footer', array($this, 'admin_footer')); MainWP_Install_Bulk::init(); do_action('mainwp_cronload_action'); //Cron every 5 minutes add_action('mainwp_cronstats_action', array($this, 'mainwp_cronstats_action')); add_action('mainwp_cronbackups_action', array($this, 'mainwp_cronbackups_action')); add_action('mainwp_cronbackups_continue_action', array($this, 'mainwp_cronbackups_continue_action')); add_action('mainwp_cronupdatescheck_action', array($this, 'mainwp_cronupdatescheck_action')); add_action('mainwp_cronpingchilds_action', array($this, 'mainwp_cronpingchilds_action')); add_filter('cron_schedules', array('MainWP_Utility', 'getCronSchedules')); $useWPCron = get_option('mainwp_wp_cron') === false || get_option('mainwp_wp_cron') == 1; //todo: remove in next version if (($sched = wp_next_scheduled('mainwp_cronofflinecheck_action')) != false) { wp_unschedule_event($sched, 'mainwp_cronofflinecheck_action'); } if (($sched = wp_next_scheduled('mainwp_cronstats_action')) == false) { if ($useWPCron) { wp_schedule_event(time(), 'hourly', 'mainwp_cronstats_action'); } } else { if (!$useWPCron) { wp_unschedule_event($sched, 'mainwp_cronstats_action'); } } if (($sched = wp_next_scheduled('mainwp_cronbackups_action')) == false) { if ($useWPCron) { wp_schedule_event(time(), 'hourly', 'mainwp_cronbackups_action'); } } else { if (!$useWPCron) { wp_unschedule_event($sched, 'mainwp_cronbackups_action'); } } if (($sched = wp_next_scheduled('mainwp_cronbackups_continue_action')) == false) { if ($useWPCron) { wp_schedule_event(time(), '5minutely', 'mainwp_cronbackups_continue_action'); } } else { if (!$useWPCron) { wp_unschedule_event($sched, 'mainwp_cronbackups_continue_action'); } } if (($sched = wp_next_scheduled('mainwp_cronremotedestinationcheck_action')) != false) { wp_unschedule_event($sched, 'mainwp_cronremotedestinationcheck_action'); } if (($sched = wp_next_scheduled('mainwp_cronpingchilds_action')) == false) { if ($useWPCron) { wp_schedule_event(time(), 'daily', 'mainwp_cronpingchilds_action'); } } else { if (!$useWPCron) { wp_unschedule_event($sched, 'mainwp_cronpingchilds_action'); } } if (($sched = wp_next_scheduled('mainwp_cronupdatescheck_action')) == false) { if ($useWPCron) { wp_schedule_event(time(), 'minutely', 'mainwp_cronupdatescheck_action'); } } else { if (!$useWPCron) { wp_unschedule_event($sched, 'mainwp_cronupdatescheck_action'); } } add_action('admin_notices', array(&$this, 'admin_notices')); add_filter('mainwp-activated-check', array(&$this, 'activated_check')); add_filter('mainwp-activated-sub-check', array(&$this, 'activated_sub_check')); add_filter('mainwp-extension-enabled-check', array(MainWP_Extensions::getClassName(), 'isExtensionEnabled')); /** * This hook allows you to get a list of sites via the 'mainwp-getsites' filter. * @link http://codex.mainwp.com/#mainwp-getsites * * @see \MainWP_Extensions::hookGetSites */ add_filter('mainwp-getsites', array(MainWP_Extensions::getClassName(), 'hookGetSites'), 10, 4); add_filter('mainwp-getdbsites', array(MainWP_Extensions::getClassName(), 'hookGetDBSites'), 10, 5); /** * This hook allows you to get a information about groups via the 'mainwp-getgroups' filter. * @link http://codex.mainwp.com/#mainwp-getgroups * * @see \MainWP_Extensions::hookGetGroups */ add_filter('mainwp-getgroups', array(MainWP_Extensions::getClassName(), 'hookGetGroups'), 10, 4); add_action('mainwp_fetchurlsauthed', array(&$this, 'filter_fetchUrlsAuthed'), 10, 7); add_filter('mainwp_fetchurlauthed', array(&$this, 'filter_fetchUrlAuthed'), 10, 5); add_filter('mainwp_getdashboardsites', array(MainWP_Extensions::getClassName(), 'hookGetDashboardSites'), 10, 7); add_filter('mainwp-manager-getextensions', array(MainWP_Extensions::getClassName(), 'hookManagerGetExtensions')); add_action('mainwp_bulkpost_metabox_handle', array($this, 'hookBulkPostMetaboxHandle')); add_action('mainwp_bulkpage_metabox_handle', array($this, 'hookBulkPageMetaboxHandle')); $this->posthandler = new MainWP_Post_Handler(); do_action('mainwp-activated'); MainWP_Post::init(); MainWP_Settings::init(); MainWP_Manage_Backups::init(); MainWP_User::init(); MainWP_Page::init(); MainWP_Themes::init(); MainWP_Plugins::init(); MainWP_Right_Now::init(); MainWP_Setup_Wizard::init(); if (defined('WP_CLI') && WP_CLI) { MainWP_WP_CLI_Command::init(); } //WP-Cron if (defined('DOING_CRON') && DOING_CRON) { if (isset($_GET['mainwp_run']) && !empty($_GET['mainwp_run'])) { add_action('init', array($this, 'cron_active'), PHP_INT_MAX); } } }
public static function renderDashboardBody($websites, $pDashboard, $pScreenLayout) { $opts = get_option('mainwp_opts_showhide_sections', false); $hide_shortcuts = is_array($opts) && isset($opts['welcome_shortcuts']) && $opts['welcome_shortcuts'] == 'hide' ? true : false; ?> <form action="admin-post.php" method="post"> <?php wp_nonce_field('mainwp_tab-general'); ?> <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?> <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?> <input type="hidden" name="action" value="save_howto_testPages_general"/> <div id="mainwp-welocme-bar" class="welcome-panel" style="padding-left: 2em;"> <table id="mainwp-refresh-bar" width="100%"> <tbody> <tr> <td> <div id="mainwp-welocme-bar-top"> <span style="float:right;"> <a style="font-size: 18px;" class="button-hero button mainwp-upgrade-button" id="dashboard_refresh" title="<?php echo MainWP_Right_Now::renderLastUpdate(); ?> "><i class="fa fa-refresh"></i> <?php _e('Sync Data with Child Sites', 'mainwp'); ?> </a> <a style="font-size: 18px;" class="button-hero button-primary button" target="_blank" href="https://extensions.mainwp.com"><i class="fa fa-cart-plus"></i> <?php _e('Get New Extensions', 'mainwp'); ?> </a> </span> <?php $current_wp_id = MainWP_Utility::get_current_wpid(); $website = null; if (!empty($current_wp_id)) { $website = $websites[0]; } $imgfavi = ''; if ($website !== null) { if (get_option('mainwp_use_favicon', 1) == 1) { $favi = MainWP_DB::Instance()->getWebsiteOption($website, 'favi_icon', ''); $favi_url = MainWP_Utility::get_favico_url($favi, $website); $imgfavi = '<img src="' . $favi_url . '" width="16" height="16" style="vertical-align:middle;"/> '; } } if ($website !== null) { if (time() - $website->dtsSync > 60 * 60 * 24) { ?> <h3> <i class="fa fa-flag"></i> <?php _e('Your MainWP Dashboard has not been synced for 24 hours!', 'mainwp'); ?> </h3> <p class="about-description"><?php _e('Click the Sync Data button to get the latest data from child sites.', 'mainwp'); ?> </p> <?php } else { ?> <h3><?php echo sprintf(__('Welcome to %s Dashboard!', 'mainwp'), stripslashes($website->name)); ?> </h3> <p class="about-description"><?php echo sprintf(__('This information is only for %s%s', 'mainwp'), $imgfavi, MainWP_Utility::getNiceURL($website->url, true)); ?> </p> <?php } } else { $sync_status = MainWP_DB::Instance()->getLastSyncStatus(); if ($sync_status === 'not_synced') { ?> <h3> <i class="fa fa-flag"></i> <?php _e('Your MainWP Dashboard has not been synced for 24 hours!', 'mainwp'); ?> </h3> <p class="about-description"><?php _e('Click the Sync Data button to get the latest data from child sites.', 'mainwp'); ?> </p> <?php } else { if ($sync_status === 'all_synced') { ?> <h3><?php echo __('All sites have been synced within the last 24 hours!', 'mainwp'); ?> </h3> <p class="about-description"><?php echo __('Manage your WordPress sites with ease.', 'mainwp'); ?> </p> <?php } else { ?> <h3><i class="fa fa-flag"></i> <?php echo __("Some child sites didn't sync correctly!", 'mainwp'); ?> </h3> <p class="about-description"><?php echo __('Check the Sync Status widget to review sites that have not been synced.', 'mainwp'); ?> </p> <?php } } } ?> </div> <br/> <span style="float: right; margin-right: 1em;"><a id="mainwp-link-showhide-welcome-shortcuts" status="<?php echo $hide_shortcuts ? 'hide' : 'show'; ?> " href="#"><?php echo $hide_shortcuts ? __('Show Shortcuts', 'mainwp') : __('Hide Shortcuts', 'mainwp'); ?> </a></span> <div id="mainwp-welcome-bar-shotcuts" style="clear: both;<?php echo $hide_shortcuts ? 'display: none;' : ''; ?> "> <div class="welcome-panel-column"> <h4><?php _e('Get Started', 'mainwp'); ?> </h4> <ul> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=managesites&do=new"><i class="fa fa-globe"></i> <?php _e('Add New Site', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=ManageGroups"><i class="fa fa-globe"></i> <?php _e('Create Child Site Groups', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=ManageBackupsAddNew"><i class="fa fa-hdd-o"></i> <?php _e('Schedule Backups', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=Settings"><i class="fa fa-cogs"></i> <?php _e('Check MainWP Settings', 'mainwp'); ?> </a></li> </ul> </div> <div class="welcome-panel-column"> <h4><?php _e('Next Steps', 'mainwp'); ?> </h4> <ul> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=PostBulkAdd"><i class="fa fa-file-text"></i> <?php _e('Add Post to Child Site(s)', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=PageBulkAdd"><i class="fa fa-file"></i> <?php _e('Add Page to Child Site(s)', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=PluginsInstall"><i class="fa fa-plug"></i> <?php _e('Add Plugin to Child Site(s)', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=ThemesInstall"><i class="fa fa-paint-brush"></i> <?php _e('Add Theme to Child Site(s)', 'mainwp'); ?> </a></li> </ul> </div> <div class="welcome-panel-column welcome-panel-last"> <h4><?php _e('More Actions', 'mainwp'); ?> </h4> <ul> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=managesites&do=test"><i class="fa fa-globe"></i> <?php _e('Test Connection', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=Extensions"><i class="fa fa-plug"></i> <?php _e('Manage Extensions', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=ServerInformation"><i class="fa fa-server"></i> <?php _e('Check MainWP Requirements', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=DashboardOptions"><i class="fa fa-cogs"></i> <?php _e('Set Your Preferences', 'mainwp'); ?> </a></li> </ul> </div> </div> <div id="dashboard_refresh_statusextra" style="display: none"> <i class="fa fa-spinner fa-pulse"></i></div> </div> <div id="mainwp_dashboard_refresh_status"></div> </td></tr></tbody> </table> </div> <div id="mainwp_main_errors" class="mainwp_error"></div> </form> <div id="mainwp-dashboard-info-box"> <?php if (empty($current_wp_id) && MainWP_Twitter::enabledTwitterMessages()) { $filter = array('upgrade_everything', 'upgrade_all_wp_core', 'upgrade_all_plugins', 'upgrade_all_themes'); foreach ($filter as $what) { $twitters = MainWP_Twitter::getTwitterNotice($what); if (is_array($twitters)) { foreach ($twitters as $timeid => $twit_mess) { $sendText = ""; if (!empty($twit_mess)) { if (!empty($sendText)) { $sendText = MainWP_Twitter::getTwitToSend($what, $timeid); ?> <div class="mainwp-tips mainwp_info-box-blue twitter"> <span class="mainwp-tip" twit-what="<?php echo $what; ?> " twit-id="<?php echo $timeid; ?> "><?php echo $twit_mess; ?> </span> <?php MainWP_Twitter::genTwitterButton($sendText); ?> <span><a href="#" class="mainwp-dismiss-twit"><i class="fa fa-times-circle"></i> <?php _e('Dismiss', 'mainwp'); ?> </a></span></div> <?php } } } } } ?> <?php } ?> </div> <div id="dashboard-widgets-wrap"> <?php require_once ABSPATH . 'wp-admin/includes/dashboard.php'; wp_dashboard(); ?> <div class="clear"></div> </div><!-- dashboard-widgets-wrap --> <?php }
/** * List information about theme upgrades * * ## OPTIONS * * [<websiteid>] * : The id (or ids, comma separated) of the child sites that need to be listed/upgraded, when omitted all childsites are used. * * [--list] * : Get a list of themes with available upgrades * * [--upgrade=<theme>] * : Upgrade the themes * * [--upgrade-all] * : Upgrade all themes * * ## EXAMPLES * * wp mainwp theme 2,5 --list * wp mainwp theme --list * wp mainwp theme 2,5 --upgrade-all * wp mainwp theme 2,5 --upgrade=twentysixteen * * @synopsis [<websiteid>] [--list] [--upgrade=<theme>] [--upgrade-all] */ public function theme($args, $assoc_args) { $sites = array(); if (count($args) > 0) { $args_exploded = explode(',', $args[0]); foreach ($args_exploded as $arg) { if (!is_numeric(trim($arg))) { WP_CLI::error('Child site ids should be numeric.'); } $sites[] = trim($arg); } } if (isset($assoc_args['list'])) { $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); $userExtension = MainWP_DB::Instance()->getUserExtension(); $websites_to_upgrade = array(); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if (count($sites) > 0 && !in_array($website->id, $sites)) { continue; } $theme_upgrades = json_decode($website->theme_upgrades, true); if (is_array($theme_upgrades)) { $ignored_themes = json_decode($website->ignored_themes, true); if (is_array($ignored_themes)) { $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes); } $ignored_themes = json_decode($userExtension->ignored_themes, true); if (is_array($ignored_themes)) { $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes); } $tmp = array(); foreach ($theme_upgrades as $theme_upgrade) { $tmp[] = array('name' => $theme_upgrade['update']['theme'], 'version' => $theme_upgrade['Version'], 'new_version' => $theme_upgrade['update']['new_version']); } $websites_to_upgrade[] = array('id' => $website->id, 'name' => $website->name, 'themes' => $tmp); } } $idLength = strlen('id'); $nameLength = strlen('name'); $themeLength = strlen('theme'); $oldVersionLength = strlen('version'); $newVersionLength = strlen('new version'); foreach ($websites_to_upgrade as $website_to_upgrade) { if ($idLength < strlen($website_to_upgrade['id'])) { $idLength = strlen($website_to_upgrade['id']); } if ($nameLength < strlen($website_to_upgrade['name'])) { $nameLength = strlen($website_to_upgrade['name']); } foreach ($website_to_upgrade['themes'] as $theme_to_upgrade) { if ($themeLength < strlen($theme_to_upgrade['name'])) { $themeLength = strlen($theme_to_upgrade['name']); } if ($oldVersionLength < strlen($theme_to_upgrade['version'])) { $oldVersionLength = strlen($theme_to_upgrade['version']); } if ($newVersionLength < strlen($theme_to_upgrade['new_version'])) { $newVersionLength = strlen($theme_to_upgrade['new_version']); } } } WP_CLI::line(sprintf("+%'--" . ($idLength + 2) . "s+%'--" . ($nameLength + 2) . "s+%'--" . ($themeLength + 2) . "s+%'--" . ($oldVersionLength + 2) . "s+%'--" . ($newVersionLength + 2) . "s+", '', '', '', '', '')); WP_CLI::line(sprintf("| %-" . $idLength . "s | %-" . $nameLength . "s | %-" . $themeLength . "s | %-" . $oldVersionLength . "s | %-" . $newVersionLength . "s |", 'id', 'name', 'theme', 'version', 'new version')); WP_CLI::line(sprintf("+%'--" . ($idLength + 2) . "s+%'--" . ($nameLength + 2) . "s+%'--" . ($themeLength + 2) . "s+%'--" . ($oldVersionLength + 2) . "s+%'--" . ($newVersionLength + 2) . "s+", '', '', '', '', '')); foreach ($websites_to_upgrade as $website_to_upgrade) { if ($idLength < strlen($website_to_upgrade['id'])) { $idLength = strlen($website_to_upgrade['id']); } if ($nameLength < strlen($website_to_upgrade['name'])) { $nameLength = strlen($website_to_upgrade['name']); } $i = 0; foreach ($website_to_upgrade['themes'] as $theme_to_upgrade) { if ($i == 0) { WP_CLI::line(sprintf("| %-" . $idLength . "s | %-" . $nameLength . "s | %-" . $themeLength . "s | %-" . $oldVersionLength . "s | %-" . $newVersionLength . "s |", $website_to_upgrade['id'], $website_to_upgrade['name'], $theme_to_upgrade['name'], $theme_to_upgrade['version'], $theme_to_upgrade['new_version'])); } else { WP_CLI::line(sprintf("| %-" . $idLength . "s | %-" . $nameLength . "s | %-" . $themeLength . "s | %-" . $oldVersionLength . "s | %-" . $newVersionLength . "s |", '', '', $theme_to_upgrade['name'], $theme_to_upgrade['version'], $theme_to_upgrade['new_version'])); } $i++; } } WP_CLI::line(sprintf("+%'--" . ($idLength + 2) . "s+%'--" . ($nameLength + 2) . "s+%'--" . ($themeLength + 2) . "s+%'--" . ($oldVersionLength + 2) . "s+%'--" . ($newVersionLength + 2) . "s+", '', '', '', '', '')); } else { if (isset($assoc_args['upgrade']) || isset($assoc_args['upgrade-all'])) { //slugs to upgrade $themeSlugs = array(); if (isset($assoc_args['upgrade'])) { $themeSlugs = explode(',', $assoc_args['upgrade']); } $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); $userExtension = MainWP_DB::Instance()->getUserExtension(); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if (count($sites) > 0 && !in_array($website->id, $sites)) { continue; } $theme_upgrades = json_decode($website->theme_upgrades, true); if (is_array($theme_upgrades)) { $ignored_themes = json_decode($website->ignored_themes, true); if (is_array($ignored_themes)) { $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes); } $ignored_themes = json_decode($userExtension->ignored_themes, true); if (is_array($ignored_themes)) { $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes); } $tmp = array(); foreach ($theme_upgrades as $key => $theme_upgrade) { if (count($themeSlugs) > 0 && !in_array($theme_upgrade['update']['slug'], $themeSlugs)) { continue; } $tmp[] = $key; } if (count($tmp) == 0) { WP_CLI::line('No available theme upgrades for ' . $website->name); continue; } WP_CLI::line('Upgrading ' . count($tmp) . ' themes for ' . $website->name); try { MainWP_Right_Now::upgradePluginThemeTranslation($website->id, 'theme', implode(',', $tmp)); WP_CLI::success('Upgrades completed'); } catch (Exception $e) { WP_CLI::error('Upgrades failed: ' . MainWP_Error_Helper::getConsoleErrorMessage($e)); } } } } } }
function mainwp_syncerrors_dismiss() { $this->secure_request('mainwp_syncerrors_dismiss'); try { die(json_encode(array('result' => MainWP_Right_Now::dismissSyncErrors()))); } catch (Exception $e) { die(json_encode(array('error' => $e->getMessage()))); } }
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'); } }