public static function render() { ?> <div id="rightnow_list" xmlns="http://www.w3.org/1999/html"><?php MainWPRightNow::renderSites(); ?> </div> <?php }
function mainwp_syncerrors_dismiss() { $this->secure_request('mainwp_syncerrors_dismiss'); try { die(json_encode(array('result' => MainWPRightNow::dismissSyncErrors()))); } catch (Exception $e) { die(json_encode(array('error' => $e->getMessage()))); } }
public function __construct($mainwp_plugin_file) { MainWPSystem::$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); $this->apiStatus = MainWPAPISettings::testAPIs('main'); 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()); MainWPUtility::update_option('mainwp_reset_user_cookies', array()); //delete_option('mainwp_api_sslVerifyCertificate'); } MainWPUtility::update_option('mainwp_plugin_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(MainWPExtensions::getClassName(), 'noSSLFilterExtensionUpgrade'), 99, 2); } MainWPExtensions::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 MainWPMetaBoxes(); MainWPMain::get(); //init main dashboard MainWPManageSites::init(); new MainWPHooks(); //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('MainWPPost', '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); //Remove the pages from the menu which I use in AJAX add_action('admin_menu', array(&$this, 'admin_menu')); //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')); MainWPInstallBulk::init(); do_action('mainwp_cronload_action'); //Cron every 5 minutes add_action('mainwp_cronofflinecheck_action', array($this, 'mainwp_cronofflinecheck_action')); 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_cronconflicts_action', array($this, 'mainwp_cronconflicts_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('MainWPUtility', 'getCronSchedules')); $useWPCron = get_option('mainwp_wp_cron') === false || get_option('mainwp_wp_cron') == 1; if (($sched = wp_next_scheduled('mainwp_cronofflinecheck_action')) == false) { if ($useWPCron) { wp_schedule_event(time(), '5minutely', 'mainwp_cronofflinecheck_action'); } } else { if (!$useWPCron) { 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_cronconflicts_action')) == false) { if ($useWPCron) { wp_schedule_event(time(), 'twicedaily', 'mainwp_cronconflicts_action'); } } else { if (!$useWPCron) { wp_unschedule_event($sched, 'mainwp_cronconflicts_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('plugin_action_links_' . $this->plugin_slug, array(&$this, 'plugin_action_links')); 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(MainWPExtensions::getClassName(), 'isExtensionEnabled')); add_filter('mainwp-getsites', array(MainWPExtensions::getClassName(), 'hookGetSites'), 10, 4); add_filter('mainwp-getdbsites', array(MainWPExtensions::getClassName(), 'hookGetDBSites'), 10, 5); add_filter('mainwp-getgroups', array(MainWPExtensions::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(MainWPExtensions::getClassName(), 'hookGetDashboardSites'), 10, 7); add_filter('mainwp-manager-getextensions', array(MainWPExtensions::getClassName(), 'hookManagerGetExtensions')); add_action('mainwp_bulkpost_metabox_handle', array($this, 'hookBulkPostMetaboxHandle')); add_action('mainwp_bulkpage_metabox_handle', array($this, 'hookBulkPageMetaboxHandle')); $this->posthandler = new MainWPPostHandler(); do_action('mainwp-activated'); MainWPPost::init(); MainWPSettings::init(); MainWPManageBackups::init(); MainWPUser::init(); MainWPPage::init(); MainWPThemes::init(); MainWPPlugins::init(); MainWPRightNow::init(); }
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++, MainWPRightNow::getName(), array(MainWPRightNow::getClassName(), 'render'), self::$page, 'normal', 'core'); if (mainwp_current_user_can("dashboard", "manage_posts")) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPRecentPosts::getName(), array(MainWPRecentPosts::getClassName(), 'render'), self::$page, 'normal', 'core'); } if (mainwp_current_user_can("dashboard", "manage_pages")) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPRecentPages::getName(), array(MainWPRecentPages::getClassName(), 'render'), self::$page, 'normal', 'core'); } add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPShortcuts::getName(), array(MainWPShortcuts::getClassName(), 'render'), self::$page, 'normal', 'core'); if (mainwp_current_user_can("dashboard", "manage_security_issues")) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPSecurityIssues::getMetaboxName(), array(MainWPSecurityIssues::getClassName(), 'renderMetabox'), self::$page, 'normal', 'core'); } if (get_option('mainwp_seo') == 1) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPManageSites::getMetaboxName(), array(MainWPManageSites::getClassName(), 'renderMetabox'), self::$page, 'normal', 'core'); } global $mainwpUseExternalPrimaryBackupsMethod; if (empty($mainwpUseExternalPrimaryBackupsMethod)) { add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPManageBackups::getMetaboxName(), array(MainWPManageBackups::getClassName(), 'renderMetabox'), self::$page, 'normal', 'core'); } add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPWidgetPlugins::getName(), array(MainWPWidgetPlugins::getClassName(), 'render'), self::$page, 'normal', 'core'); add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPWidgetThemes::getName(), array(MainWPWidgetThemes::getClassName(), 'render'), self::$page, 'normal', 'core'); add_meta_box(self::$page . '-metaboxes-contentbox-' . $i++, MainWPNotes::getName(), array(MainWPNotes::getClassName(), 'render'), self::$page, 'normal', 'core'); $extMetaBoxs = MainWPSystem::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'); } }
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 MainWPRightNow::renderLastUpdate(); ?> "><?php _e('<i class="fa fa-refresh"></i> Sync Data', 'mainwp'); ?> </a> <a style="font-size: 18px;" class="button-hero button-primary button" target="_blank" href="https://extensions.mainwp.com"><?php _e('<i class="fa fa-cart-plus"></i> Get New Extensions', 'mainwp'); ?> </a> </span> <?php $current_wp_id = MainWPUtility::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 = MainWPDB::Instance()->getWebsiteOption($website, 'favi_icon', ""); $favi_url = MainWPUtility::get_favico_url($favi, $website); $imgfavi = '<img src="' . $favi_url . '" width="16" height="16" style="vertical-align:middle;"/> '; } } if (time() - ($website == null ? MainWPDB::Instance()->getFirstSyncedSite() : $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 $website == null ? __('Welcome to Your MainWP Dashboard!', 'mainwp') : sprintf(__('Welcome to %s Dashboard!', 'mainwp'), stripslashes($website->name)); ?> </h3> <p class="about-description"><?php echo $website == null ? __('Manage your WordPress sites with ease.', 'mainwp') : sprintf(__('This information is only for %s%s', 'mainwp'), $imgfavi, MainWPUtility::getNiceURL($website->url, true)); ?> </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> <?php if (empty($current_wp_id) && MainWPTwitter::enabledTwitterMessages()) { $filter = array('upgrade_everything', 'upgrade_all_wp_core', 'upgrade_all_plugins', 'upgrade_all_themes'); foreach ($filter as $what) { $twitters = MainWPTwitter::getTwitterNotice($what); if (is_array($twitters)) { foreach ($twitters as $timeid => $twit_mess) { if (!empty($twit_mess)) { $sendText = MainWPTwitter::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 MainWPTwitter::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 id="dashboard-widgets-wrap"> <?php require_once ABSPATH . 'wp-admin/includes/dashboard.php'; wp_dashboard(); ?> <div class="clear"></div> </div><!-- dashboard-widgets-wrap --> <?php }
public static function renderDashboardBody($websites, $pDashboard, $pScreenLayout) { ?> <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 class="postbox" style="padding-top: 1em;"> <table id="mainwp-refresh-bar" width="100%"> <tbody><tr> <?php $current_wp_id = MainWPUtility::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 = MainWPDB::Instance()->getWebsiteOption($website, 'favi_icon', ""); $favi_url = MainWPUtility::get_favico_url($favi, $website); $imgfavi = '<img src="' . $favi_url . '" width="16" height="16" style="vertical-align:middle;"/> '; } } if (time() - ($website == null ? MainWPDB::Instance()->getFirstSyncedSite() : $website->dtsSync) > 60 * 60 * 24) { ?> <td id="mainwp-welcome-bar" width="47%" style="padding-left: 1em;"> <span class="mainwp-reminder"><?php _e('Your MainWP Dashboard has not been synced for 24 hours! Click the Sync Data button to get the latest data from child sites.', 'mainwp'); ?> </span><br/> </td> <?php } else { ?> <td id="mainwp-welcome-bar" width="47%" style="padding-left: 1em;"> <span style="font-size: 24px"><?php echo $website == null ? __('Welcome to Your MainWP Dashboard!', 'mainwp') : sprintf(__('Welcome to %s Dashboard!', 'mainwp'), stripslashes($website->name)); ?> </span><br/> <span style="font-style: italic; font-size: 14px;"><?php echo $website == null ? __('Manage your WordPress sites with ease.', 'mainwp') : sprintf(__('This information is only for %s%s', 'mainwp'), $imgfavi, MainWPUtility::getNiceURL($website->url, true)); ?> </span> </td> <?php } ?> <td id="mainwp-refresh-bar-buttons"> <a class="button-hero button mainwp-upgrade-button" id="dashboard_refresh" title="<?php echo MainWPRightNow::renderLastUpdate(); ?> "><?php _e('<i class="fa fa-refresh"></i> Sync Data', 'mainwp'); ?> </a> <a class="button-hero button-primary button mainwp-addsite-button" href="admin.php?page=managesites&do=new"><?php _e('<i class="fa fa-plus"></i> Add New Site', 'mainwp'); ?> </a> <a class="button-hero button-primary button mainwp-button-red" target="_blank" href="https://extensions.mainwp.com"><?php _e('<i class="fa fa-cart-plus"></i> Get New Extensions', 'mainwp'); ?> </a> </td> <div id="dashboard_refresh_statusextra" style="display: none"> <i class="fa fa-spinner fa-pulse"></i> </div> </tr></tbody> </table> <div id="mainwp_dashboard_refresh_status"></div> </div> <div id="mainwp_main_errors" class="mainwp_error"></div> </form> <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 }