public function sync($args, $assoc_args) { $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); WP_CLI::line('Syncing ' . MainWP_DB::num_rows($websites) . ' sites'); $warnings = 0; $errors = 0; while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { WP_CLI::line(' -> ' . $website->name . ' (' . $website->url . ')'); try { if (MainWP_Sync::syncSite($website)) { WP_CLI::success(' Sync succeeded'); } else { WP_CLI::warning(' Sync failed'); $warnings++; } } catch (Exception $e) { WP_CLI::error(' Sync failed'); $errors++; } } @MainWP_DB::free_result($websites); if ($errors > 0) { WP_CLI::error('Sync completed with errors'); } else { if ($warnings > 0) { WP_CLI::warning('Sync completed with warnings'); } else { WP_CLI::success('Sync completed'); } } }
public static function render() { self::renderHeader(''); ?> <a class="button-primary mwp-child-scan" href="#"><?php _e('Scan', 'mainwp'); ?> </a> <?php $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); if (!$websites) { echo __('<p>No websites to scan.</p>', 'mainwp'); } else { ?> <table id="mwp_child_scan_childsites"> <tr><th>Child</th><th>Status</th></tr> <?php while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { $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->sync_errors == '') { echo '<tr siteid="' . $website->id . '"><td title="' . $website->url . '">' . $imgfavi . ' ' . stripslashes($website->name) . ':</td><td></td></tr>'; } else { echo '<tr><td title="' . $website->url . '">' . $imgfavi . ' ' . stripslashes($website->name) . ':</td><td>Sync errors</td></tr>'; } } @MainWP_DB::free_result($websites); ?> </table> <?php } ?> <?php self::renderFooter(''); }
public static function renderTest() { if (!mainwp_current_user_can('dashboard', 'test_connection')) { mainwp_do_not_have_permissions(__('test connection', 'mainwp')); return; } ?> <div id="mainwp_managesites_test_errors" class="mainwp_error error"></div> <div id="mainwp_managesites_test_message" class="mainwp_updated updated"></div> <form method="POST" action="" enctype="multipart/form-data" id="mainwp_testconnection_form"> <div class="mainwp_info-box-blue"> <span><?php _e('The Test Connection feature is specifically testing what your Dashboard can "see" and what your Dashboard "sees" and what my Dashboard "sees" or what your browser "sees" can be completely different things.', 'mainwp'); ?> </span> </div> <div class="postbox"> <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php _e('Test a Site Connection', 'mainwp'); ?> </span></h3> <div class="inside"> <table class="form-table"> <tr class="form-field form-required"> <th scope="row"><?php _e('Site URL:', 'mainwp'); ?> </th> <td> <input type="text" id="mainwp_managesites_test_wpurl" name="mainwp_managesites_add_wpurl" value="<?php if (isset($_REQUEST['site'])) { echo $_REQUEST['site']; } ?> " autocompletelist="mainwp-test-sites" class="mainwp_autocomplete" /><span class="mainwp-form_hint">Proper Format: <strong>http://address.com/</strong> or <strong>http://www.address.com/</strong></span> <datalist id="mainwp-test-sites"> <?php $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { echo '<option>' . $website->url . '</option>'; } @MainWP_DB::free_result($websites); ?> </datalist> <br/><em><?php _e('Please only use the domain URL, do not add /wp-admin.', 'mainwp'); ?> </em> </td> </tr> </table> </div> </div> <div class="postbox"> <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php _e('Advanced Options', 'mainwp'); ?> </span></h3> <div class="inside"> <table class="form-table"> <tr class="form-field form-required"> <th scope="row"><?php _e('Verify Certificate', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip(__('Verify the childs SSL certificate. This should be disabled if you are using out of date or self signed certificates.', 'mainwp')); ?> </th> <td> <select id="mainwp_managesites_test_verifycertificate" name="mainwp_managesites_test_verifycertificate"> <option selected value="1"><?php _e('Yes', 'mainwp'); ?> </option> <option value="0"><?php _e('No', 'mainwp'); ?> </option> <option value="2"><?php _e('Use Global Setting', 'mainwp'); ?> </option> </select> <em>(<?php _e('Default: Yes', 'mainwp'); ?> )</em> </td> </tr> <tr class="form-field form-required"> <th scope="row"><?php _e('SSL Version', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip(__('Prefered SSL Version to connect to your site.', 'mainwp')); ?> </th> <td> <select id="mainwp_managesites_test_ssl_version" name="mainwp_managesites_test_ssl_version"> <option selected value="auto"><?php _e('Auto detect', 'mainwp'); ?> </option> <option value="1.x"><?php _e('TLS v1.x', 'mainwp'); ?> </option> <option value="2"><?php _e('SSL v2', 'mainwp'); ?> </option> <option value="3"><?php _e('SSL v3', 'mainwp'); ?> </option> <option value="1.0"><?php _e('TLS v1.0', 'mainwp'); ?> </option> <option value="1.1"><?php _e('TLS v1.1', 'mainwp'); ?> </option> <option value="1.2"><?php _e('TLS v1.2', 'mainwp'); ?> </option> </select> <em>(<?php _e('Default: Auto detect', 'mainwp'); ?> )</em> </td> </tr> <!-- fake fields are a workaround for chrome autofill getting the wrong fields --> <input style="display:none" type="text" name="fakeusernameremembered"/> <input style="display:none" type="password" name="fakepasswordremembered"/> <tr> <td colspan="2"><div class="mainwp_info-box"><?php _e('If your Child Site is protected with HTTP basic authentication, please set the username and password for authentication here.', 'mainwp'); ?> </div></td> </tr> <tr class="form-field form-required"> <th scope="row"><?php _e('HTTP username: '******'mainwp'); ?> </th> <td><input type="text" id="mainwp_managesites_test_http_user" style="width: 350px;" name="mainwp_managesites_test_http_user" value="" class=""/></td> </tr> <tr class="form-field form-required"> <th scope="row"><?php _e('HTTP password: '******'mainwp'); ?> </th> <td><input type="password" id="mainwp_managesites_test_http_pass" style="width: 350px;" name="mainwp_managesites_test_http_pass" value="" class=""/></td> </tr> </table> </form> </div> </div> <p class="submit"><input type="button" name="mainwp_managesites_test" id="mainwp_managesites_test" class="button-primary button button-hero" value="<?php _e('Test Connection', 'mainwp'); ?> "/></p> <?php }
/** * Sync Data with Child Sites * * ## OPTIONS * * [<websiteid>] * : The id (or ids, comma separated) of the child sites that need to be synced. * * [--all] * : If set, all child sites will be synced. * * ## EXAMPLES * * wp mainwp sync 2,5 * wp mainwp sync --all * * @synopsis [<websiteid>] [--all] */ public function sync($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 (count($sites) == 0 && !isset($assoc_args['all'])) { WP_CLI::error('Please specify one or more child sites, or use --all.'); } $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); WP_CLI::line('Sync started'); $warnings = 0; $errors = 0; while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if (count($sites) > 0 && !in_array($website->id, $sites)) { continue; } WP_CLI::line(' -> ' . $website->name . ' (' . $website->url . ')'); try { if (MainWP_Sync::syncSite($website)) { WP_CLI::success(' Sync succeeded'); } else { WP_CLI::warning(' Sync failed'); $warnings++; } } catch (Exception $e) { WP_CLI::error(' Sync failed: ' . MainWP_Error_Helper::getConsoleErrorMessage($e)); $errors++; } } @MainWP_DB::free_result($websites); if ($errors > 0) { WP_CLI::error('Sync completed with errors'); } else { if ($warnings > 0) { WP_CLI::warning('Sync completed with warnings'); } else { WP_CLI::success('Sync completed'); } } }
public static function syncSite(&$pWebsite = null, $pForceFetch = false, $pAllowDisconnect = true) { if ($pWebsite == null) { return false; } $userExtension = MainWP_DB::Instance()->getUserExtensionByUserId($pWebsite->userid); if ($userExtension == null) { return false; } MainWP_Utility::endSession(); try { $pluginDir = $pWebsite->pluginDir; if ($pluginDir == '') { $pluginDir = $userExtension->pluginDir; } $cloneEnabled = apply_filters('mainwp_clone_enabled', false); $cloneSites = array(); if ($cloneEnabled) { $disallowedCloneSites = get_option('mainwp_clone_disallowedsites'); if ($disallowedCloneSites === false) { $disallowedCloneSites = array(); } $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); if ($websites) { while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if (in_array($website->id, $disallowedCloneSites)) { continue; } if ($website->id == $pWebsite->id) { continue; } $cloneSites[$website->id] = array('name' => $website->name, 'url' => $website->url, 'extauth' => $website->extauth, 'size' => $website->totalsize); } @MainWP_DB::free_result($websites); } } $pluginConflicts = get_option('mainwp_pluginConflicts'); if ($pluginConflicts !== false) { $pluginConflicts = array_keys($pluginConflicts); } $themeConflicts = get_option('mainwp_themeConflicts'); if ($themeConflicts !== false) { $themeConflicts = array_keys($themeConflicts); } $othersData = apply_filters('mainwp-sync-others-data', array(), $pWebsite); $information = MainWP_Utility::fetchUrlAuthed($pWebsite, 'stats', array('optimize' => get_option('mainwp_optimize') == 1 ? 1 : 0, 'heatMap' => MainWP_Extensions::isExtensionAvailable('mainwp-heatmap-extension') ? $userExtension->heatMap : 0, 'pluginDir' => $pluginDir, 'cloneSites' => !$cloneEnabled ? 0 : urlencode(json_encode($cloneSites)), 'pluginConflicts' => json_encode($pluginConflicts), 'themeConflicts' => json_encode($themeConflicts), 'othersData' => json_encode($othersData), 'server' => get_admin_url(), 'numberdaysOutdatePluginTheme' => get_option('mainwp_numberdays_Outdate_Plugin_Theme', 365)), true, $pForceFetch); $return = self::syncInformationArray($pWebsite, $information, '', 1, false, $pAllowDisconnect); return $return; } catch (MainWP_Exception $e) { $sync_errors = ''; $offline_check_result = 1; if ($e->getMessage() == 'HTTPERROR') { $sync_errors = __('HTTP error', 'mainwp') . ($e->getMessageExtra() != null ? ' - ' . $e->getMessageExtra() : ''); $offline_check_result = -1; } else { if ($e->getMessage() == 'NOMAINWP') { $sync_errors = __('MainWP not detected', 'mainwp'); $offline_check_result = 1; } } return self::syncInformationArray($pWebsite, $information, $sync_errors, $offline_check_result, true, $pAllowDisconnect); } }
/** * @param string $pluginFile Extension plugin file to verify * @param string $key The child-key * @param int $websiteid The id of the child-site you wish to retrieve * @param bool $for_manager * * @return array|bool An array of arrays, the inner-array contains the id/url/name/totalsize of the website. False when something goes wrong. */ public static function hookGetSites($pluginFile, $key, $websiteid = null, $for_manager = false) { if (!self::hookVerify($pluginFile, $key)) { return false; } if ($for_manager && (!defined('MWP_TEAMCONTROL_PLUGIN_SLUG') || !mainwp_current_user_can('extension', dirname(MWP_TEAMCONTROL_PLUGIN_SLUG)))) { return false; } if (isset($websiteid) && $websiteid != null) { $website = MainWP_DB::Instance()->getWebsiteById($websiteid); if (!MainWP_Utility::can_edit_website($website)) { return false; } if (!mainwp_current_user_can('site', $websiteid)) { return false; } return array(array('id' => $websiteid, 'url' => MainWP_Utility::getNiceURL($website->url, true), 'name' => $website->name, 'totalsize' => $website->totalsize)); } $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser(false, null, 'wp.url', false, false, null, $for_manager)); $output = array(); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { $output[] = array('id' => $website->id, 'url' => MainWP_Utility::getNiceURL($website->url, true), 'name' => $website->name, 'totalsize' => $website->totalsize); } @MainWP_DB::free_result($websites); return $output; }
public static function checkWebsite() { if (!isset($_POST['websiteid'])) { //Check all websites $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); } else { $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsiteById($_POST['websiteid'])); if (!$websites) { return 0; } } $output = array(); if (!$websites) { $emailOutput = ''; } else { $emailOutput = null; } $errors = false; while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if (self::performCheck($website, true, $emailOutput)) { $output[$website->id] = 1; } else { $output[$website->id] = -1; $errors = true; } } @MainWP_DB::free_result($websites); if ($emailOutput != null) { if ($errors) { $emailOutput .= '<br /><br />Please take a look at the issues and make sure everything is ok.'; } $email = MainWP_DB::Instance()->getUserNotificationEmail($website->userid); wp_mail($email, $errors ? 'Down Time Alert - MainWP' : 'Up Time Alert - MainWP', MainWP_Utility::formatEmail($email, $emailOutput), array('From: "' . get_option('admin_email') . '" <' . get_option('admin_email') . '>', 'content-type: text/html')); } return array('result' => $output); }
public static function posting() { //Posts the saved sites ?> <div class="wrap"> <h2>New Post</h2> <?php do_action('mainwp_bulkpost_before_post', $_GET['id']); $skip_post = false; if (isset($_GET['id'])) { if ('yes' == get_post_meta($_GET['id'], '_mainwp_skip_posting', true)) { $skip_post = true; wp_delete_post($_GET['id'], true); } } if (!$skip_post) { if (isset($_GET['id'])) { $id = $_GET['id']; $post = get_post($id); if ($post) { // die('<pre>'.print_r($post, 1).'</pre>'); $selected_by = get_post_meta($id, '_selected_by', true); $selected_sites = unserialize(base64_decode(get_post_meta($id, '_selected_sites', true))); $selected_groups = unserialize(base64_decode(get_post_meta($id, '_selected_groups', true))); /** @deprecated */ $post_category = base64_decode(get_post_meta($id, '_categories', true)); $post_tags = base64_decode(get_post_meta($id, '_tags', true)); $post_slug = base64_decode(get_post_meta($id, '_slug', true)); $post_custom = get_post_custom($id); // if (isset($post_custom['_tags'])) $post_custom['_tags'] = base64_decode(trim($post_custom['_tags'])); include_once ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'post-thumbnail-template.php'; $post_featured_image = get_post_thumbnail_id($id); $mainwp_upload_dir = wp_upload_dir(); $new_post = array('post_title' => $post->post_title, 'post_content' => $post->post_content, 'post_status' => $post->post_status, 'post_date' => $post->post_date, 'post_date_gmt' => $post->post_date_gmt, 'post_tags' => $post_tags, 'post_name' => $post_slug, 'post_excerpt' => $post->post_excerpt, 'comment_status' => $post->comment_status, 'ping_status' => $post->ping_status, 'id_spin' => $post->ID); if ($post_featured_image != null) { //Featured image is set, retrieve URL $img = wp_get_attachment_image_src($post_featured_image, 'full'); $post_featured_image = $img[0]; } $dbwebsites = array(); if ($selected_by == 'site') { //Get all selected websites foreach ($selected_sites as $k) { if (MainWP_Utility::ctype_digit($k)) { $website = MainWP_DB::Instance()->getWebsiteById($k); $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey')); } } } else { //Get all websites from the selected groups foreach ($selected_groups as $k) { if (MainWP_Utility::ctype_digit($k)) { $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($k)); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if ($website->sync_errors != '') { continue; } $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey')); } @MainWP_DB::free_result($websites); } } } $output = new stdClass(); $output->ok = array(); $output->errors = array(); $startTime = time(); if (count($dbwebsites) > 0) { $post_data = array('new_post' => base64_encode(serialize($new_post)), 'post_custom' => base64_encode(serialize($post_custom)), 'post_category' => base64_encode($post_category), 'post_featured_image' => base64_encode($post_featured_image), 'mainwp_upload_dir' => base64_encode(serialize($mainwp_upload_dir))); MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'newpost', $post_data, array(MainWP_Bulk_Add::getClassName(), 'PostingBulk_handler'), $output); } $failed_posts = array(); foreach ($dbwebsites as $website) { if ($output->ok[$website->id] == 1 && isset($output->added_id[$website->id])) { do_action('mainwp-post-posting-post', $website, $output->added_id[$website->id], isset($output->link[$website->id]) ? $output->link[$website->id] : null); do_action('mainwp-bulkposting-done', $post, $website, $output); } else { $failed_posts[] = $website->id; } } $del_post = true; $saved_draft = get_post_meta($id, '_saved_as_draft', true); if ($saved_draft == 'yes') { if (count($failed_posts) > 0) { $del_post = false; update_post_meta($post->ID, '_selected_sites', base64_encode(serialize($failed_posts))); update_post_meta($post->ID, '_selected_groups', ''); wp_update_post(array('ID' => $id, 'post_status' => 'draft')); } } if ($del_post) { wp_delete_post($id, true); } $countSites = 0; $countRealItems = 0; foreach ($dbwebsites as $website) { if (isset($output->ok[$website->id]) && $output->ok[$website->id] == 1) { $countSites++; $countRealItems++; } } if (!empty($countSites)) { $seconds = time() - $startTime; MainWP_Twitter::updateTwitterInfo('new_post', $countSites, $seconds, $countRealItems, $startTime, 1); } if (MainWP_Twitter::enabledTwitterMessages()) { $twitters = MainWP_Twitter::getTwitterNotice('new_post'); if (is_array($twitters)) { foreach ($twitters as $timeid => $twit_mess) { if (!empty($twit_mess)) { $sendText = MainWP_Twitter::getTwitToSend('new_post', $timeid); ?> <div class="mainwp-tips mainwp_info-box-blue twitter"> <span class="mainwp-tip" twit-what="new_post" 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 } } } } ?> <div id="message" class="updated"> <?php foreach ($dbwebsites as $website) { ?> <p> <a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a> : <?php echo isset($output->ok[$website->id]) && $output->ok[$website->id] == 1 ? 'New post created. ' . '<a href="' . $output->link[$website->id] . '" target="_blank">View Post</a>' : 'ERROR: ' . $output->errors[$website->id]; ?> </p> <?php } ?> </div> <?php } // if ($post) } else { ?> <div class="error below-h2"> <p> <strong><?php _e('ERROR', 'mainwp'); ?> </strong>: <?php _e('An undefined error occured.', 'mainwp'); ?> </p> </div> <?php } } // no skip posting ?> <br/> <a href="<?php echo get_admin_url(); ?> admin.php?page=PostBulkAdd" class="add-new-h2" target="_top"><?php _e('Add New', 'mainwp'); ?> </a> <a href="<?php echo get_admin_url(); ?> admin.php?page=mainwp_tab" class="add-new-h2" target="_top"><?php _e('Return to Dashboard', 'mainwp'); ?> </a> </div> <?php }
public static function doImport() { if (isset($_POST['select_by'])) { $selected_sites = array(); if (isset($_POST['selected_sites']) && is_array($_POST['selected_sites'])) { foreach ($_POST['selected_sites'] as $selected) { $selected_sites[] = $selected; } } $selected_groups = array(); if (isset($_POST['selected_groups']) && is_array($_POST['selected_groups'])) { foreach ($_POST['selected_groups'] as $selected) { $selected_groups[] = $selected; } } } $user_to_add = array('user_pass' => $_POST['pass1'], 'user_login' => $_POST['user_login'], 'user_url' => $_POST['url'], 'user_email' => $_POST['email'], 'first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'role' => $_POST['role']); $ret = array(); $dbwebsites = array(); $not_valid = array(); $error_sites = ''; if ($_POST['select_by'] == 'site') { //Get all selected websites foreach ($selected_sites as $url) { if (!empty($url)) { $website = MainWP_DB::Instance()->getWebsitesByUrl($url); if ($website) { $dbwebsites[$website[0]->id] = MainWP_Utility::mapSite($website[0], array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey')); } else { $not_valid[] = __("Error - The website doesn't exist in the Network.", 'mainwp') . " " . $url; $error_sites .= $url . ';'; } } } } else { //Get all websites from the selected groups foreach ($selected_groups as $group) { if (MainWP_DB::Instance()->getGroupsByName($group)) { $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupName($group)); if ($websites) { while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey')); } @MainWP_DB::free_result($websites); } else { $not_valid[] = __('Error - These are not websites in the group. ', 'mainwp') . $group; $error_sites .= $group . ';'; } } else { $not_valid[] = __("Error - The group doesn't exist in the Network. ", 'mainwp') . $group; $error_sites .= $group . ';'; } } } if (count($dbwebsites) > 0) { $post_data = array('new_user' => base64_encode(serialize($user_to_add)), 'send_password' => isset($_POST['send_password']) ? $_POST['send_password'] : ''); $output = new stdClass(); $output->ok = array(); $output->errors = array(); MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'newuser', $post_data, array(MainWP_Bulk_Add::getClassName(), 'PostingBulk_handler'), $output); } $ret['ok_list'] = $ret['error_list'] = array(); foreach ($dbwebsites as $website) { if (isset($output->ok[$website->id]) && $output->ok[$website->id] == 1) { $ret['ok_list'][] = 'New user(s) created: ' . stripslashes($website->name); } else { $ret['error_list'][] = $output->errors[$website->id] . ' ' . stripslashes($website->name); $error_sites .= $website->url . ';'; } } foreach ($not_valid as $val) { $ret['error_list'][] = $val; } $ret['failed_logging'] = ''; if (!empty($error_sites)) { $error_sites = rtrim($error_sites, ';'); $ret['failed_logging'] = $_POST['user_login'] . ',' . $_POST['email'] . ',' . $_POST['first_name'] . ',' . $_POST['last_name'] . ',' . $_POST['url'] . ',' . $_POST['pass1'] . ',' . intval($_POST['send_password']) . ',' . $_POST['role'] . ',' . $error_sites . ','; } $ret['line_number'] = $_POST['line_number']; die(json_encode($ret)); }
public static function prepareUpload() { include_once ABSPATH . '/wp-admin/includes/plugin-install.php'; $output = array(); $output['sites'] = array(); if ($_POST['selected_by'] == 'site') { //Get sites foreach ($_POST['selected_sites'] as $enc_id) { $websiteid = $enc_id; if (MainWP_Utility::ctype_digit($websiteid)) { $website = MainWP_DB::Instance()->getWebsiteById($websiteid); $output['sites'][$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name')); } } } else { //Get sites from group foreach ($_POST['selected_groups'] as $enc_id) { $groupid = $enc_id; if (MainWP_Utility::ctype_digit($groupid)) { $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($groupid)); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if ($website->sync_errors != '') { continue; } $output['sites'][$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name')); } @MainWP_DB::free_result($websites); } } } $output['urls'] = array(); foreach ($_POST['files'] as $file) { $output['urls'][] = MainWP_Utility::getDownloadUrl('bulk', $file); } $output['urls'] = implode('||', $output['urls']); $output['urls'] = apply_filters('mainwp_installbulk_prepareupload', $output['urls']); die(json_encode($output)); }
public static function getWebsiteListContent() { $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { ?> <li class="managegroups_site-listitem"> <input type="checkbox" name="sites" value="<?php echo $website->id; ?> " id="<?php echo MainWP_Utility::getNiceURL($website->url); ?> " class="mainwp-checkbox2"><label for="<?php echo MainWP_Utility::getNiceURL($website->url); ?> " class="mainwp-label2"><span class="website_url" style="display: none;"><?php echo MainWP_Utility::getNiceURL($website->url); ?> </span><span class="website_name"><?php echo stripslashes($website->name); ?> </span></label> </li> <?php } @MainWP_DB::free_result($websites); }
public static function select_categories_box($params) { $title = $params['title']; $type = isset($params['type']) ? $params['type'] : 'checkbox'; $show_group = isset($params['show_group']) ? $params['show_group'] : true; $selected_by = !empty($params['selected_by']) ? $params['selected_by'] : 'site'; $class = isset($params['class']) ? $params['class'] : ''; $style = isset($params['style']) ? $params['style'] : ''; $selected_cats = is_array($params['selected_cats']) ? $params['selected_cats'] : array(); $prefix = $params['prefix']; if ($type == 'checkbox') { $cbox_prefix = '[]'; } $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); $groups = MainWP_DB::Instance()->getNotEmptyGroups(); ?> <div class="mainwp_select_sites_box mainwp_select_categories <?php if ($class) { echo esc_attr($class); } ?> mainwp_select_sites_wrapper" style="<?php if ($style) { echo esc_attr($style); } ?> "> <div class="postbox"> <h3 class="box_title mainwp_box_title"><?php echo esc_html($title ? $title : __('Select Categories', 'mainwp')); ?> </h3> <div class="inside mainwp_inside "> <input type="hidden" name="select_by_<?php echo esc_attr($prefix); ?> " class="select_by" value="<?php echo esc_attr($selected_by); ?> "/> <?php if ($show_group) { ?> <div class="mainwp_ss_site_link" <?php echo esc_html($selected_by == 'group' ? 'style="display: inline-block;"' : ''); ?> > <a href="#" onClick="return mainwp_ss_cats_select_by(this, 'site')"><?php esc_html_e('By site', 'mainwp'); ?> </a> </div> <div class="mainwp_ss_site_text" <?php echo esc_html($selected_by == 'group' ? 'style="display: none;"' : ''); ?> ><?php esc_html('By site', 'mainwp'); ?> </div> | <div class="mainwp_ss_group_link" <?php echo esc_html($selected_by == 'group' ? 'style="display: none;"' : ''); ?> > <a href="#" onClick="return mainwp_ss_cats_select_by(this, 'group')"><?php esc_html_e('By group', 'mainwp'); ?> </a> </div> <div class="mainwp_ss_group_text" <?php echo esc_html($selected_by == 'group' ? 'style="display: inline-block;"' : ''); ?> ><?php esc_html_e('By group', 'mainwp'); ?> </div> <?php } ?> <div class="selected_sites" <?php echo esc_html($selected_by == 'group' ? 'style = "display: none"' : ''); ?> > <?php if (!$websites) { echo wp_kses_post(sprintf('<p>%s</p>', __('No websites have been found.', 'mainwp'))); } else { while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { $cats = isset($selected_cats[$website->id]) && is_array($selected_cats[$website->id]) ? $selected_cats[$website->id] : array(); ?> <div class="categories_site_<?php echo esc_attr($website->id); ?> "> <div class="categories_list_header"> <div><?php echo esc_html(stripslashes($website->name)); ?> </div> <label><span class="url"><?php echo esc_html($website->url); ?> </span></label> </div> <div class="categories_list_<?php echo esc_attr($website->id); ?> "> <?php if (count($cats) == 0) { echo wp_kses_post(sprintf('<p>%s</p>', __('No selected categories.', 'mainwp'))); } else { foreach ($cats as $cat) { echo wp_kses_post('<div class="mainwp_selected_sites_item selected_sites_item_checked"> <input type="' . $type . '" name="sites_selected_cats_' . $prefix . $cbox_prefix . '" value="' . $website->id . ',' . $cat['term_id'] . ',' . $cat['name'] . '" id="sites_selected_cats_' . $prefix . $cat['term_id'] . '" checked="true" /> <label>' . $cat['name'] . '</label> </div>'); } } ?> </div> <div class="mainwp_categories_list_bottom"> <div style="float:right"> <a href="#" rel="<?php echo esc_attr($prefix); ?> " class="load_more_cats" onClick="return mainwp_ss_cats_more(this, <?php echo esc_attr($website->id); ?> , 'site')"> <?php esc_html_e('Reload', 'mainwp'); ?> </a> <span class="mainwp_more_loading"> <i class="fa fa-spinner fa-pulse"></i> </span> </div> <div class="clearfix"></div> </div> </div> <?php } @MainWP_DB::free_result($websites); } ?> </div> <div class="selected_groups" <?php echo esc_attr($selected_by == 'group' ? 'style = "display: block"' : ''); ?> > <?php if (count($groups) == 0) { echo wp_kses_post(sprintf('<p>%s</p>', __('No groups with entries have been found.', 'mainwp'))); } foreach ($groups as $gid => $group) { ?> <div class="categories_group_<?php echo esc_attr($gid); ?> "> <div class="mainwp_groups_list_header"> <div><?php echo stripslashes($group->name); ?> </div> </div> <?php $websites = MainWP_DB::Instance()->getWebsitesByGroupIds(array($gid)); foreach ($websites as $website) { $id = $website->id; $cats = isset($selected_cats[$id]) && is_array($selected_cats[$id]) ? $selected_cats[$id] : array(); ?> <div class="categories_site_<?php echo esc_attr($id); ?> "> <div class="categories_list_header"> <div><?php echo esc_html(stripslashes($website->name)); ?> </div> <label><span class="url"><?php echo esc_html($website->url); ?> </span></label> </div> <div class="categories_list_<?php echo $id; ?> "> <?php if (count($cats) == 0) { echo wp_kses_post(sprintf('<p>%s</p>', __('No selected categories.', 'mainwp'))); } else { foreach ($cats as $cat) { ?> <div class="mainwp_selected_sites_item selected_sites_item_checked"> <input type="<?php echo esc_attr($type); ?> " name="groups_selected_cats_<?php echo esc_attr($prefix . $cbox_prefix); ?> " value="<?php echo esc_attr($id . ',' . $cat['term_id'] . ',' . $cat['name']); ?> " id="groups_selected_cats_<?php echo esc_attr($prefix . $cat['term_id']); ?> " checked="true" /> <label><?php echo esc_html($cat['name']); ?> </label> </div> <?php } } ?> </div> <div class="mainwp_categories_list_bottom"> <div style="float:right"> <a href="#" rel="<?php echo esc_attr($prefix); ?> " class="load_more_cats" onClick="return mainwp_ss_cats_more(this, <?php echo esc_attr($id); ?> , 'group')">Reload</a> <span class="mainwp_more_loading"><i class="fa fa-spinner fa-pulse"></i></span> </div> <div class="clearfix"></div> </div> </div> <?php } ?> </div> <?php } ?> </div> </div> </div> </div> <?php }
public static function render() { $show_form = true; if (isset($_POST['updateadminpassword'])) { check_admin_referer('mainwp_updateadminpassword', 'security'); $errors = array(); if (isset($_POST['select_by'])) { $selected_sites = array(); if (isset($_POST['selected_sites']) && is_array($_POST['selected_sites'])) { foreach ($_POST['selected_sites'] as $selected) { $selected_sites[] = $selected; } } $selected_groups = array(); if (isset($_POST['selected_groups']) && is_array($_POST['selected_groups'])) { foreach ($_POST['selected_groups'] as $selected) { $selected_groups[] = $selected; } } if ($_POST['select_by'] == 'group' && count($selected_groups) == 0 || $_POST['select_by'] == 'site' && count($selected_sites) == 0) { $errors[] = __('Please select the sites or groups where you want to change the admin password.', 'mainwp'); } } else { $errors[] = __('Please select whether you want to change the admin password for specific sites or groups.', 'mainwp'); } if (!isset($_POST['pass1']) || $_POST['pass1'] == '' || !isset($_POST['pass2']) || $_POST['pass2'] == '') { $errors[] = __('Please enter the password twice.', 'mainwp'); } else { if ($_POST['pass1'] != $_POST['pass2']) { $errors[] = __('Please enter the same password in the two password fields.', 'mainwp'); } } if (count($errors) == 0) { $show_form = false; $new_password = array('user_pass' => $_POST['pass1']); $dbwebsites = array(); if ($_POST['select_by'] == 'site') { //Get all selected websites foreach ($selected_sites as $k) { if (MainWP_Utility::ctype_digit($k)) { $website = MainWP_DB::Instance()->getWebsiteById($k); $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey')); } } } else { //Get all websites from the selected groups foreach ($selected_groups as $k) { if (MainWP_Utility::ctype_digit($k)) { $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($k)); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if ($website->sync_errors != '') { continue; } $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey')); } @MainWP_DB::free_result($websites); } } } if (count($dbwebsites) > 0) { $post_data = array('new_password' => base64_encode(serialize($new_password))); $output = new stdClass(); $output->ok = array(); $output->errors = array(); MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'newadminpassword', $post_data, array(MainWP_Bulk_Add::getClassName(), 'PostingBulk_handler'), $output); } } } if (!$show_form) { //Added to.. ?> <div class="wrap"> <h2 id="add-new-user"><i class="fa fa-key"></i> Update Admin Passwords</h2> <div id="message" class="updated"> <?php foreach ($dbwebsites as $website) { ?> <p> <a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a>: <?php echo isset($output->ok[$website->id]) && $output->ok[$website->id] == 1 ? __('Admin password updated.', 'mainwp') : __('ERROR: ', 'mainwp') . $output->errors[$website->id]; ?> </p> <?php } ?> </div> <br/> <a href="<?php echo get_admin_url(); ?> admin.php?page=UpdateAdminPasswords" class="add-new-h2" target="_top"><?php _e('Update admin passwords', 'mainwp'); ?> </a> <a href="<?php echo get_admin_url(); ?> admin.php?page=mainwp_tab" class="add-new-h2" target="_top"><?php _e('Return to Dashboard', 'mainwp'); ?> </a> </div> <?php } else { wp_enqueue_script('user-profile'); // header in User page MainWP_User::renderHeader('UpdateAdminPasswords'); ?> <form action="" method="post" name="createuser" id="createuser" class="add:users: validate"> <input type="hidden" name="security" value="<?php echo wp_create_nonce('mainwp_updateadminpassword'); ?> "/> <div class="mainwp_config_box_right"> <?php MainWP_UI::select_sites_box(__('Select Sites to Update', 'mainwp')); ?> </div> <div class="mainwp_config_box_left postbox mainwp-postbox"> <h3 class="mainwp_box_title"> <i class="fa fa-key"></i> <?php _e('Bulk Update Administrator Passwords', 'mainwp'); ?> </h3> <div class="inside"> <table class="form-table"> <?php global $wp_version; if (version_compare('4.3-alpha', $wp_version, '>=')) { ?> <tr class="form-field form-required"> <th scope="row"><label for="pass1"><?php _e('Enter New Password ', 'mainwp'); ?> <br/><span class="description"><?php _e('(twice, required)', 'mainwp'); ?> </span></label> </th> <td> <input name="user_login" type="hidden" id="user_login" value="admin"> <input class="" name="pass1" type="password" id="pass1" autocomplete="off"/> <br/> <input class="" name="pass2" type="password" id="pass2" autocomplete="off"/> <br/> <div id="pass-strength-result" style="display: block;"><?php _e('Strength indicator', 'mainwp'); ?> </div> <p class="description indicator-hint" style="clear:both;"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).', 'mainwp'); ?> </p> </td> </tr> <?php } else { ?> <tr class="form-field form-required user-pass1-wrap"> <th scope="row"> <label for="pass1"> <?php _e('New Password', 'mainwp'); ?> <span class="description hide-if-js"><?php _e('(required)'); ?> </span> </label> </th> <td> <input class="hidden" value=" "/><!-- #24364 workaround --> <!-- <button type="button" class="button button-secondary wp-generate-pw hide-if-no-js">--><?php //_e( 'Show password' ); ?> <!--</button>--> <div class="wp-pwd123"> <?php $initial_password = wp_generate_password(24); ?> <span class="password-input-wrapper"> <input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr($initial_password); ?> " aria-describedby="pass-strength-result"/> </span> <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e('Hide password'); ?> "> <span class="dashicons dashicons-hidden"></span> <span class="text"><?php _e('Hide'); ?> </span> </button> <!-- <button type="button" class="button button-secondary wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="--><?php //esc_attr_e( 'Cancel password change' ); ?> <!--">--> <!-- <span class="text">--><?php //_e( 'Cancel' ); ?> <!--</span>--> <!-- </button>--> <div style="display:none" id="pass-strength-result" aria-live="polite"></div> </div> </td> </tr> <tr class="form-field form-required user-pass2-wrap hide-if-js"> <td scope="row"><label for="pass2"><?php _e('Repeat Password'); ?> <span class="description"><?php _e('(required)'); ?> </span></label></td> <td> <input name="pass2" type="password" id="pass2" value="<?php echo esc_attr($initial_password); ?> " autocomplete="off"/> </td> </tr> <?php } ?> <tr> <td colspan="2"> <p class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).', 'mainwp'); ?> </p> </td> </tr> <tr> <td></td> <td colspan="2"> <input type="submit" name="updateadminpassword" id="bulk_updateadminpassword" class="button-primary button button-hero" value="<?php _e('Update Now', 'mainwp'); ?> "/> </td> </tr> </table> </div> </div> </form> <?php MainWP_User::renderFooter('UpdateAdminPasswords'); } }
function clear_items() { if (MainWP_DB::is_result($this->items)) { @MainWP_DB::free_result($this->items); } }
public static function renderSites($renew, $pExit = true) { $current_wpid = MainWP_Utility::get_current_wpid(); if ($current_wpid) { $sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid); } else { $sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser(); } $websites = MainWP_DB::Instance()->query($sql); $allPages = array(); if ($websites) { while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if ($website->recent_pages == '') { continue; } $pages = json_decode($website->recent_pages, 1); if (count($pages) == 0) { continue; } foreach ($pages as $page) { $page['website'] = (object) array('id' => $website->id, 'url' => $website->url); $allPages[] = $page; } } @MainWP_DB::free_result($websites); } $recent_pages_published = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'publish'); $recent_pages_published = MainWP_Utility::sortmulti($recent_pages_published, 'dts', 'desc'); $recent_pages_draft = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'draft'); $recent_pages_draft = MainWP_Utility::sortmulti($recent_pages_draft, 'dts', 'desc'); $recent_pages_pending = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'pending'); $recent_pages_pending = MainWP_Utility::sortmulti($recent_pages_pending, 'dts', 'desc'); $recent_pages_trash = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'trash'); $recent_pages_trash = MainWP_Utility::sortmulti($recent_pages_trash, 'dts', 'desc'); ?> <div class="clear"> <a href="<?php echo admin_url('admin.php?page=PageBulkAdd&select=' . ($current_wpid ? $current_wpid : 'all')); ?> " class="button-primary" style="float: right"><?php _e('Add New', 'mainwp'); ?> </a> <a class="mainwp_action left mainwp_action_down recent_posts_published_lnk" href="#"><?php _e('Published', 'mainwp'); ?> (<?php echo count($recent_pages_published); ?> )</a><a class="mainwp_action mid recent_posts_draft_lnk" href="#"><?php _e('Draft', 'mainwp'); ?> (<?php echo count($recent_pages_draft); ?> )</a><a class="mainwp_action mid recent_posts_pending_lnk" href="#"><?php _e('Pending', 'mainwp'); ?> (<?php echo count($recent_pages_pending); ?> )</a><a class="mainwp_action right recent_posts_trash_lnk" href="#"><?php _e('Trash', 'mainwp'); ?> (<?php echo count($recent_pages_trash); ?> )</a><br/><br/> <div class="recent_posts_published"> <?php for ($i = 0; $i < count($recent_pages_published) && $i < 5; $i++) { if (!isset($recent_pages_published[$i]['title']) || $recent_pages_published[$i]['title'] == '') { $recent_pages_published[$i]['title'] = '(No Title)'; } if (isset($recent_pages_published[$i]['dts'])) { if (!stristr($recent_pages_published[$i]['dts'], '-')) { $recent_pages_published[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_published[$i]['dts'])); } } ?> <div class="mainwp-row mainwp-recent"> <input class="postId" type="hidden" name="id" value="<?php echo $recent_pages_published[$i]['id']; ?> "/> <input class="websiteId" type="hidden" name="id" value="<?php echo $recent_pages_published[$i]['website']->id; ?> "/> <span class="mainwp-left-col" style="width: 60% !important; margin-right: 1em;"><a href="<?php echo $recent_pages_published[$i]['website']->url; ?> ?p=<?php echo $recent_pages_published[$i]['id']; ?> " target="_blank"><?php echo htmlentities($recent_pages_published[$i]['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?> </a></span> <span class="mainwp-mid-col"> <a href="<?php echo admin_url('admin.php?page=CommentBulkManage&siteid=' . $recent_pages_published[$i]['website']->id . '&postid=' . $recent_pages_published[$i]['id']); ?> " title="<?php echo $recent_pages_published[$i]['comment_count']; ?> " class="post-com-count" style="display: inline-block !important;"> <span class="comment-count"><?php echo $recent_pages_published[$i]['comment_count']; ?> </span> </a> </span> <span class="mainwp-right-col"> <a href="<?php echo $recent_pages_published[$i]['website']->url; ?> " target="_blank"> <i class="fa fa-external-link"></i> <?php echo MainWP_Utility::getNiceURL($recent_pages_published[$i]['website']->url); ?> </a> <br/> <?php echo $recent_pages_published[$i]['dts']; ?> </span> <div style="clear: left;"></div> <div class="mainwp-row-actions"> <a href="#" class="mainwp-post-unpublish"><?php _e('Unpublish', 'mainwp'); ?> </a> | <a href="admin.php?page=SiteOpen&websiteid=<?php echo $recent_pages_published[$i]['website']->id; ?> &location=<?php echo base64_encode('post.php?action=editpost&post=' . $recent_pages_published[$i]['id'] . '&action=edit'); ?> " title="Edit this post"><?php _e('Edit', 'mainwp'); ?> </a> | <a href="#" class="mainwp-post-trash"><?php _e('Trash', 'mainwp'); ?> </a>| <a href="<?php echo $recent_pages_published[$i]['website']->url . (substr($recent_pages_published[$i]['website']->url, -1) != '/' ? '/' : '') . '?p=' . $recent_pages_published[$i]['id']; ?> " target="_blank" title="View '<?php echo $recent_pages_published[$i]['title']; ?> '" rel="permalink"><?php _e('View', 'mainwp'); ?> </a> | <a href="admin.php?page=PageBulkManage" class="mainwp-post-viewall"><?php _e('View All', 'mainwp'); ?> </a> </div> <div class="mainwp-row-actions-working"> <i class="fa fa-spinner fa-pulse"></i> <?php _e('Please wait', 'mainwp'); ?> <div> </div> </div> </div> <?php } ?> </div> <div class="recent_posts_draft" style="display: none"> <?php for ($i = 0; $i < count($recent_pages_draft) && $i < 5; $i++) { if (!isset($recent_pages_draft[$i]['title']) || $recent_pages_draft[$i]['title'] == '') { $recent_pages_draft[$i]['title'] = '(No Title)'; } if (isset($recent_pages_draft[$i]['dts'])) { if (!stristr($recent_pages_draft[$i]['dts'], '-')) { $recent_pages_draft[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_draft[$i]['dts'])); } } ?> <div class="mainwp-row mainwp-recent"> <input class="postId" type="hidden" name="id" value="<?php echo $recent_pages_draft[$i]['id']; ?> "/> <input class="websiteId" type="hidden" name="id" value="<?php echo $recent_pages_draft[$i]['website']->id; ?> "/> <span class="mainwp-left-col" style="width: 60% !important; margin-right: 1em;"><a href="<?php echo $recent_pages_draft[$i]['website']->url; ?> ?p=<?php echo $recent_pages_draft[$i]['id']; ?> " target="_blank"><?php echo htmlentities($recent_pages_draft[$i]['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?> </a></span> <span class="mainwp-mid-col"> <a href="<?php echo admin_url('admin.php?page=CommentBulkManage&siteid=' . $recent_pages_draft[$i]['website']->id . '&postid=' . $recent_pages_draft[$i]['id']); ?> " title="<?php echo $recent_pages_draft[$i]['comment_count']; ?> " class="post-com-count" style="display: inline-block !important;"> <span class="comment-count"><?php echo $recent_pages_draft[$i]['comment_count']; ?> </span> </a> </span> <span class="mainwp-right-col"><?php echo MainWP_Utility::getNiceURL($recent_pages_draft[$i]['website']->url); ?> <br/><?php echo $recent_pages_draft[$i]['dts']; ?> </span> <div style="clear: left;"></div> <div class="mainwp-row-actions"> <a href="#" class="mainwp-post-publish"><?php _e('Publish', 'mainwp'); ?> </a> | <a href="admin.php?page=SiteOpen&websiteid=<?php echo $recent_pages_draft[$i]['website']->id; ?> &location=<?php echo base64_encode('post.php?action=editpost&post=' . $recent_pages_draft[$i]['id'] . '&action=edit'); ?> " title="Edit this post"><?php _e('Edit', 'mainwp'); ?> </a> | <a href="#" class="mainwp-post-trash"><?php _e('Trash', 'mainwp'); ?> </a> | <a href="admin.php?page=PostBulkManage" class="mainwp-post-viewall"><?php _e('View All', 'mainwp'); ?> </a> </div> <div class="mainwp-row-actions-working"> <i class="fa fa-spinner fa-pulse"></i> <?php _e('Please wait', 'mainwp'); ?> </div> <div> </div> </div> <?php } ?> </div> <div class="recent_posts_pending" style="display: none"> <?php for ($i = 0; $i < count($recent_pages_pending) && $i < 5; $i++) { if (!isset($recent_pages_pending[$i]['title']) || $recent_pages_pending[$i]['title'] == '') { $recent_pages_pending[$i]['title'] = '(No Title)'; } if (isset($recent_pages_pending[$i]['dts'])) { if (!stristr($recent_pages_pending[$i]['dts'], '-')) { $recent_pages_pending[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_pending[$i]['dts'])); } } ?> <div class="mainwp-row mainwp-recent"> <input class="postId" type="hidden" name="id" value="<?php echo $recent_pages_pending[$i]['id']; ?> "/> <input class="websiteId" type="hidden" name="id" value="<?php echo $recent_pages_pending[$i]['website']->id; ?> "/> <span class="mainwp-left-col" style="width: 60% !important; margin-right: 1em;"><a href="<?php echo $recent_pages_pending[$i]['website']->url; ?> ?p=<?php echo $recent_pages_pending[$i]['id']; ?> " target="_blank"><?php echo htmlentities($recent_pages_pending[$i]['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?> </a></span> <span class="mainwp-mid-col"> <a href="<?php echo admin_url('admin.php?page=CommentBulkManage&siteid=' . $recent_pages_pending[$i]['website']->id . '&postid=' . $recent_pages_pending[$i]['id']); ?> " title="<?php echo $recent_pages_pending[$i]['comment_count']; ?> " class="post-com-count" style="display: inline-block !important;"> <span class="comment-count"><?php echo $recent_pages_pending[$i]['comment_count']; ?> </span> </a> </span> <span class="mainwp-right-col"><?php echo MainWP_Utility::getNiceURL($recent_pages_pending[$i]['website']->url); ?> <br/><?php echo $recent_pages_pending[$i]['dts']; ?> </span> <div style="clear: left;"></div> <div class="mainwp-row-actions"> <a href="#" class="mainwp-post-publish"><?php _e('Publish', 'mainwp'); ?> </a> | <a href="admin.php?page=SiteOpen&websiteid=<?php echo $recent_pages_pending[$i]['website']->id; ?> &location=<?php echo base64_encode('post.php?action=editpost&post=' . $recent_pages_pending[$i]['id'] . '&action=edit'); ?> " title="Edit this post"><?php _e('Edit', 'mainwp'); ?> </a> | <a href="#" class="mainwp-post-trash"><?php _e('Trash', 'mainwp'); ?> </a> | <a href="admin.php?page=PostBulkManage" class="mainwp-post-viewall"><?php _e('View All', 'mainwp'); ?> </a> </div> <div class="mainwp-row-actions-working"> <i class="fa fa-spinner fa-pulse"></i> <?php _e('Please wait', 'mainwp'); ?> </div> <div> </div> </div> <?php } ?> </div> <div class="recent_posts_trash" style="display: none"> <?php for ($i = 0; $i < count($recent_pages_trash) && $i < 5; $i++) { if (!isset($recent_pages_trash[$i]['title']) || $recent_pages_trash[$i]['title'] == '') { $recent_pages_trash[$i]['title'] = '(No Title)'; } if (isset($recent_pages_trash[$i]['dts'])) { if (!stristr($recent_pages_trash[$i]['dts'], '-')) { $recent_pages_trash[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_trash[$i]['dts'])); } } ?> <div class="mainwp-row mainwp-recent"> <input class="postId" type="hidden" name="id" value="<?php echo $recent_pages_trash[$i]['id']; ?> "/> <input class="websiteId" type="hidden" name="id" value="<?php echo $recent_pages_trash[$i]['website']->id; ?> "/> <span class="mainwp-left-col" style="width: 60% !important; margin-right: 1em;"><?php echo $recent_pages_trash[$i]['title']; ?> </span> <span class="mainwp-mid-col"> <a href="<?php echo admin_url('admin.php?page=CommentBulkManage&siteid=' . $recent_pages_trash[$i]['website']->id . '&postid=' . $recent_pages_trash[$i]['id']); ?> " title="<?php echo $recent_pages_trash[$i]['comment_count']; ?> " class="post-com-count" style="display: inline-block !important;"> <span class="comment-count"><?php echo $recent_pages_trash[$i]['comment_count']; ?> </span> </a> </span> <span class="mainwp-right-col"><?php echo MainWP_Utility::getNiceURL($recent_pages_trash[$i]['website']->url); ?> <br/><?php echo $recent_pages_trash[$i]['dts']; ?> </span> <div style="clear: left;"></div> <div class="mainwp-row-actions"> <a href="#" class="mainwp-post-restore"><?php _e('Restore', 'mainwp'); ?> </a> | <a href="#" class="mainwp-post-delete delete" style="color: red;"><?php _e('Delete Permanently', 'mainwp'); ?> </a> </div> <div class="mainwp-row-actions-working"> <i class="fa fa-spinner fa-pulse"></i> <?php _e('Please wait', 'mainwp'); ?> </div> <div> </div> </div> <?php } ?> </div> </div> <div class="clear"></div> <?php if ($pExit == true) { exit; } }
function on_show_page() { if (!mainwp_current_user_can('dashboard', 'access_global_dashboard')) { mainwp_do_not_have_permissions(__('global dashboard', 'mainwp')); return; } global $screen_layout_columns; ?> <div id="mainwp_tab-general" class="wrap"> <a href="https://mainwp.com" id="mainwplogo" title="MainWP" target="_blank"><img src="<?php echo plugins_url('images/logo.png', dirname(__FILE__)); ?> " height="50" alt="MainWP"/></a> <h2><i class="fa fa-tachometer"></i> <?php _e('MainWP Dashboard', 'mainwp'); ?> </h2> <div style="clear: both;"></div> <br/><br/> <?php if (MainWP_Utility::showUserTip('mainwp-dashboard-tips')) { ?> <div id="mainwp-tip-zone"> <div class="mainwp-tips mainwp_info-box-blue"> <span class="mainwp-tip" id="mainwp-dashboard-tips"><strong><?php _e('MainWP Tip', 'mainwp'); ?> : </strong><?php _e('You can move the Widgets around to fit your needs and even adjust the number of columns by selecting "Screen Options" on the top right.', 'mainwp'); ?> </span><span><a href="#" class="mainwp-dismiss"><i class="fa fa-times-circle"></i> <?php _e('Dismiss', 'mainwp'); ?> </a></span></div> </div> <?php } ?> <?php $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser(false, null, 'wp_sync.dtsSync DESC, wp.url ASC')); self::renderDashboardBody($websites, $this->dashBoard, $screen_layout_columns); @MainWP_DB::free_result($websites); ?> </div> <?php }
public static function renderSites() { $globalView = true; $current_wpid = MainWP_Utility::get_current_wpid(); if ($current_wpid) { $sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid); $globalView = false; } else { $sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser(); } $websites = MainWP_DB::Instance()->query($sql); if (!$websites) { return; } $userExtension = MainWP_DB::Instance()->getUserExtension(); $total_themesIgnored = $total_pluginsIgnored = 0; $total_themesIgnoredAbandoned = $total_pluginsIgnoredAbandoned = 0; if ($globalView) { $decodedIgnoredPlugins = json_decode($userExtension->ignored_plugins, true); $decodedIgnoredThemes = json_decode($userExtension->ignored_themes, true); $total_pluginsIgnored = is_array($decodedIgnoredPlugins) ? count($decodedIgnoredPlugins) : 0; $total_themesIgnored = is_array($decodedIgnoredThemes) ? count($decodedIgnoredThemes) : 0; $decodedIgnoredPluginsAbandoned = json_decode($userExtension->dismissed_plugins, true); $decodedIgnoredThemesAbandoned = json_decode($userExtension->dismissed_themes, true); $total_pluginsIgnoredAbandoned = is_array($decodedIgnoredPluginsAbandoned) ? count($decodedIgnoredPluginsAbandoned) : 0; $total_themesIgnoredAbandoned = is_array($decodedIgnoredThemesAbandoned) ? count($decodedIgnoredThemesAbandoned) : 0; } $decodedDismissedPlugins = json_decode($userExtension->dismissed_plugins, true); $decodedDismissedThemes = json_decode($userExtension->dismissed_themes, true); $globalIgnoredPluginConflicts = json_decode($userExtension->ignored_pluginConflicts, true); if (!is_array($globalIgnoredPluginConflicts)) { $globalIgnoredPluginConflicts = array(); } $globalIgnoredThemeConflicts = json_decode($userExtension->ignored_themeConflicts, true); if (!is_array($globalIgnoredThemeConflicts)) { $globalIgnoredThemeConflicts = array(); } $total_wp_upgrades = 0; $total_plugin_upgrades = 0; $total_theme_upgrades = 0; $total_sync_errors = 0; $total_uptodate = 0; $total_offline = 0; $total_conflict = 0; $total_plugins_outdate = 0; $total_themes_outdate = 0; $allPlugins = array(); $pluginsInfo = array(); $allThemes = array(); $themesInfo = array(); $allPluginsOutdate = array(); $pluginsOutdateInfo = array(); $allThemesOutdate = array(); $themesOutdateInfo = array(); @MainWP_DB::data_seek($websites, 0); $currentSite = null; $pluginsIgnored_perSites = $themesIgnored_perSites = array(); $pluginsIgnoredAbandoned_perSites = $themesIgnoredAbandoned_perSites = array(); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if (!$globalView) { $currentSite = $website; } $wp_upgrades = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'wp_upgrades'), true); if ($website->is_ignoreCoreUpdates) { $wp_upgrades = array(); } if (is_array($wp_upgrades) && count($wp_upgrades) > 0) { $total_wp_upgrades++; } $plugin_upgrades = json_decode($website->plugin_upgrades, true); if ($website->is_ignorePluginUpdates) { $plugin_upgrades = array(); } $theme_upgrades = json_decode($website->theme_upgrades, true); if ($website->is_ignoreThemeUpdates) { $theme_upgrades = array(); } $decodedPremiumUpgrades = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'premium_upgrades'), true); if (is_array($decodedPremiumUpgrades)) { foreach ($decodedPremiumUpgrades as $crrSlug => $premiumUpgrade) { $premiumUpgrade['premium'] = true; if ($premiumUpgrade['type'] == 'plugin') { if (!is_array($plugin_upgrades)) { $plugin_upgrades = array(); } if (!$website->is_ignorePluginUpdates) { $plugin_upgrades[$crrSlug] = $premiumUpgrade; } } else { if ($premiumUpgrade['type'] == 'theme') { if (!is_array($theme_upgrades)) { $theme_upgrades = array(); } if (!$website->is_ignoreThemeUpdates) { $theme_upgrades[$crrSlug] = $premiumUpgrade; } } } } } if (is_array($plugin_upgrades)) { $ignored_plugins = json_decode($website->ignored_plugins, true); if (is_array($ignored_plugins)) { $plugin_upgrades = array_diff_key($plugin_upgrades, $ignored_plugins); } $ignored_plugins = json_decode($userExtension->ignored_plugins, true); if (is_array($ignored_plugins)) { $plugin_upgrades = array_diff_key($plugin_upgrades, $ignored_plugins); } $total_plugin_upgrades += count($plugin_upgrades); } 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); } $total_theme_upgrades += count($theme_upgrades); } $ignored_plugins = json_decode($website->ignored_plugins, true); $ignored_themes = json_decode($website->ignored_themes, true); if (is_array($ignored_plugins)) { $ignored_plugins = array_filter($ignored_plugins); $pluginsIgnored_perSites = array_merge($pluginsIgnored_perSites, $ignored_plugins); } if (is_array($ignored_themes)) { $ignored_themes = array_filter($ignored_themes); $themesIgnored_perSites = array_merge($themesIgnored_perSites, $ignored_themes); } $ignoredAbandoned_plugins = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'plugins_outdate_dismissed'), true); if (is_array($ignoredAbandoned_plugins)) { $ignoredAbandoned_plugins = array_filter($ignoredAbandoned_plugins); $pluginsIgnoredAbandoned_perSites = array_merge($pluginsIgnoredAbandoned_perSites, $ignoredAbandoned_plugins); } $ignoredAbandoned_themes = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_dismissed'), true); if (is_array($ignoredAbandoned_themes)) { $ignoredAbandoned_themes = array_filter($ignoredAbandoned_themes); $themesIgnoredAbandoned_perSites = array_merge($themesIgnoredAbandoned_perSites, $ignoredAbandoned_themes); } $plugins_outdate = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'plugins_outdate_info'), true); $themes_outdate = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_info'), true); if (is_array($plugins_outdate)) { if (is_array($ignoredAbandoned_plugins)) { $plugins_outdate = array_diff_key($plugins_outdate, $ignoredAbandoned_plugins); } if (is_array($decodedDismissedPlugins)) { $plugins_outdate = array_diff_key($plugins_outdate, $decodedDismissedPlugins); } $total_plugins_outdate += count($plugins_outdate); } if (is_array($themes_outdate)) { if (is_array($themesIgnoredAbandoned_perSites)) { $themes_outdate = array_diff_key($themes_outdate, $themesIgnoredAbandoned_perSites); } if (is_array($decodedDismissedThemes)) { $themes_outdate = array_diff_key($themes_outdate, $decodedDismissedThemes); } $total_themes_outdate += count($themes_outdate); } if ($userExtension->site_view == 0) { //site view disabled //Keep track of all the plugins & themes if (is_array($plugin_upgrades)) { foreach ($plugin_upgrades as $slug => $plugin_upgrade) { if (!isset($allPlugins[$slug])) { $allPlugins[$slug] = 1; } else { $allPlugins[$slug]++; } $pluginsInfo[$slug] = array('name' => $plugin_upgrade['Name'], 'slug' => $plugin_upgrade['update']['slug'], 'premium' => isset($plugin_upgrade['premium']) ? $plugin_upgrade['premium'] : 0, 'uri' => $plugin_upgrade['PluginURI']); } } ksort($allPlugins); if (is_array($theme_upgrades)) { foreach ($theme_upgrades as $slug => $theme_upgrade) { if (!isset($allThemes[$slug])) { $allThemes[$slug] = 1; } else { $allThemes[$slug]++; } $themesInfo[$slug] = array('name' => $theme_upgrade['Name'], 'premium' => isset($theme_upgrade['premium']) ? $theme_upgrade['premium'] : 0); } } ksort($allThemes); if (is_array($plugins_outdate)) { foreach ($plugins_outdate as $slug => $plugin_outdate) { if (!isset($allPluginsOutdate[$slug])) { $allPluginsOutdate[$slug] = 1; } else { $allPluginsOutdate[$slug]++; } $pluginsOutdateInfo[$slug] = array('Name' => $plugin_outdate['Name'], 'last_updated' => isset($plugin_outdate['last_updated']) ? $plugin_outdate['last_updated'] : 0, 'info' => $plugin_outdate, 'uri' => $plugin_outdate['PluginURI']); } } ksort($allPluginsOutdate); if (is_array($themes_outdate)) { foreach ($themes_outdate as $slug => $theme_outdate) { if (!isset($allThemesOutdate[$slug])) { $allThemesOutdate[$slug] = 1; } else { $allThemesOutdate[$slug]++; } $themesOutdateInfo[$slug] = array('name' => $theme_outdate['Name'], 'slug' => dirname($slug), 'last_updated' => isset($theme_outdate['last_updated']) ? $theme_outdate['last_updated'] : 0); } } ksort($allThemesOutdate); } if ($website->sync_errors != '') { $total_sync_errors++; } if ($website->uptodate == 1) { $total_uptodate++; } if ($website->offline_check_result == -1) { $total_offline++; } $pluginConflicts = json_decode($website->pluginConflicts, true); $themeConflicts = json_decode($website->themeConflicts, true); $ignoredPluginConflicts = json_decode($website->ignored_pluginConflicts, true); if (!is_array($ignoredPluginConflicts)) { $ignoredPluginConflicts = array(); } $ignoredThemeConflicts = json_decode($website->ignored_themeConflicts, true); if (!is_array($ignoredThemeConflicts)) { $ignoredThemeConflicts = array(); } $isConflict = false; if (count($pluginConflicts) > 0) { foreach ($pluginConflicts as $pluginConflict) { if (!in_array($pluginConflict, $ignoredPluginConflicts) && !in_array($pluginConflict, $globalIgnoredPluginConflicts)) { $isConflict = true; } } } if (!$isConflict && count($themeConflicts) > 0) { foreach ($themeConflicts as $themeConflict) { if (!in_array($themeConflict, $ignoredThemeConflicts) && !in_array($themeConflict, $globalIgnoredThemeConflicts)) { $isConflict = true; } } } if ($isConflict) { $total_conflict++; } } $errorsDismissed = get_user_option('mainwp_syncerrors_dismissed'); ?> <div class="clear"> <div id="mainwp-right-now-message" class="mainwp-right-now-error" <?php if ($total_sync_errors <= 0 || $globalView && $errorsDismissed) { echo ' style="display: none;"'; } ?> > <p> <?php if ($globalView) { ?> <span style="float: right;"><a href="#" id="mainwp-right-now-message-dismiss"><i class="fa fa-times-circle"></i> <?php _e('Dismiss', 'mainwp'); ?> </a></span> <span id="mainwp-right-now-message-content"><?php echo $total_sync_errors; ?> <?php echo _n('Site Timed Out / Errored Out', 'Sites Timed Out / Errored Out', $total_sync_errors, 'mainwp'); ?> .<br/><?php echo sprintf(__('There was an error syncing some of your sites. %sPlease check this help doc for possible solutions%s.', 'mainwp'), '<a href="http://docs.mainwp.com/sync-error/">', '</a>'); ?> </span> <?php } else { ?> <span id="mainwp-right-now-message-content"><a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $currentSite->id); ?> "><?php echo stripslashes($currentSite->name); ?> </a> <?php _e('Timed Out / Errored Out', 'mainwp'); ?> .<br/><?php echo sprintf(__('There was an error syncing some of your sites. %sPlease check this help doc for possible solutions%s.', 'mainwp'), '<a href="http://docs.mainwp.com/sync-error/">', '</a>'); ?> </span> <?php } ?> </p> </div> </div> <?php $total_pluginsIgnored += count($pluginsIgnored_perSites); $total_themesIgnored += count($themesIgnored_perSites); $total_pluginsIgnoredAbandoned += count($pluginsIgnoredAbandoned_perSites); $total_themesIgnoredAbandoned += count($themesIgnoredAbandoned_perSites); //WP Upgrades part: $total_upgrades = $total_wp_upgrades + $total_plugin_upgrades + $total_theme_upgrades; if ($globalView) { $userExtension->site_view; ?> <div class="clear"> <div class="mainwp-row-top"> <span class="mainwp-left-col"><strong><?php _e('View Upgrades per', 'mainwp'); ?> </strong></span> <span class="mainwp-mid-col"> </span> <span class="mainwp-right-col"> <form method="post" action=""> <select id="mainwp_select_options_siteview" name="select_mainwp_options_siteview"> <option value="1" <?php echo $userExtension->site_view == 1 ? 'selected' : ''; ?> ><?php esc_html_e('Site', 'mainwp'); ?> </option> <option value="0" <?php echo $userExtension->site_view == 0 ? 'selected' : ''; ?> ><?php esc_html_e('Plugin/Theme', 'mainwp'); ?> </option> </select> </form> </span> </div> </div> <?php } ?> <div class="clear"> <div class="<?php echo $globalView ? 'mainwp-row' : 'mainwp-row-top'; ?> "> <span class="mainwp-left-col"><span class="mainwp-rightnow-number"><?php echo $total_upgrades; ?> </span> <?php echo _n('Upgrade', 'Upgrades', $total_upgrades, 'mainwp'); ?> <?php _e('available', 'mainwp'); ?> </span> <span class="mainwp-mid-col"> </span> <?php if (mainwp_current_user_can('dashboard', 'update_wordpress') && mainwp_current_user_can('dashboard', 'update_plugins') && mainwp_current_user_can('dashboard', 'update_themes')) { ?> <span class="mainwp-right-col"><?php if ($total_upgrades == 0) { ?> <a class="button" disabled="disabled"><?php _e('Upgrade Everything', 'mainwp'); ?> </a><?php } else { ?> <a href="#" onClick="return rightnow_global_upgrade_all();" class="mainwp-upgrade-button button"><?php _e('Upgrade Everything', 'mainwp'); ?> </a><?php } ?> </span> <?php } ?> </div> </div> <div class="clear"> <div class="mainwp-row"> <span class="mainwp-left-col"> <a href="#" id="mainwp_upgrades_show" onClick="return rightnow_show('upgrades', true);"> <span class="mainwp-rightnow-number"><?php echo $total_wp_upgrades; ?> </span> <?php echo _n('WordPress upgrade', 'WordPress upgrades', $total_wp_upgrades, 'mainwp'); ?> <?php _e('available', 'mainwp'); ?> </a> </span> <span class="mainwp-mid-col"> </span> <span class="mainwp-right-col"> </a> <?php if (mainwp_current_user_can('dashboard', 'update_wordpress')) { if ($total_wp_upgrades > 0) { ?> <a href="#" onClick="return rightnow_wordpress_global_upgrade_all();" class="button-primary"><?php echo _n('Upgrade', 'Upgrade All', $total_wp_upgrades, 'mainwp'); ?> </a> <?php } else { ?> <a class="button" disabled="disabled"><?php _e('No Upgrades', 'mainwp'); ?> </a> <?php } ?> <?php } ?> </span> </div> <div id="wp_upgrades" style="display: none"> <?php @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if ($website->is_ignoreCoreUpdates) { continue; } $wp_upgrades = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'wp_upgrades'), true); if (count($wp_upgrades) == 0 && $website->sync_errors == '') { continue; } ?> <div class="mainwp-row mainwp_wordpress_upgrade" site_id="<?php echo $website->id; ?> " site_name="<?php echo rawurlencode($website->name); ?> " updated="<?php echo count($wp_upgrades) > 0 ? '0' : '1'; ?> "> <span class="mainwp-left-col"><a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a><input type="hidden" id="wp_upgraded_<?php echo $website->id; ?> " value="<?php if (count($wp_upgrades) > 0) { echo '0'; } else { echo '1'; } ?> "/></span> <span class="mainwp-mid-col wordpressInfo" id="wp_upgrade_<?php echo $website->id; ?> "> <?php if (count($wp_upgrades) > 0) { echo $wp_upgrades['current'] . ' to ' . $wp_upgrades['new']; } else { if ($website->sync_errors != '') { echo __('Site Error - No update Information available', 'mainwp'); } else { echo __('Hooray, No Updates Available!', 'mainwp'); } } ?> </span> <span class="mainwp-right-col wordpressAction"> <div id="wp_upgradebuttons_<?php echo $website->id; ?> "> <?php if (mainwp_current_user_can('dashboard', 'update_wordpress')) { if (count($wp_upgrades) > 0) { ?> <a href="#" class="mainwp-upgrade-button button" onClick="rightnow_upgrade(<?php echo $website->id; ?> )"><?php _e('Upgrade', 'mainwp'); ?> </a> <?php } } ?> <a href="<?php echo $website->url; ?> " target="_blank" class="mainwp-open-button button"><?php _e('Open', 'mainwp'); ?> </a> </div> </span> </div> <?php } ?> </div> </div> <?php //WP plugin upgrades! ?> <div class="clear"> <div class="mainwp-row"> <span class="mainwp-left-col"> <a href="#" id="mainwp_plugin_upgrades_show" onClick="return rightnow_show('plugin_upgrades', true);"> <span class="mainwp-rightnow-number"><?php echo $total_plugin_upgrades; ?> </span> <?php _e('Plugin upgrade', 'mainwp'); if ($total_plugin_upgrades != 1) { ?> s<?php } ?> <?php _e('available', 'mainwp'); ?> </a> </span> <span class="mainwp-mid-col"><a href="<?php echo admin_url('admin.php?page=PluginsIgnore'); ?> "><?php _e('Ignored', 'mainwp'); ?> (<?php echo $total_pluginsIgnored; ?> )</a></span> <span class="mainwp-right-col"><?php if (mainwp_current_user_can("dashboard", "update_plugins")) { if ($total_plugin_upgrades > 0 && $userExtension->site_view == 1) { ?> <a href="#" onClick="return rightnow_plugins_global_upgrade_all();" class="button-primary"><?php echo _n('Upgrade', 'Upgrade All', $total_plugin_upgrades, 'mainwp'); ?> </a><?php } else { if ($total_plugin_upgrades > 0 && $userExtension->site_view == 0) { ?> <a href="#" onClick="return rightnow_plugins_global_upgrade_all();" class="button-primary"><?php echo _n('Upgrade', 'Upgrade All', $total_plugin_upgrades, 'mainwp'); ?> </a><?php } else { ?> <a class="button" disabled="disabled"><?php _e('No Upgrades', 'mainwp'); ?> </a> <?php } } } ?> </span> </div> <div id="wp_plugin_upgrades" style="display: none"> <?php if ($userExtension->site_view == 1) { @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if ($website->is_ignorePluginUpdates) { continue; } $plugin_upgrades = json_decode($website->plugin_upgrades, true); $decodedPremiumUpgrades = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'premium_upgrades'), true); if (is_array($decodedPremiumUpgrades)) { foreach ($decodedPremiumUpgrades as $crrSlug => $premiumUpgrade) { $premiumUpgrade['premium'] = true; if ($premiumUpgrade['type'] == 'plugin') { if (!is_array($plugin_upgrades)) { $plugin_upgrades = array(); } $plugin_upgrades[$crrSlug] = $premiumUpgrade; } } } $ignored_plugins = json_decode($website->ignored_plugins, true); if (is_array($ignored_plugins)) { $plugin_upgrades = array_diff_key($plugin_upgrades, $ignored_plugins); } $ignored_plugins = json_decode($userExtension->ignored_plugins, true); if (is_array($ignored_plugins)) { $plugin_upgrades = array_diff_key($plugin_upgrades, $ignored_plugins); } if ($globalView) { ?> <div class="mainwp-row"> <span class="mainwp-left-col"><a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a><input type="hidden" id="wp_upgraded_plugin_<?php echo $website->id; ?> " value="<?php if (count($plugin_upgrades) > 0) { echo '0'; } else { echo '1'; } ?> "/></span> <span class="mainwp-mid-col" id="wp_upgrade_plugin_<?php echo $website->id; ?> "> <?php if (count($plugin_upgrades) > 0) { ?> <a href="#" id="mainwp_plugin_upgrades_<?php echo $website->id; ?> _show" onClick="return rightnow_show('plugin_upgrades_<?php echo $website->id; ?> ', true);"> <?php echo count($plugin_upgrades); ?> <?php echo _n('Upgrade', 'Upgrades', count($plugin_upgrades), 'mainwp'); ?> </a> <?php } else { if ($website->sync_errors != '') { echo __('Site Error - No update Information available', 'mainwp'); } else { echo __('Hooray, No Updates Available!', 'mainwp'); } } ?> </span> <span class="mainwp-right-col"> <div id="wp_upgradebuttons_plugin_<?php echo $website->id; ?> "> <?php if (mainwp_current_user_can('dashboard', 'update_plugins')) { if (count($plugin_upgrades) > 0) { ?> <a href="#" class="mainwp-upgrade-button button" onClick="return rightnow_upgrade_plugin_all(<?php echo $website->id; ?> )"><?php echo _n('Upgrade', 'Upgrade All', count($plugin_upgrades), 'mainwp'); ?> </a> <?php } ?> <?php } ?> <a href="<?php echo $website->url; ?> " target="_blank" class="mainwp-open-button button"><?php _e('Open', 'mainwp'); ?> </a> </div> </span> </div> <?php } ?> <div id="wp_plugin_upgrades_<?php echo $website->id; ?> " site_id="<?php echo $website->id; ?> " site_name="<?php echo rawurlencode($website->name); ?> " <?php if ($globalView) { ?> style="display: none"<?php } ?> > <?php foreach ($plugin_upgrades as $plugin_name => $plugin_upgrade) { $plugin_name = urlencode($plugin_name); ?> <div class="mainwp-row" plugin_slug="<?php echo $plugin_name; ?> " premium="<?php echo isset($plugin_upgrade['premium']) ? $plugin_upgrade['premium'] : 0 ? 1 : 0; ?> " updated="0"> <span class="mainwp-left-col"> <?php if ($globalView) { ?> <?php } ?> <a href="<?php echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_upgrade['update']['slug'] . '&url=' . (isset($plugin_upgrade['PluginURI']) ? rawurlencode($plugin_upgrade['PluginURI']) : '') . '&name=' . rawurlencode($plugin_upgrade['Name']) . '&TB_iframe=true&width=640&height=477'; ?> " target="_blank" class="thickbox" title="More information about <?php echo $plugin_upgrade['Name']; ?> "> <?php echo $plugin_upgrade['Name']; ?> </a> <input type="hidden" id="wp_upgraded_plugin_<?php echo $website->id; ?> _<?php echo $plugin_name; ?> " value="0"/> </span> <span class="mainwp-mid-col pluginsInfo" id="wp_upgrade_plugin_<?php echo $website->id; ?> _<?php echo $plugin_name; ?> "> <?php echo $plugin_upgrade['Version']; ?> to <?php echo $plugin_upgrade['update']['new_version']; ?> </span> <span class="mainwp-right-col pluginsAction"> <div id="wp_upgradebuttons_plugin_<?php echo $website->id; ?> _<?php echo $plugin_name; ?> "> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <a href="#" onClick="return rightnow_plugins_ignore_detail('<?php echo $plugin_name; ?> ', '<?php echo urlencode($plugin_upgrade['Name']); ?> ', <?php echo $website->id; ?> )" class="button"><?php _e('Ignore', 'mainwp'); ?> </a> <?php } ?> <?php if (mainwp_current_user_can('dashboard', 'update_plugins')) { ?> <a href="#" class="mainwp-upgrade-button button" onClick="return rightnow_upgrade_plugin(<?php echo $website->id; ?> , '<?php echo $plugin_name; ?> ')"><?php _e('Upgrade', 'mainwp'); ?> </a> <?php } ?> </div> </span> </div> <?php } ?> </div> <?php } } else { foreach ($allPlugins as $slug => $cnt) { $plugin_name = urlencode($slug); if ($globalView) { ?> <div class="mainwp-row"> <span class="mainwp-left-col"> <a href="<?php echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . $pluginsInfo[$slug]['slug'] . '&url=' . (isset($pluginsInfo[$slug]['uri']) ? rawurlencode($pluginsInfo[$slug]['uri']) : '') . '&name=' . rawurlencode($pluginsInfo[$slug]['name']) . '&TB_iframe=true&width=640&height=477'; ?> " target="_blank" class="thickbox" title="More information about <?php echo $pluginsInfo[$slug]['name']; ?> "> <?php echo $pluginsInfo[$slug]['name']; ?> </a> </span> <span class="mainwp-mid-col"> <a href="#" onClick="return rightnow_plugins_detail('<?php echo $plugin_name; ?> ');"> <?php echo $cnt; ?> <?php _e('Upgrade', 'mainwp'); echo $cnt > 1 ? 's' : ''; ?> </a> </span> <span class="mainwp-right-col"> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <a href="#" class="button" onClick="return rightnow_plugins_ignore_all('<?php echo $plugin_name; ?> ', '<?php echo urlencode($pluginsInfo[$slug]['name']); ?> ')"><?php _e('Ignore Globally', 'mainwp'); ?> </a> <?php } ?> <?php if (mainwp_current_user_can('dashboard', 'update_plugins')) { ?> <?php if ($cnt > 0) { ?> <a href="#" class="mainwp-upgrade-button button" onClick="return rightnow_plugins_upgrade_all('<?php echo $plugin_name; ?> ', '<?php echo urlencode($pluginsInfo[$slug]['name']); ?> ')"><?php echo _n('Upgrade', 'Upgrade All', $cnt, 'mainwp'); ?> </a><?php } else { ?> <a class="button" disabled="disabled"><?php _e('No Upgrades', 'mainwp'); ?> </a> <?php } ?> <?php } ?> </span> </div> <?php } ?> <div plugin_slug="<?php echo $plugin_name; ?> " plugin_name="<?php echo urlencode($pluginsInfo[$slug]['name']); ?> " premium="<?php echo $pluginsInfo[$slug]['premium'] ? 1 : 0; ?> " <?php if ($globalView) { ?> style="display: none"<?php } ?> > <?php @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if ($website->is_ignorePluginUpdates) { continue; } $plugin_upgrades = json_decode($website->plugin_upgrades, true); $decodedPremiumUpgrades = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'premium_upgrades'), true); if (is_array($decodedPremiumUpgrades)) { foreach ($decodedPremiumUpgrades as $crrSlug => $premiumUpgrade) { $premiumUpgrade['premium'] = true; if ($premiumUpgrade['type'] == 'plugin') { if (!is_array($plugin_upgrades)) { $plugin_upgrades = array(); } $plugin_upgrades[$crrSlug] = $premiumUpgrade; } } } $ignored_plugins = json_decode($website->ignored_plugins, true); if (is_array($ignored_plugins)) { $plugin_upgrades = array_diff_key($plugin_upgrades, $ignored_plugins); } if (!isset($plugin_upgrades[$slug])) { continue; } $plugin_upgrade = $plugin_upgrades[$slug]; ?> <div class="mainwp-row" site_id="<?php echo $website->id; ?> " site_name="<?php echo rawurlencode($website->name); ?> " updated="0"> <span class="mainwp-left-col"> <?php if ($globalView) { ?> <a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a> <?php } else { ?> <a href="<?php echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . $pluginsInfo[$slug]['slug'] . '&TB_iframe=true&width=640&height=477'; ?> " target="_blank" class="thickbox" title="More information about <?php echo $pluginsInfo[$slug]['name']; ?> "> <?php echo $pluginsInfo[$slug]['name']; ?> </a> <?php } ?> </span> <span class="mainwp-mid-col pluginsInfo"><?php echo $plugin_upgrade['Version']; ?> to <?php echo $plugin_upgrade['update']['new_version']; ?> </span> <span class="mainwp-right-col pluginsAction"> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <a href="#" class="button" onClick="return rightnow_plugins_ignore_detail('<?php echo $plugin_name; ?> ', '<?php echo urlencode($plugin_upgrade['Name']); ?> ', <?php echo $website->id; ?> )"><?php _e('Ignore', 'mainwp'); ?> </a> <?php } ?> <?php if (mainwp_current_user_can('dashboard', 'update_plugins')) { ?> <a href="#" class="mainwp-upgrade-button button" onClick="return rightnow_plugins_upgrade('<?php echo $plugin_name; ?> ', <?php echo $website->id; ?> )"><?php _e('Upgrade', 'mainwp'); ?> </a> <?php } ?> </span> </div> <?php } ?> </div> <?php } } ?> </div> </div> <?php //WP theme upgrades! ?> <div class="clear"> <div class="mainwp-row"> <span class="mainwp-left-col"> <a href="#" id="mainwp_theme_upgrades_show" onClick="return rightnow_show('theme_upgrades', true);"> <span class="mainwp-rightnow-number"><?php echo $total_theme_upgrades; ?> </span> <?php _e('Theme upgrade', 'mainwp'); if ($total_theme_upgrades != 1) { ?> s<?php } ?> <?php _e('available', 'mainwp'); ?> </a> </span> <span class="mainwp-mid-col"><a href="<?php echo admin_url('admin.php?page=ThemesIgnore'); ?> "><?php _e('Ignored', 'mainwp'); ?> (<?php echo $total_themesIgnored; ?> )</a></span> <span class="mainwp-right-col"> <?php if (mainwp_current_user_can('dashboard', 'update_themes')) { ?> <?php if ($total_theme_upgrades > 0 && $userExtension->site_view == 1) { ?> <a href="#" onClick="return rightnow_themes_global_upgrade_all();" class="button-primary"><?php echo _n('Upgrade', 'Upgrade All', $total_theme_upgrades, 'mainwp'); ?> </a><?php } else { if ($total_theme_upgrades > 0 && $userExtension->site_view == 0) { ?> <a href="#" onClick="return rightnow_themes_global_upgrade_all();" class="button-primary"><?php echo _n('Upgrade', 'Upgrade All', $total_theme_upgrades, 'mainwp'); ?> </a><?php } else { ?> <a class="button" disabled="disabled"><?php _e('No Upgrades', 'mainwp'); ?> </a> <?php } } ?> <?php } ?> </span> </div> <div id="wp_theme_upgrades" style="display: none"> <?php if ($userExtension->site_view == 1) { @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if ($website->is_ignoreThemeUpdates) { continue; } $theme_upgrades = json_decode($website->theme_upgrades, true); $decodedPremiumUpgrades = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'premium_upgrades'), true); if (is_array($decodedPremiumUpgrades)) { foreach ($decodedPremiumUpgrades as $crrSlug => $premiumUpgrade) { $premiumUpgrade['premium'] = true; if ($premiumUpgrade['type'] == 'theme') { if (!is_array($theme_upgrades)) { $theme_upgrades = array(); } $theme_upgrades[$crrSlug] = $premiumUpgrade; } } } $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); } if ($globalView) { ?> <div class="mainwp-row"> <span class="mainwp-left-col"><a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a><input type="hidden" id="wp_upgraded_theme_<?php echo $website->id; ?> " value="<?php if (count($theme_upgrades) > 0) { echo '0'; } else { echo '1'; } ?> "/></span> <span class="mainwp-mid-col" id="wp_upgrade_theme_<?php echo $website->id; ?> "> <?php if (count($theme_upgrades) > 0) { ?> <a href="#" id="mainwp_theme_upgrades_<?php echo $website->id; ?> _show" onClick="return rightnow_show('theme_upgrades_<?php echo $website->id; ?> ', true);"> <?php echo count($theme_upgrades); ?> <?php echo _n('Upgrade', 'Upgrades', count($theme_upgrades), 'mainwp'); ?> </a> <?php } else { if ($website->sync_errors != '') { echo __('Site Error - No update Information available', 'mainwp'); } else { echo __('Hooray, No Updates Available!', 'mainwp'); } } ?> </span> <span class="mainwp-right-col"> <div id="wp_upgradebuttons_theme_<?php echo $website->id; ?> "> <?php if (mainwp_current_user_can('dashboard', 'update_themes')) { ?> <?php if (count($theme_upgrades) > 0) { ?> <a href="#" class="mainwp-upgrade-button button" onClick="return rightnow_upgrade_theme_all(<?php echo $website->id; ?> )"><?php echo _n('Upgrade', 'Upgrade All', count($theme_upgrades), 'mainwp'); ?> </a> <?php } ?> <?php } ?> <a href="<?php echo $website->url; ?> " target="_blank" class="mainwp-open-button button"><?php _e('Open', 'mainwp'); ?> </a> </div> </span> </div> <?php } ?> <div id="wp_theme_upgrades_<?php echo $website->id; ?> " site_id="<?php echo $website->id; ?> " site_name="<?php echo rawurlencode($website->name); ?> " <?php if ($globalView) { ?> style="display: none"<?php } ?> > <?php foreach ($theme_upgrades as $theme_name => $theme_upgrade) { $theme_name = urlencode($theme_name); ?> <div class="mainwp-row" theme_slug="<?php echo $theme_name; ?> " theme_name="<?php echo $theme_upgrade['Name']; ?> " premium="<?php echo isset($themesInfo[$theme_name]['premium']) && $themesInfo[$theme_name]['premium'] ? 1 : 0; ?> " updated="0"> <span class="mainwp-left-col"><?php if ($globalView) { ?> <?php } echo $theme_upgrade['Name']; ?> <input type="hidden" id="wp_upgraded_theme_<?php echo $website->id; ?> _<?php echo $theme_name; ?> " value="0"/></span> <span class="mainwp-mid-col pluginsInfo" id="wp_upgrade_theme_<?php echo $website->id; ?> _<?php echo $theme_name; ?> "><?php echo $theme_upgrade['Version']; ?> to <?php echo $theme_upgrade['update']['new_version']; ?> </span> <span class="mainwp-right-col pluginsAction"> <div id="wp_upgradebuttons_theme_<?php echo $website->id; ?> _<?php echo $theme_name; ?> "> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <a href="#" class="button" onClick="return rightnow_themes_ignore_detail('<?php echo $theme_name; ?> ', '<?php echo urlencode($theme_upgrade['Name']); ?> ', <?php echo $website->id; ?> )"><?php _e('Ignore', 'mainwp'); ?> </a> <?php } ?> <?php if (mainwp_current_user_can('dashboard', 'update_themes')) { ?> <a href="#" class="mainwp-upgrade-button button" onClick="rightnow_upgrade_theme(<?php echo $website->id; ?> , '<?php echo $theme_name; ?> ')"><?php _e('Upgrade', 'mainwp'); ?> </a> <?php } ?> </div> </span> </div> <?php } ?> </div> <?php } } else { foreach ($allThemes as $slug => $cnt) { $theme_name = urlencode($slug); if ($globalView) { ?> <div class="mainwp-row"> <span class="mainwp-left-col"> <?php echo $themesInfo[$slug]['name']; ?> </span> <span class="mainwp-mid-col"> <a href="#" onClick="return rightnow_themes_detail('<?php echo $theme_name; ?> ');"> <?php echo $cnt; ?> <?php echo _n('Upgrade', 'Upgrades', $cnt, 'mainwp'); ?> </a> </span> <span class="mainwp-right-col"> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <a href="#" class="button" onClick="return rightnow_themes_ignore_all('<?php echo $theme_name; ?> ', '<?php echo urlencode($themesInfo[$slug]['name']); ?> ')"><?php _e('Ignore Globally', 'mainwp'); ?> </a> <?php } ?> <?php if (mainwp_current_user_can('dashboard', 'update_themes')) { ?> <?php if ($cnt > 0) { ?> <a href="#" class="mainwp-upgrade-button button" onClick="return rightnow_themes_upgrade_all('<?php echo $theme_name; ?> ', '<?php echo urlencode($themesInfo[$slug]['name']); ?> ')"><?php echo _n('Upgrade', 'Upgrade All', $cnt, 'mainwp'); ?> </a><?php } else { ?> <a class="button" disabled="disabled"><?php _e('No Upgrades', 'mainwp'); ?> </a> <?php } ?> <?php } ?> </span> </div> <?php } ?> <div theme_slug="<?php echo $theme_name; ?> " theme_name="<?php echo urlencode($themesInfo[$slug]['name']); ?> " premium="<?php echo $themesInfo[$slug]['premium'] ? 1 : 0; ?> " <?php if ($globalView) { ?> style="display: none"<?php } ?> > <?php @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if ($website->is_ignoreThemeUpdates) { continue; } $theme_upgrades = json_decode($website->theme_upgrades, true); $decodedPremiumUpgrades = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'premium_upgrades'), true); if (is_array($decodedPremiumUpgrades)) { foreach ($decodedPremiumUpgrades as $crrSlug => $premiumUpgrade) { $premiumUpgrade['premium'] = true; if ($premiumUpgrade['type'] == 'theme') { if (!is_array($theme_upgrades)) { $theme_upgrades = array(); } $theme_upgrades[$crrSlug] = $premiumUpgrade; } } } $ignored_themes = json_decode($website->ignored_themes, true); if (is_array($ignored_themes)) { $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes); } if (!isset($theme_upgrades[$slug])) { continue; } $theme_upgrade = $theme_upgrades[$slug]; ?> <div class="mainwp-row" site_id="<?php echo $website->id; ?> " site_name="<?php echo rawurlencode($website->name); ?> " updated="0"> <span class="mainwp-left-col"> <?php if ($globalView) { ?> <a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a> <?php } else { echo $themesInfo[$slug]['name']; } ?> </span> <span class="mainwp-mid-col pluginsInfo"><?php echo $theme_upgrade['Version']; ?> to <?php echo $theme_upgrade['update']['new_version']; ?> </span> <span class="mainwp-right-col pluginsAction"> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <a href="#" class="button" onClick="return rightnow_themes_ignore_detail('<?php echo $theme_name; ?> ', '<?php echo urlencode($theme_upgrade['Name']); ?> ', <?php echo $website->id; ?> )"><?php _e('Ignore', 'mainwp'); ?> </a> <?php } ?> <?php if (mainwp_current_user_can('dashboard', 'update_themes')) { ?> <a href="#" class="mainwp-upgrade-button button" onClick="return rightnow_themes_upgrade('<?php echo $theme_name; ?> ', <?php echo $website->id; ?> )"><?php _e('Upgrade', 'mainwp'); ?> </a> <?php } ?> </span> </div> <?php } ?> </div> <?php } } ?> </div> </div> <?php //WP plugin Abandoned! ?> <div class="clear"> <div class="mainwp-row"> <span class="mainwp-left-col"> <a href="#" id="mainwp_plugins_outdate_show" onClick="return rightnow_show('plugins_outdate', true);"> <span class="mainwp-rightnow-number"><?php echo $total_plugins_outdate; ?> </span> <?php echo _n('Plugin', 'Plugins', $total_plugins_outdate, 'mainwp'); ?> <?php _e('Possibly Abandoned', 'mainwp'); ?> </a> <?php MainWP_Utility::renderToolTip(__('This feature checks the last updated status of plugins and alerts you if not updated in a specific amount of time. This gives you insight on if a plugin may have been abandoned by the author.', 'mainwp'), 'http://docs.mainwp.com/what-does-possibly-abandoned-mean/', 'images/info.png', 'float: none !important;'); ?> </span> <span class="mainwp-mid-col"><a href="<?php echo admin_url('admin.php?page=PluginsIgnoredAbandoned'); ?> "><?php _e('Ignored', 'mainwp'); ?> (<?php echo $total_pluginsIgnoredAbandoned; ?> )</a></span> <span class="mainwp-right-col"></span> </div> <div id="wp_plugins_outdate" style="display: none"> <?php $str_format = __('Last Updated %s Days Ago', 'mainwp'); if ($userExtension->site_view == 1) { @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { $plugins_outdate = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'plugins_outdate_info'), true); if (!is_array($plugins_outdate)) { $plugins_outdate = array(); } if (count($plugins_outdate) > 0) { $pluginsOutdateDismissed = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'plugins_outdate_dismissed'), true); if (is_array($pluginsOutdateDismissed)) { $plugins_outdate = array_diff_key($plugins_outdate, $pluginsOutdateDismissed); } if (is_array($decodedDismissedPlugins)) { $plugins_outdate = array_diff_key($plugins_outdate, $decodedDismissedPlugins); } } if ($globalView) { ?> <div class="mainwp-row"> <span class="mainwp-left-col"><a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a><input type="hidden" id="wp_upgraded_plugin_<?php echo $website->id; ?> " value="<?php if (count($plugins_outdate) > 0) { echo '0'; } else { echo '1'; } ?> "/></span> <span class="mainwp-mid-col" id="wp_outdate_plugin_<?php echo $website->id; ?> "> <?php if (count($plugins_outdate) > 0) { ?> <a href="#" id="mainwp_plugins_outdate_<?php echo $website->id; ?> _show" onClick="return rightnow_show('plugins_outdate_<?php echo $website->id; ?> ', true);"> <?php echo count($plugins_outdate); ?> <?php echo _n('Plugin', 'Plugins', count($plugins_outdate), 'mainwp'); ?> </a> <?php } else { if ($website->sync_errors != '') { echo __('Site Error - No update Information available', 'mainwp'); } else { echo __('Hooray, No Abandoned Plugins!', 'mainwp'); } } ?> </span> <span class="mainwp-right-col"><div id="wp_upgradebuttons_plugin_<?php echo $website->id; ?> "> <a href="<?php echo $website->url; ?> " target="_blank" class="mainwp-open-button button"><?php _e('Open', 'mainwp'); ?> </a> </div></span> </div> <?php } ?> <div id="wp_plugins_outdate_<?php echo $website->id; ?> " site_id="<?php echo $website->id; ?> " site_name="<?php echo rawurlencode($website->name); ?> " <?php if ($globalView) { ?> style="display: none"<?php } ?> > <?php foreach ($plugins_outdate as $slug => $plugin_outdate) { $plugin_name = urlencode($slug); $now = new \DateTime(); $last_updated = $plugin_outdate['last_updated']; $plugin_last_updated_date = new \DateTime('@' . $last_updated); $diff_in_days = $now->diff($plugin_last_updated_date)->format('%a'); $outdate_notice = sprintf($str_format, $diff_in_days); ?> <div class="mainwp-row" plugin_outdate_slug="<?php echo $plugin_name; ?> " dismissed="0"> <span class="mainwp-left-col"> <?php if ($globalView) { ?> <?php } ?> <a href="<?php echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . dirname($slug) . '&url=' . (isset($plugin_outdate['PluginURI']) ? rawurlencode($plugin_outdate['PluginURI']) : '') . '&name=' . rawurlencode($plugin_outdate['Name']) . '&TB_iframe=true&width=640&height=477'; ?> " target="_blank" class="thickbox" title="More information about <?php echo $plugin_outdate['Name']; ?> "><?php echo $plugin_outdate['Name']; ?> </a><input type="hidden" id="wp_dismissed_plugin_<?php echo $website->id; ?> _<?php echo $plugin_name; ?> " value="0"/></span> <span class="mainwp-mid-col pluginsInfo" id="wp_outdate_plugin_<?php echo $website->id; ?> _<?php echo $plugin_name; ?> "><?php echo $plugin_outdate['Version']; ?> | <?php echo $outdate_notice; ?> </span> <span class="mainwp-right-col pluginsAction"> <div id="wp_dismissbuttons_plugin_<?php echo $website->id; ?> _<?php echo $plugin_name; ?> "> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <a href="#" class="button" onClick="return rightnow_plugins_dismiss_outdate_detail('<?php echo $plugin_name; ?> ', '<?php echo urlencode($plugin_outdate['Name']); ?> ', <?php echo $website->id; ?> )"><?php _e('Ignore', 'mainwp'); ?> </a> <?php } ?> </div> </span> </div> <?php } ?> </div> <?php } } else { foreach ($allPluginsOutdate as $slug => $cnt) { $plugin_name = urlencode($slug); if ($globalView) { ?> <div class="mainwp-row"> <span class="mainwp-left-col"> <a href="<?php echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . dirname($slug) . '&url=' . (isset($pluginsOutdateInfo[$slug]['uri-']) ? rawurlencode($pluginsOutdateInfo[$slug]['uri']) : '') . '&name=' . rawurlencode($pluginsOutdateInfo[$slug]['Name']) . '&TB_iframe=true&width=640&height=477'; ?> " target="_blank" class="thickbox" title="More information about <?php echo $pluginsOutdateInfo[$slug]['Name']; ?> "> <?php echo $pluginsOutdateInfo[$slug]['Name']; ?> </a> </span> <span class="mainwp-mid-col"> <a href="#" onClick="return rightnow_plugins_outdate_detail('<?php echo $plugin_name; ?> ');"> <?php echo $cnt; ?> <?php echo _n('Plugin', 'Plugins', $cnt, 'mainwp'); ?> </a> </span> <span class="mainwp-right-col"> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <a href="#" class="button" onClick="return rightnow_plugins_abandoned_ignore_all('<?php echo $plugin_name; ?> ', '<?php echo urlencode($pluginsOutdateInfo[$slug]['Name']); ?> ')"><?php _e('Ignore Globally', 'mainwp'); ?> </a> <?php } ?> </span> </div> <?php } ?> <div plugin_outdate_slug="<?php echo $plugin_name; ?> " plugin_name="<?php echo urlencode($pluginsOutdateInfo[$slug]['Name']); ?> " <?php if ($globalView) { ?> style="display: none"<?php } ?> > <?php @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { $plugins_outdate = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'plugins_outdate_info'), true); if (!is_array($plugins_outdate)) { $plugins_outdate = array(); } if (count($plugins_outdate) > 0) { $pluginsOutdateDismissed = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'plugins_outdate_dismissed'), true); if (is_array($pluginsOutdateDismissed)) { $plugins_outdate = array_diff_key($plugins_outdate, $pluginsOutdateDismissed); } if (is_array($decodedDismissedPlugins)) { $plugins_outdate = array_diff_key($plugins_outdate, $decodedDismissedPlugins); } } if (!isset($plugins_outdate[$slug])) { continue; } $plugin_outdate = $plugins_outdate[$slug]; $now = new \DateTime(); $last_updated = $plugin_outdate['last_updated']; $plugin_last_updated_date = new \DateTime('@' . $last_updated); $diff_in_days = $now->diff($plugin_last_updated_date)->format('%a'); $outdate_notice = sprintf($str_format, $diff_in_days); ?> <div class="mainwp-row" site_id="<?php echo $website->id; ?> " site_name="<?php echo rawurlencode($website->name); ?> " outdate="1"> <span class="mainwp-left-col"> <?php if ($globalView) { ?> <a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a> <?php } else { ?> <a href="<?php echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . dirname($slug) . '&TB_iframe=true&width=640&height=477'; ?> " target="_blank" class="thickbox" title="More information about <?php echo $pluginsOutdateInfo[$slug]['Name']; ?> "> <?php echo $pluginsOutdateInfo[$slug]['Name']; ?> </a> <?php } ?> </span> <span class="mainwp-mid-col pluginsInfo" id="wp_outdate_plugin_<?php echo $website->id; ?> _<?php echo $plugin_name; ?> "><?php echo $plugin_outdate['Version']; ?> | <?php echo $outdate_notice; ?> </span> <span class="mainwp-right-col pluginsAction"> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <a href="#" class="button" onClick="return rightnow_plugins_dismiss_outdate_detail('<?php echo $plugin_name; ?> ', '<?php echo urlencode($plugin_outdate['Name']); ?> ', <?php echo $website->id; ?> )"><?php _e('Ignore', 'mainwp'); ?> </a> <?php } ?> </span> </div> <?php } ?> </div> <?php } } ?> </div> </div> <?php //WP theme Abandoned! ?> <div class="clear"> <div class="mainwp-row"> <span class="mainwp-left-col"> <a href="#" id="mainwp_themes_outdate_show" onClick="return rightnow_show('themes_outdate', true);"> <span class="mainwp-rightnow-number"><?php echo $total_themes_outdate; ?> </span> <?php echo _n('Theme', 'Themes', $total_themes_outdate, 'mainwp'); ?> <?php _e('Possibly Abandoned', 'mainwp'); ?> </a> <?php MainWP_Utility::renderToolTip(__('This feature checks the last updated status of themes and alerts you if not updated in a specific amount of time. This gives you insight on if a theme may have been abandoned by the author.', 'mainwp'), 'http://docs.mainwp.com/what-does-possibly-abandoned-mean/', 'images/info.png', 'float: none !important;'); ?> </span> <span class="mainwp-mid-col"><a href="<?php echo admin_url('admin.php?page=ThemesIgnoredAbandoned'); ?> "><?php _e('Ignored', 'mainwp'); ?> (<?php echo $total_themesIgnoredAbandoned; ?> )</a></span> <span class="mainwp-right-col"></span> </div> <div id="wp_themes_outdate" style="display: none"> <?php if ($userExtension->site_view == 1) { @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { $themes_outdate = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_info'), true); if (!is_array($themes_outdate)) { $themes_outdate = array(); } if (count($themes_outdate) > 0) { $themesOutdateDismissed = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_dismissed'), true); if (is_array($themesOutdateDismissed)) { $themes_outdate = array_diff_key($themes_outdate, $themesOutdateDismissed); } if (is_array($decodedDismissedThemes)) { $themes_outdate = array_diff_key($themes_outdate, $decodedDismissedThemes); } } if ($globalView) { ?> <div class="mainwp-row"> <span class="mainwp-left-col"><a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a><input type="hidden" id="wp_upgraded_theme_<?php echo $website->id; ?> " value="<?php if (count($themes_outdate) > 0) { echo '0'; } else { echo '1'; } ?> "/></span> <span class="mainwp-mid-col" id="wp_outdate_theme_<?php echo $website->id; ?> "> <?php if (count($themes_outdate) > 0) { ?> <a href="#" id="mainwp_themes_outdate_<?php echo $website->id; ?> _show" onClick="return rightnow_show('themes_outdate_<?php echo $website->id; ?> ', true);"> <?php echo count($themes_outdate); ?> <?php echo _n('Theme', 'Themes', count($themes_outdate), 'mainwp'); ?> </a> <?php } else { if ($website->sync_errors != '') { echo __('Site Error - No update Information available', 'mainwp'); } else { echo __('Hooray, No Abandoned Themes!', 'mainwp'); } } ?> </span> <span class="mainwp-right-col"><div id="wp_upgradebuttons_theme_<?php echo $website->id; ?> "> <a href="<?php echo $website->url; ?> " target="_blank" class="mainwp-open-button button"><?php _e('Open', 'mainwp'); ?> </a> </div></span> </div> <?php } ?> <div id="wp_themes_outdate_<?php echo $website->id; ?> " site_id="<?php echo $website->id; ?> " site_name="<?php echo rawurlencode($website->name); ?> " <?php if ($globalView) { ?> style="display: none"<?php } ?> > <?php foreach ($themes_outdate as $slug => $theme_outdate) { $slug = urlencode($slug); $now = new \DateTime(); $last_updated = $theme_outdate['last_updated']; $theme_last_updated_date = new \DateTime('@' . $last_updated); $diff_in_days = $now->diff($theme_last_updated_date)->format('%a'); $outdate_notice = sprintf($str_format, $diff_in_days); ?> <div class="mainwp-row" theme_outdate_slug="<?php echo $slug; ?> " dismissed="0"> <span class="mainwp-left-col"> <?php if ($globalView) { ?> <?php } echo $theme_outdate['Name']; ?> <input type="hidden" id="wp_dismissed_theme_<?php echo $website->id; ?> _<?php echo $slug; ?> " value="0"/></span> <span class="mainwp-mid-col pluginsInfo" id="wp_outdate_theme_<?php echo $website->id; ?> _<?php echo $slug; ?> "><?php echo $theme_outdate['Version']; ?> | <?php echo $outdate_notice; ?> </span> <span class="mainwp-right-col pluginsAction"> <div id="wp_dismissbuttons_theme_<?php echo $website->id; ?> _<?php echo $slug; ?> "> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <a href="#" class="button" onClick="return rightnow_themes_dismiss_outdate_detail('<?php echo $slug; ?> ', '<?php echo urlencode($theme_outdate['Name']); ?> ', <?php echo $website->id; ?> )"><?php _e('Ignore', 'mainwp'); ?> </a> <?php } ?> </div> </span> </div> <?php } ?> </div> <?php } } else { foreach ($allThemesOutdate as $slug => $cnt) { $slug = urlencode($slug); if ($globalView) { ?> <div class="mainwp-row"> <span class="mainwp-left-col"> <?php echo $themesOutdateInfo[$slug]['name']; ?> </span> <span class="mainwp-mid-col"> <a href="#" onClick="return rightnow_themes_outdate_detail('<?php echo $slug; ?> ');"> <?php echo $cnt; ?> <?php echo _n('Theme', 'Themes', $cnt, 'mainwp'); ?> </a> </span> <span class="mainwp-right-col"> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <a href="#" class="button" onClick="return rightnow_themes_abandoned_ignore_all('<?php echo $slug; ?> ', '<?php echo urlencode($themesOutdateInfo[$slug]['name']); ?> ')"><?php _e('Ignore Globally', 'mainwp'); ?> </a> <?php } ?> </span> </div> <?php } ?> <div theme_outdate_slug="<?php echo $slug; ?> " theme_name="<?php echo urlencode($themesOutdateInfo[$slug]['name']); ?> " <?php if ($globalView) { ?> style="display: none"<?php } ?> > <?php @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { $themes_outdate = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_info'), true); if (!is_array($themes_outdate)) { $themes_outdate = array(); } if (count($themes_outdate) > 0) { $themesOutdateDismissed = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_dismissed'), true); if (is_array($themesOutdateDismissed)) { $themes_outdate = array_diff_key($themes_outdate, $themesOutdateDismissed); } if (is_array($decodedDismissedThemes)) { $themes_outdate = array_diff_key($themes_outdate, $decodedDismissedThemes); } } if (!isset($themes_outdate[$slug])) { continue; } $theme_outdate = $themes_outdate[$slug]; $now = new \DateTime(); $last_updated = $theme_outdate['last_updated']; $theme_last_updated_date = new \DateTime('@' . $last_updated); $diff_in_days = $now->diff($theme_last_updated_date)->format('%a'); $outdate_notice = sprintf($str_format, $diff_in_days); ?> <div class="mainwp-row" site_id="<?php echo $website->id; ?> " site_name="<?php echo rawurlencode($website->name); ?> " outdate="1"> <span class="mainwp-left-col"> <?php if ($globalView) { ?> <a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a> <?php } else { ?> <?php echo $themesOutdateInfo[$slug]['name']; ?> <?php } ?> </span> <span class="mainwp-mid-col pluginsInfo" id="wp_outdate_theme_<?php echo $website->id; ?> _<?php echo $slug; ?> "><?php echo $theme_outdate['Version']; ?> | <?php echo $outdate_notice; ?> </span> <span class="mainwp-right-col pluginsAction"> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <a href="#" class="button" onClick="return rightnow_themes_dismiss_outdate_detail('<?php echo $slug; ?> ', '<?php echo urlencode($themesOutdateInfo[$slug]['name']); ?> ', <?php echo $website->id; ?> )"><?php _e('Ignore', 'mainwp'); ?> </a> <?php } ?> </span> </div> <?php } ?> </div> <?php } } ?> </div> </div> <?php //Sync errors! if ($total_sync_errors > 0) { ?> <div class="clear"> <div class="mainwp-row"> <span class="mainwp-left-col"> <a href="#" id="mainwp_errors_show" onClick="return rightnow_show('errors', true);"> <span class="mainwp-rightnow-number"><?php echo $total_sync_errors; ?> </span> Error<?php if ($total_sync_errors > 1) { ?> s<?php } ?> </a> </span> <span class="mainwp-mid-col"> </span> <span class="mainwp-right-col"></span> </div> <div id="wp_errors" style="display: none"> <?php @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if ($website->sync_errors == '') { continue; } ?> <div class="mainwp-row"> <span class="mainwp-left-col"><a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a></span> <span class="mainwp-mid-col"><?php echo $website->sync_errors; ?> </span> <span class="mainwp-right-col"><a href="#" class="mainwp_rightnow_site_reconnect" siteid="<?php echo $website->id; ?> "><?php _e('Reconnect', 'mainwp'); ?> </a> | <a href="<?php echo $website->url; ?> " target="_blank"><?php _e('Open', 'mainwp'); ?> </a></span> </div> <?php } ?> </div> </div> <?php } ?> <?php //Good - some are up to date! if ($total_uptodate > 0) { ?> <div class="clear"> <div class="mainwp-row"> <span class="mainwp-left-col"> <a href="#" id="mainwp_uptodate_show" onClick="return rightnow_show('uptodate', true);"> <span class="mainwp-rightnow-number"><?php echo $total_uptodate; ?> </span> <?php _e('Up to date', 'mainwp'); ?> </a> </span> <span class="mainwp-mid-col"> </span> <span class="mainwp-right-col"></span> </div> <div id="wp_uptodate" style="display: none"> <?php @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if ($website->uptodate != 1) { continue; } ?> <div class="mainwp-row"> <span class="mainwp-left-col"><a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a></span> <span class="mainwp-mid-col"> </span> <span class="mainwp-right-col"><a href="<?php echo $website->url; ?> " target="_blank"><?php _e('Open', 'mainwp'); ?> </a></span> </div> <?php } ?> </div> </div> <?php } ?> <?php @MainWP_DB::data_seek($websites, 0); $site_ids = array(); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { $site_ids[] = $website->id; } do_action('mainwp_rightnow_widget_bottom', $site_ids, $globalView); ?> <div class="clear"> <div class="mainwp-row"> <span class="mainwp-left-col"> <span style="position: relative; top: -5px;"> <?php if ($total_sync_errors > 0) { ?> <span class="fa-stack" title="Disconnected"> <i class="fa fa-circle fa-stack-2x mwp-red"></i> <i class="fa fa-plug fa-stack-1x mwp-white"></i> </span> <?php } else { if ($total_conflict > 0) { ?> <span class="fa-stack" title="Plugin or Theme Conflict found"> <i class="fa fa-circle fa-stack-2x mwp-red"></i> <i class="fa fa-flag fa-stack-1x mwp-white"></i> </span> <?php } else { if ($total_offline > 0) { ?> <span class="fa-stack" title="Site is Offline"> <i class="fa fa-exclamation-circle fa-2x mwp-red"></i> </span> <?php } else { ?> <span class="fa-stack" title="Site is Online"> <i class="fa fa-check-circle fa-2x mwp-l-green"></i> </span> <?php } } } ?> </span><h2 style="display: inline;"><?php _e('Status', 'mainwp'); ?> </h2> </span> <span class="mainwp-mid-col"> </span> <span class="mainwp-right-col"> <a href="#" id="mainwp_status_show" onClick="return rightnow_show('status');"><i class="fa fa-eye-slash"></i> <?php _e('Show', 'mainwp'); ?> </a> </span> </div> <div id="wp_status" style="display: none"> <?php //Loop 3 times, first we show the conflicts, then we show the down sites, then we show the up sites $SYNCERRORS = 0; $CONFLICTS = 1; $DOWN = 2; $UP = 3; for ($j = 0; $j <= 3; $j++) { @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { $pluginConflicts = json_decode($website->pluginConflicts, true); $themeConflicts = json_decode($website->themeConflicts, true); $ignoredPluginConflicts = json_decode($website->ignored_pluginConflicts, true); if (!is_array($ignoredPluginConflicts)) { $ignoredPluginConflicts = array(); } $ignoredThemeConflicts = json_decode($website->ignored_themeConflicts, true); if (!is_array($ignoredThemeConflicts)) { $ignoredThemeConflicts = array(); } $hasSyncErrors = $website->sync_errors != ''; $isConflict = false; if (!$hasSyncErrors) { if (count($pluginConflicts) > 0) { foreach ($pluginConflicts as $pluginConflict) { if (!in_array($pluginConflict, $ignoredPluginConflicts) && !in_array($pluginConflict, $globalIgnoredPluginConflicts)) { $isConflict = true; } } } if (!$isConflict && count($themeConflicts) > 0) { foreach ($themeConflicts as $themeConflict) { if (!in_array($themeConflict, $ignoredThemeConflicts) && !in_array($themeConflict, $globalIgnoredThemeConflicts)) { $isConflict = true; } } } } $isDown = !$hasSyncErrors && !$isConflict && $website->offline_check_result == -1; $isUp = !$hasSyncErrors && !$isConflict && !$isDown; if ($j == $SYNCERRORS && !$hasSyncErrors) { continue; } if ($j == $CONFLICTS && !$isConflict) { continue; } if ($j == $DOWN && !$isDown) { continue; } if ($j == $UP && !$isUp) { continue; } ?> <div class="mainwp-row"> <span class="mainwp-left-col"><a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a></span> <span class="mainwp-mid-col"> <?php if ($isConflict) { ?> <span class="mainwp_status_conflict"><?php _e('Conflict Found', 'mainwp'); ?> </span> <?php } ?> </span> <span class="mainwp-right-col"> <?php if ($hasSyncErrors) { ?> <div style="position: absolute; padding-right: 10px; right: 50px; font-size: 13px;"><a href="#" class="mainwp_rightnow_site_reconnect" siteid="<?php echo $website->id; ?> "><?php _e('Reconnect', 'mainwp'); ?> </a><br /></div> <span class="fa-stack fa-lg" title="Disconnected"> <i class="fa fa-circle fa-stack-2x mwp-red"></i> <i class="fa fa-plug fa-stack-1x mwp-white"></i> </span> <?php } else { if ($isConflict) { ?> <span class="fa-stack fa-lg" title="Plugin or Theme Conflict found"> <i class="fa fa-circle fa-stack-2x mwp-red"></i> <i class="fa fa-flag fa-stack-1x mwp-white"></i> </span> <?php } else { if ($isDown) { ?> <span class="fa-stack fa-lg" title="Site is Offline"> <i class="fa fa-exclamation-circle fa-2x mwp-red"></i> </span> <?php } else { ?> <span class="fa-stack fa-lg" title="Site is Online"> <i class="fa fa-check-circle fa-2x mwp-l-green"></i> </span> <?php } } } ?> </span> </div> <?php } } ?> </div> </div> <div class="clear"></div> <div id="rightnow-upgrade-status-box" title="Upgrade" style="display: none; text-align: center"> <div id="rightnow-upgrade-status-progress"></div> <span id="rightnow-upgrade-status-current">0</span> / <span id="rightnow-upgrade-status-total"></span> <?php _e('upgraded', 'mainwp'); ?> <div style="height: 160px; overflow: auto; margin-top: 20px; margin-bottom: 10px; text-align: left"> <table style="width: 100%" id="rightnow-upgrade-list"> </table> </div> <input id="rightnow-upgrade-status-close" type="button" name="Close" value="<?php _e('Close', 'mainwp'); ?> " class="button"/> </div> <div id="rightnow-backup-box" title="Full backup required" style="display: none; text-align: center"> <div style="height: 190px; overflow: auto; margin-top: 20px; margin-bottom: 10px; text-align: left" id="rightnow-backup-content"> </div> <input id="rightnow-backup-all" type="button" name="Backup All" value="<?php _e('Backup All', 'mainwp'); ?> " class="button-primary"/> <input id="rightnow-backup-ignore" type="button" name="Ignore" value="<?php _e('Ignore', 'mainwp'); ?> " class="button"/> </div> <div id="rightnow-backupnow-box" title="Full backup" style="display: none; text-align: center"> <div style="height: 190px; overflow: auto; margin-top: 20px; margin-bottom: 10px; text-align: left" id="rightnow-backupnow-content"> </div> <input id="rightnow-backupnow-close" type="button" name="Ignore" value="<?php _e('Cancel', 'mainwp'); ?> " class="button"/> </div> <?php @MainWP_DB::free_result($websites); }
function mainwp_cronstats_action() { MainWP_Logger::Instance()->info('CRON :: stats'); MainWP_Utility::update_option('mainwp_cron_last_stats', time()); if (get_option('mainwp_seo') != 1) { return; } $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getWebsitesStatsUpdateSQL()); $start = time(); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if ($start - time() > 60 * 60 * 2) { //two hours passed, next cron will start! break; } $errors = false; if (!$errors) { $indexed = MainWP_Utility::getGoogleCount($website->url); if ($indexed == NULL) { $errors = true; } } if (!$errors) { $alexia = MainWP_Utility::getAlexaRank($website->url); if ($alexia == NULL) { $errors = true; } } $pageRank = 0; //MainWP_Utility::getPagerank($website->url); $newIndexed = $errors ? $website->indexed : $indexed; $oldIndexed = $errors ? $website->indexed_old : $website->indexed; $newAlexia = $errors ? $website->alexia : $alexia; $oldAlexia = $errors ? $website->alexia_old : $website->alexia; $statsUpdated = $errors ? $website->statsUpdate : time(); MainWP_DB::Instance()->updateWebsiteStats($website->id, $pageRank, $newIndexed, $newAlexia, $website->pagerank, $oldIndexed, $oldAlexia, $statsUpdated); if ($website->sync_errors != '') { //Try reconnecting MainWP_Logger::Instance()->infoForWebsite($website, 'reconnect', 'Trying to reconnect'); try { if (MainWP_Manage_Sites::_reconnectSite($website)) { //Reconnected MainWP_Logger::Instance()->infoForWebsite($website, 'reconnect', 'Reconnected successfully'); } } catch (Exception $e) { //Still something wrong MainWP_Logger::Instance()->warningForWebsite($website, 'reconnect', $e->getMessage()); } } sleep(3); } @MainWP_DB::free_result($websites); }
public static function renderChild() { self::renderHeader('ServerInformationChild'); $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); ?> <div class="postbox"> <h3 class="mainwp_box_title"><?php _e('Child Site Server Information', 'mainwp'); ?> </h3> <div class="inside"> <?php _e('Select Child Site: ', 'mainwp'); ?> <select name="" id="mainwp_serverInformation_child" style="margin-right: 2em"> <option value="-1"><?php _e('Select Child Site', 'mainwp'); ?> </option> <?php while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { echo '<option value="' . $website->id . '">' . stripslashes($website->name) . '</option>'; } @MainWP_DB::free_result($websites); ?> </select> <?php _e('Select Information: ', 'mainwp'); ?> <select name="" id="mainwp-server-info-filter"> <option value=""><?php _e('Full Information', 'mainwp'); ?> </option> <option value="server-information"><?php _e('Server Information', 'mainwp'); ?> </option> <option value="cron-schedules"><?php _e('Cron Schedules', 'mainwp'); ?> </option> <option value="wp-config"><?php _e('WP-Config.php', 'mainwp'); ?> </option> <option value="error-log"><?php _e('Error Log', 'mainwp'); ?> </option> </select> </div> </div> <div id="mainwp_serverInformation_child_loading"> <span class="mainwp-grabbing-info-note"><i class="fa fa-spinner fa-pulse"></i> <?php _e('Loading server information...', 'mainwp'); ?> </span> </div> <div id="mainwp_serverInformation_child_resp"> </div> <?php self::renderFooter('ServerInformationChild'); }
public static function renderIgnoredAbandoned() { $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); $userExtension = MainWP_DB::Instance()->getUserExtension(); $decodedIgnoredThemes = json_decode($userExtension->dismissed_themes, true); $ignoredThemes = is_array($decodedIgnoredThemes) && count($decodedIgnoredThemes) > 0; $cnt = 0; while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { $tmpDecodedIgnoredThemes = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_dismissed'), true); if (!is_array($tmpDecodedIgnoredThemes) || count($tmpDecodedIgnoredThemes) == 0) { continue; } $cnt++; } self::renderHeader('IgnoreAbandoned'); ?> <table id="mainwp-table" class="wp-list-table widefat" cellspacing="0"> <caption><?php _e('Globally Ignored Abandoned Themes', 'mainwp'); ?> </caption> <thead> <tr> <th scope="col" class="manage-column" style="width: 300px"><?php _e('Theme', 'mainwp'); ?> </th> <th scope="col" class="manage-column" style="width: 650px"><?php _e('Theme File', 'mainwp'); ?> </th> <th scope="col" class="manage-column" style="text-align: right; padding-right: 10px"><?php if ($ignoredThemes) { ?> <a href="#" class="button-primary mainwp-unignore-globally-all" onClick="return rightnow_themes_abandoned_unignore_globally_all();"><?php _e('Allow All', 'mainwp'); ?> </a><?php } ?> </th> </tr> </thead> <tbody id="globally-ignored-themes-list" class="list:sites"> <?php if ($ignoredThemes) { ?> <?php foreach ($decodedIgnoredThemes as $ignoredTheme => $ignoredThemeName) { ?> <tr theme_slug="<?php echo urlencode($ignoredTheme); ?> "> <td> <strong><?php echo $ignoredThemeName; ?> </strong> </td> <td> <?php echo $ignoredTheme; ?> </td> <td style="text-align: right; padding-right: 30px"> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <a href="#" onClick="return rightnow_themes_abandoned_unignore_globally('<?php echo urlencode($ignoredTheme); ?> ')"><i class="fa fa-check"></i> <?php _e('Allow', 'mainwp'); ?> </a> <?php } ?> </td> </tr> <?php } ?> <?php } else { ?> <tr> <td colspan="2"><?php _e('No ignored abandoned themes', 'mainwp'); ?> </td> </tr> <?php } ?> </tbody> </table> <table id="mainwp-table" class="wp-list-table widefat" cellspacing="0"> <caption><?php _e('Per Site Ignored Abandoned Themes', 'mainwp'); ?> </caption> <thead> <tr> <th scope="col" class="manage-column" style="width: 300px"><?php _e('Site', 'mainwp'); ?> </th> <th scope="col" class="manage-column" style="width: 650px"><?php _e('Themes', 'mainwp'); ?> </th> <th scope="col" class="manage-column" style="text-align: right; padding-right: 10px"><?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { if ($cnt > 0) { ?> <a href="#" class="button-primary mainwp-unignore-detail-all" onClick="return rightnow_themes_unignore_abandoned_detail_all();"><?php _e('Allow All', 'mainwp'); ?> </a><?php } } ?> </th> </tr> </thead> <tbody id="ignored-themes-list" class="list:sites"> <?php if ($cnt > 0) { @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { $decodedIgnoredThemes = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_dismissed'), true); if (!is_array($decodedIgnoredThemes) || count($decodedIgnoredThemes) == 0) { continue; } $first = true; foreach ($decodedIgnoredThemes as $ignoredTheme => $ignoredThemeName) { ?> <tr site_id="<?php echo $website->id; ?> " theme_slug="<?php echo urlencode($ignoredTheme); ?> "> <td> <span class="websitename" <?php if (!$first) { echo 'style="display: none;"'; } else { $first = false; } ?> > <a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a> </span> </td> <td> <strong><?php echo $ignoredThemeName; ?> </strong> (<?php echo $ignoredTheme; ?> ) </td> <td style="text-align: right; padding-right: 30px"> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <a href="#" onClick="return rightnow_themes_unignore_abandoned_detail('<?php echo urlencode($ignoredTheme); ?> ', <?php echo $website->id; ?> )"><i class="fa fa-check"></i> <?php _e('Allow', 'mainwp'); ?> </a> <?php } ?> </td> </tr> <?php } } @MainWP_DB::free_result($websites); } else { ?> <tr> <td colspan="3"><?php _e('No ignored abandoned themes', 'mainwp'); ?> </td> </tr> <?php } ?> </tbody> </table> <?php self::renderFooter('IgnoreAbandoned'); }
public static function renderSites() { $sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser(); $websites = MainWP_DB::Instance()->query($sql); if (!$websites) { return; } $all_sites_synced = true; $top_row = true; ?> <div class="clear"> <div id="wp_syncs"> <?php ob_start(); @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if (empty($website) || $website->sync_errors != '') { continue; } if (time() - $website->dtsSync < 60 * 60 * 24) { continue; } $all_sites_synced = false; $lastSyncTime = !empty($website->dtsSync) ? MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($website->dtsSync)) : ''; ?> <div class="<?php echo $top_row ? 'mainwp-row-top' : 'mainwp-row'; ?> mainwp_wp_sync" site_id="<?php echo $website->id; ?> " site_name="<?php echo rawurlencode($website->name); ?> "> <span class="mainwp-left-col"><a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a><input type="hidden" id="wp_sync<?php echo $website->id; ?> " /></span> <span class="mainwp-mid-col wordpressInfo" id="wp_sync_<?php echo $website->id; ?> "> <?php echo $lastSyncTime; ?> </span> <span class="mainwp-right-col wordpressAction"> <div id="wp_syncs_<?php echo $website->id; ?> "> <a class="mainwp-upgrade-button button" onClick="rightnow_wp_sync('<?php echo $website->id; ?> ')"><?php _e('Sync Now', 'mainwp'); ?> </a> </div> </span> </div> <?php $top_row = false; } $output = ob_get_clean(); if ($all_sites_synced) { echo esc_html__('All sites have been synced within the last 24 hours', 'mainwp') . "."; } else { echo '<div class="mainwp_info-box-red">' . esc_html__('Sites not synced in the last 24 hours.', 'mainwp') . '</div>'; echo $output; } ?> </div> </div> <?php @MainWP_DB::free_result($websites); }
public static function renderWidget($renew, $pExit = true) { $current_wpid = MainWP_Utility::get_current_wpid(); if (empty($current_wpid)) { return; } $sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid); $websites = MainWP_DB::Instance()->query($sql); $allPlugins = array(); if ($websites) { $website = @MainWP_DB::fetch_object($websites); if ($website && $website->plugins != '') { $plugins = json_decode($website->plugins, 1); if (is_array($plugins) && count($plugins) != 0) { foreach ($plugins as $plugin) { if (isset($plugin['mainwp']) && $plugin['mainwp'] == 'T') { continue; } $allPlugins[] = $plugin; } } } @MainWP_DB::free_result($websites); } $actived_plugins = MainWP_Utility::getSubArrayHaving($allPlugins, 'active', 1); $actived_plugins = MainWP_Utility::sortmulti($actived_plugins, 'name', 'desc'); $inactive_plugins = MainWP_Utility::getSubArrayHaving($allPlugins, 'active', 0); $inactive_plugins = MainWP_Utility::sortmulti($inactive_plugins, 'name', 'desc'); $plugins_outdate = array(); if (count($allPlugins) > 0 && $website) { $plugins_outdate = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'plugins_outdate_info'), true); if (!is_array($plugins_outdate)) { $plugins_outdate = array(); } $pluginsOutdateDismissed = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'plugins_outdate_dismissed'), true); if (is_array($pluginsOutdateDismissed)) { $plugins_outdate = array_diff_key($plugins_outdate, $pluginsOutdateDismissed); } $userExtension = MainWP_DB::Instance()->getUserExtension(); $decodedDismissedPlugins = json_decode($userExtension->dismissed_plugins, true); if (is_array($decodedDismissedPlugins)) { $plugins_outdate = array_diff_key($plugins_outdate, $decodedDismissedPlugins); } } ?> <div class="clear mwp_plugintheme_widget"> <a class="mainwp_action left mainwp_action_down plugins_actived_lnk" href="#"><?php _e('Active', 'mainwp'); ?> (<?php echo count($actived_plugins); ?> )</a><a class="mainwp_action mid plugins_inactive_lnk right" href="#"><?php _e('Inactive', 'mainwp'); ?> (<?php echo count($inactive_plugins); ?> )</a><br/><br/> <div class="mainwp_plugins_active"> <?php $str_format = __(' | Last Updated %s Days Ago', 'mainwp'); for ($i = 0; $i < count($actived_plugins); $i++) { $outdate_notice = ''; $slug = $actived_plugins[$i]['slug']; if (isset($plugins_outdate[$slug])) { $plugin_outdate = $plugins_outdate[$slug]; $now = new \DateTime(); $last_updated = $plugin_outdate['last_updated']; $plugin_last_updated_date = new \DateTime('@' . $last_updated); $diff_in_days = $now->diff($plugin_last_updated_date)->format('%a'); $outdate_notice = sprintf($str_format, $diff_in_days); } ?> <div class="mainwp-row mainwp-active"> <input class="pluginSlug" type="hidden" name="slug" value="<?php echo $actived_plugins[$i]['slug']; ?> "/> <input class="websiteId" type="hidden" name="id" value="<?php echo $website->id; ?> "/> <span class="mainwp-left-col"> <a href="<?php echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . dirname($actived_plugins[$i]['slug']) . '&TB_iframe=true&width=640&height=477'; ?> " target="_blank" class="thickbox" title="More information about <?php echo $actived_plugins[$i]['name']; ?> "> <?php echo $actived_plugins[$i]['name']; ?> </a> <?php echo ' ' . $actived_plugins[$i]['version']; ?> <?php echo $outdate_notice; ?> </span> <div class="mainwp-right-col pluginsAction"> <?php if (mainwp_current_user_can('dashboard', 'activate_deactivate_plugins')) { ?> <a href="#" class="mainwp-plugin-deactivate"><i class="fa fa-toggle-off"></i> <?php _e('Deactivate', 'mainwp'); ?> </a> <?php } ?> </div> <div style="clear: left;"></div> <div class="mainwp-row-actions-working"> <i class="fa fa-spinner fa-pulse"></i> <?php _e('Please wait', 'mainwp'); ?> </div> <div> </div> </div> <?php } ?> </div> <div class="mainwp_plugins_inactive" style="display: none"> <?php for ($i = 0; $i < count($inactive_plugins); $i++) { $outdate_notice = ''; $slug = $inactive_plugins[$i]['slug']; if (isset($plugins_outdate[$slug])) { $plugin_outdate = $plugins_outdate[$slug]; $now = new \DateTime(); $last_updated = $plugin_outdate['last_updated']; $plugin_last_updated_date = new \DateTime('@' . $last_updated); $diff_in_days = $now->diff($plugin_last_updated_date)->format('%a'); $outdate_notice = sprintf($str_format, $diff_in_days); } ?> <div class="mainwp-row mainwp-inactive"> <input class="pluginSlug" type="hidden" name="slug" value="<?php echo $inactive_plugins[$i]['slug']; ?> "/> <input class="websiteId" type="hidden" name="id" value="<?php echo $website->id; ?> "/> <span class="mainwp-left-col"> <a href="<?php echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . dirname($inactive_plugins[$i]['slug']) . '&TB_iframe=true&width=640&height=477'; ?> " target="_blank" class="thickbox" title="More information about <?php echo $inactive_plugins[$i]['name']; ?> "> <?php echo $inactive_plugins[$i]['name']; ?> </a> <?php echo ' ' . $inactive_plugins[$i]['version']; ?> <?php echo $outdate_notice; ?> </span> <div class="mainwp-right-col pluginsAction"> <?php if (mainwp_current_user_can('dashboard', 'activate_deactivate_plugins')) { ?> <a href="#" class="mainwp-plugin-activate"><i class="fa fa-toggle-on"></i> <?php _e('Activate', 'mainwp'); ?> </a> | <?php } ?> <?php if (mainwp_current_user_can('dashboard', 'delete_plugins')) { ?> <a href="#" class="mainwp-plugin-delete mainwp-red"><i class="fa fa-trash"></i> <?php _e('Delete', 'mainwp'); ?> </a> <?php } ?> </div> <div style="clear: left;"></div> <div class="mainwp-row-actions-working"> <i class="fa fa-spinner fa-pulse"></i> <?php _e('Please wait', 'mainwp'); ?> </div> <div> </div> </div> <?php } ?> </div> </div> <div class="clear"></div> <?php if ($pExit == true) { exit; } }
public static function renderWidget($renew, $pExit = true) { $current_wpid = MainWP_Utility::get_current_wpid(); if (empty($current_wpid)) { return; } $sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid); $websites = MainWP_DB::Instance()->query($sql); $allThemes = array(); if ($websites) { $website = @MainWP_DB::fetch_object($websites); if ($website && $website->themes != '') { $themes = json_decode($website->themes, 1); if (is_array($themes) && count($themes) != 0) { foreach ($themes as $theme) { $allThemes[] = $theme; } } } @MainWP_DB::free_result($websites); } $actived_themes = MainWP_Utility::getSubArrayHaving($allThemes, 'active', 1); $actived_themes = MainWP_Utility::sortmulti($actived_themes, 'name', 'desc'); $inactive_themes = MainWP_Utility::getSubArrayHaving($allThemes, 'active', 0); $inactive_themes = MainWP_Utility::sortmulti($inactive_themes, 'name', 'desc'); if (count($allThemes) > 0 && $website) { $themes_outdate = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_info'), true); if (!is_array($themes_outdate)) { $themes_outdate = array(); } $themesOutdateDismissed = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_dismissed'), true); if (is_array($themesOutdateDismissed)) { $themes_outdate = array_diff_key($themes_outdate, $themesOutdateDismissed); } $userExtension = MainWP_DB::Instance()->getUserExtension(); $decodedDismissedThemes = json_decode($userExtension->dismissed_themes, true); if (is_array($decodedDismissedThemes)) { $themes_outdate = array_diff_key($themes_outdate, $decodedDismissedThemes); } } ?> <div class="clear"> <a class="mainwp_action left mainwp_action_down themes_actived_lnk" href="#"><?php _e('Active', 'mainwp'); ?> (<?php echo count($actived_themes); ?> )</a><a class="mainwp_action mid themes_inactive_lnk right" href="#"><?php _e('Inactive', 'mainwp'); ?> (<?php echo count($inactive_themes); ?> )</a><br/><br/> <div class="mainwp_themes_active"> <?php $str_format = __(' | Last Updated %s Days Ago', 'mainwp'); for ($i = 0; $i < count($actived_themes); $i++) { $outdate_notice = ''; $slug = $actived_themes[$i]['slug']; if (isset($themes_outdate[$slug])) { $theme_outdate = $themes_outdate[$slug]; $now = new \DateTime(); $last_updated = $theme_outdate['last_updated']; $theme_last_updated_date = new \DateTime('@' . $last_updated); $diff_in_days = $now->diff($theme_last_updated_date)->format('%a'); $outdate_notice = sprintf($str_format, $diff_in_days); } ?> <div class="mainwp-row mainwp-active"> <input class="themeName" type="hidden" name="name" value="<?php echo $actived_themes[$i]['name']; ?> "/> <input class="websiteId" type="hidden" name="id" value="<?php echo $website->id; ?> "/> <span class="mainwp-left-col"> <?php echo $actived_themes[$i]['name'] . ' ' . $actived_themes[$i]['version']; echo $outdate_notice; ?> </span> </div> <?php } ?> </div> <div class="mainwp_themes_inactive" style="display: none"> <?php for ($i = 0; $i < count($inactive_themes); $i++) { $outdate_notice = ''; $slug = $inactive_themes[$i]['slug']; if (isset($themes_outdate[$slug])) { $theme_outdate = $themes_outdate[$slug]; $now = new \DateTime(); $last_updated = $theme_outdate['last_updated']; $theme_last_updated_date = new \DateTime('@' . $last_updated); $diff_in_days = $now->diff($theme_last_updated_date)->format('%a'); $outdate_notice = sprintf($str_format, $diff_in_days); } ?> <div class="mainwp-row mainwp-inactive"> <input class="themeName" type="hidden" name="name" value="<?php echo $inactive_themes[$i]['name']; ?> "/> <input class="websiteId" type="hidden" name="id" value="<?php echo $website->id; ?> "/> <span class="mainwp-left-col"> <?php echo $inactive_themes[$i]['name'] . ' ' . $inactive_themes[$i]['version']; echo $outdate_notice; ?> </span> <div class="mainwp-right-col themesAction"> <?php if (mainwp_current_user_can('dashboard', 'activate_themes')) { ?> <a href="#" class="mainwp-theme-activate"><i class="fa fa-toggle-on"></i> <?php _e('Activate', 'mainwp'); ?> </a> | <?php } ?> <?php if (mainwp_current_user_can('dashboard', 'delete_themes')) { ?> <a href="#" class="mainwp-theme-delete mainwp-red"><i class="fa fa-trash"></i> <?php _e('Delete', 'mainwp'); ?> </a> <?php } ?> </div> <div style="clear: left;"></div> <div class="mainwp-row-actions-working"> <i class="fa fa-spinner fa-pulse"></i> <?php _e('Please wait', 'mainwp'); ?> </div> <div> </div> </div> <?php } ?> </div> </div> <div class="clear"></div> <?php if ($pExit == true) { exit; } }