public static function renderSites() { $globalView = true; $current_wpid = MainWPUtility::get_current_wpid(); if ($current_wpid) { $sql = MainWPDB::Instance()->getSQLWebsiteById($current_wpid); $globalView = false; } else { $sql = MainWPDB::Instance()->getSQLWebsitesForCurrentUser(); } $websites = MainWPDB::Instance()->query($sql); if (!$websites) { return; } $userExtension = MainWPDB::Instance()->getUserExtension(); $total_themesIgnored = $total_pluginsIgnored = 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; } $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; $allPlugins = array(); $pluginsInfo = array(); $allThemes = array(); $themesInfo = array(); @MainWPDB::data_seek($websites, 0); $currentSite = null; $pluginsIgnored_perSites = $themesIgnored_perSites = array(); while ($websites && ($website = @MainWPDB::fetch_object($websites))) { if (!$globalView) { $currentSite = $website; } $wp_upgrades = json_decode(MainWPDB::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(MainWPDB::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); } if ($userExtension->site_view == 0) { //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); } } 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 ($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 id="mainwp-right-now-message-content"><?php echo $total_sync_errors; ?> <?php echo _n('Site Timed Out / Errored', 'Sites Timed Out / Errored', $total_sync_errors, 'mainwp'); ?> (There was an error syncing some of your sites. <a href="http://docs.mainwp.com/sync-error/">Please check this help doc for possible solutions.</a>)</span><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> <?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', 'mainwp'); ?> (There was an error syncing some of your sites. <a href="http://docs.mainwp.com/sync-error/">Please check this help doc for possible solutions.</a>)</span> <?php } ?> </p> </div> </div> <?php $total_pluginsIgnored += count($pluginsIgnored_perSites); $total_themesIgnored += count($themesIgnored_perSites); //WP Upgrades part: $total_upgrades = $total_wp_upgrades + $total_plugin_upgrades + $total_theme_upgrades; ?> <div class="clear"> <div class="mainwp-row-top"> <span class="mainwp-left-col"><span class="mainwp-rightnow-number"><?php echo $total_upgrades; ?> </span> <?php _e('Upgrade', 'mainwp'); if (count($total_upgrades) > 1) { ?> s<?php } ?> <?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"><span class="mainwp-rightnow-number"><?php echo $total_wp_upgrades; ?> </span> <?php _e('WordPress upgrade', 'mainwp'); if (count($total_wp_upgrades) > 1) { ?> s<?php } ?> <?php _e('available', 'mainwp'); ?> </span> <span class="mainwp-mid-col"> </span> <span class="mainwp-right-col"> <a href="#" id="mainwp_upgrades_show" onClick="return rightnow_show('upgrades');"><i class="fa fa-eye-slash"></i> <?php _e('Show', 'mainwp'); ?> </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 @MainWPDB::data_seek($websites, 0); while ($websites && ($website = @MainWPDB::fetch_object($websites))) { if ($website->is_ignoreCoreUpdates) { continue; } $wp_upgrades = json_decode(MainWPDB::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"><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'); ?> </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"><a href="#" id="mainwp_plugin_upgrades_show" onClick="return rightnow_show('plugin_upgrades');"><i class="fa fa-eye-slash"></i> <?php _e('Show', 'mainwp'); ?> </a> <?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) { @MainWPDB::data_seek($websites, 0); while ($websites && ($website = @MainWPDB::fetch_object($websites))) { if ($website->is_ignorePluginUpdates) { continue; } $plugin_upgrades = json_decode($website->plugin_upgrades, true); $decodedPremiumUpgrades = json_decode(MainWPDB::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 _e('Upgrade', 'mainwp'); echo count($plugin_upgrades) > 1 ? 's' : ''; ?> </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($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 $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 @MainWPDB::data_seek($websites, 0); while ($websites && ($website = @MainWPDB::fetch_object($websites))) { if ($website->is_ignorePluginUpdates) { continue; } $plugin_upgrades = json_decode($website->plugin_upgrades, true); $decodedPremiumUpgrades = json_decode(MainWPDB::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"><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'); ?> </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"><a href="#" id="mainwp_theme_upgrades_show" onClick="return rightnow_show('theme_upgrades');"><i class="fa fa-eye-slash"></i> <?php _e('Show', 'mainwp'); ?> </a> <?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) { @MainWPDB::data_seek($websites, 0); while ($websites && ($website = @MainWPDB::fetch_object($websites))) { if ($website->is_ignoreThemeUpdates) { continue; } $theme_upgrades = json_decode($website->theme_upgrades, true); $decodedPremiumUpgrades = json_decode(MainWPDB::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 _e('Upgrade', 'mainwp'); echo count($theme_upgrades) > 1 ? 's' : ''; ?> </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 urlencode($themesInfo[$slug]['name']); ?> " premium="<?php echo $themesInfo[$slug]['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 _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_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 @MainWPDB::data_seek($websites, 0); while ($websites && ($website = @MainWPDB::fetch_object($websites))) { if ($website->is_ignoreThemeUpdates) { continue; } $theme_upgrades = json_decode($website->theme_upgrades, true); $decodedPremiumUpgrades = json_decode(MainWPDB::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 //Sync errors! if ($total_sync_errors > 0) { ?> <div class="clear"> <div class="mainwp-row"> <span class="mainwp-left-col"><span class="mainwp-rightnow-number"><?php echo $total_sync_errors; ?> </span> Error<?php if ($total_sync_errors > 1) { ?> s<?php } ?> </span> <span class="mainwp-mid-col"> </span> <span class="mainwp-right-col"><a href="#" id="mainwp_errors_show" onClick="return rightnow_show('errors');"><i class="fa fa-eye-slash"></i> <?php _e('Show', 'mainwp'); ?> </a></span> </div> <div id="wp_errors" style="display: none"> <?php @MainWPDB::data_seek($websites, 0); while ($websites && ($website = @MainWPDB::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"><span class="mainwp-rightnow-number"><?php echo $total_uptodate; ?> </span> <?php _e('Up to date', 'mainwp'); ?> </span> <span class="mainwp-mid-col"> </span> <span class="mainwp-right-col"><a href="#" id="mainwp_uptodate_show" onClick="return rightnow_show('uptodate');"><i class="fa fa-eye-slash"></i> <?php _e('Show', 'mainwp'); ?> </a></span> </div> <div id="wp_uptodate" style="display: none"> <?php @MainWPDB::data_seek($websites, 0); while ($websites && ($website = @MainWPDB::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 @MainWPDB::data_seek($websites, 0); $site_ids = array(); while ($websites && ($website = @MainWPDB::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 class="mainwp-rightnow-number"> <img class="down-img" style="margin-bottom: -3px;" title="<?php echo $total_sync_errors > 0 ? 'Site Disconnected' : ($total_conflict > 0 ? 'Plugin or Theme Conflict Found' : ($total_offline > 0 ? 'Site is Offline' : 'Site is Online')); ?> " alt="<?php echo $total_sync_errors > 0 ? 'Sync errors' : ($total_conflict > 0 ? 'Conflict Found' : ($total_offline > 0 ? 'Site Down' : 'Site Up')); ?> " src="<?php echo plugins_url('images/' . ($total_sync_errors > 0 ? 'disconnected' : ($total_conflict > 0 ? 'conflict' : ($total_offline > 0 ? 'down' : 'up'))) . '.png', dirname(__FILE__)); ?> " /></span> <span style="font-size: 18px !important;"><?php _e('Status', 'mainwp'); ?> </span></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++) { @MainWPDB::data_seek($websites, 0); while ($websites && ($website = @MainWPDB::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;"><a href="#" class="mainwp_rightnow_site_reconnect" siteid="<?php echo $website->id; ?> "><?php _e('Reconnect', 'mainwp'); ?> </a><br /></div> <img class="down-img" title="Site Disconnected" alt="Sync Errors" src="<?php echo plugins_url('images/disconnected.png', dirname(__FILE__)); ?> " /> <?php } else { if ($isConflict) { ?> <img class="down-img" title="Plugin or Theme Conflict Found" alt="Conflict Found" src="<?php echo plugins_url('images/conflict.png', dirname(__FILE__)); ?> " /> <?php } else { if ($isDown) { ?> <img class="down-img" title="Site is Offline" alt="Site Down" src="<?php echo plugins_url('images/down.png', dirname(__FILE__)); ?> " /> <?php } else { ?> <img class="down-img" title="Site is Online" alt="Site Up" src="<?php echo plugins_url('images/up.png', dirname(__FILE__)); ?> " /> <?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 @MainWPDB::free_result($websites); }
function update_footer() { if (!self::isMainWPPages()) { return; } $current_wpid = MainWPUtility::get_current_wpid(); if ($current_wpid) { $website = MainWPDB::Instance()->getWebsiteById($current_wpid); $websites = array($website); } else { $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesForCurrentUser(false, null, 'wp_sync.dtsSync DESC, wp.url ASC')); } ob_start(); $cntr = 0; if (is_array($websites)) { for ($i = 0; $i < count($websites); $i++) { $website = $websites[$i]; if ($website->sync_errors == '') { $cntr++; echo '<input type="hidden" name="dashboard_wp_ids[]" class="dashboard_wp_id" value="' . $website->id . '" />'; } } } else { if ($websites !== false) { while ($website = @MainWPDB::fetch_object($websites)) { if ($website->sync_errors == '') { $cntr++; echo '<input type="hidden" name="dashboard_wp_ids[]" class="dashboard_wp_id" value="' . $website->id . '" />'; } } } } ?> <div id="refresh-status-box" title="Syncing Websites" style="display: none; text-align: center"> <div id="refresh-status-progress"></div> <span id="refresh-status-current">0</span> / <span id="refresh-status-total"><?php echo $cntr; ?> </span> <span id="refresh-status-text"><?php _e('synced', 'mainwp'); ?> </span> <div style="height: 160px; overflow: auto; margin-top: 20px; margin-bottom: 10px; text-align: left" id="refresh-status-content"> <table style="width: 100%"> <?php if (is_array($websites)) { for ($i = 0; $i < count($websites); $i++) { $website = $websites[$i]; if ($website->sync_errors == '') { echo '<tr><td>' . MainWPUtility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWPUtility::getNiceURL($website->url) . '" siteid="' . $website->id . '">PENDING</span></td></tr>'; } else { echo '<tr class="mainwp_wp_offline"><td>' . MainWPUtility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWPUtility::getNiceURL($website->url) . '" siteid="' . $website->id . '">DISCONNECTED</span></td></tr>'; } } } else { @MainWPDB::data_seek($websites, 0); while ($website = @MainWPDB::fetch_object($websites)) { if ($website->sync_errors == '') { echo '<tr><td>' . MainWPUtility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWPUtility::getNiceURL($website->url) . '" siteid="' . $website->id . '">PENDING</span></td></tr>'; } else { echo '<tr class="mainwp_wp_offline"><td>' . MainWPUtility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWPUtility::getNiceURL($website->url) . '" siteid="' . $website->id . '">DISCONNECTED</span></td></tr>'; } } } ?> </table> </div> <input id="refresh-status-close" type="button" name="Close" value="Close" class="button" /> </div> <?php if (!self::isHideFooter()) { self::sites_fly_menu(); self::add_new_links(); } $newOutput = ob_get_clean(); $output = ""; if (!self::isHideFooter()) { $output .= '<a href="javascript:void(0)" id="dashboard_refresh" title="Sync Data" class="mainwp-left-margin-2 mainwp-green"><i class="fa fa-refresh fa-2x"></i></a> <a id="mainwp-add-new-button" class="mainwp-blue mainwp-left-margin-2" title="Add New" href="javascript:void(0)"><i class="fa fa-plus fa-2x"></i></a> <a class="mainwp-red mainwp-left-margin-2" title="Get MainWP Extensions" href="https://extensions.mainwp.com" target="_blank"><i class="fa fa-shopping-cart fa-2x"></i></a> <a class="mainwp-white mainwp-left-margin-2" title="Get Support" href="http://support.mainwp.com" target="_blank"><i class="fa fa-life-ring fa-2x"></i></a>' . '<a href="https://www.facebook.com/mainwp" class="mainwp-link-clean mainwp-left-margin-2" style="color: #3B5998;" target="_blank"><i class="fa fa-facebook-square fa-2x"></i></a> ' . ' <a href="https://twitter.com/mymainwp" class="mainwp-link-clean" target="_blank" style="color: #4099FF;"><i class="fa fa-twitter-square fa-2x"></i></a>.'; } return $output . $newOutput; }
function extra_tablenav($which) { ?> <div class="alignleft actions"> <form method="GET" action=""> <input type="hidden" value="<?php echo $_REQUEST['page']; ?> " name="page"/> <select name="g"> <option value=""><?php _e('All Groups', 'mainwp'); ?> </option> <?php $groups = MainWPDB::Instance()->getGroupsForCurrentUser(); foreach ($groups as $group) { echo '<option value="' . $group->id . '" ' . (isset($_REQUEST['g']) && $_REQUEST['g'] == $group->id ? 'selected' : '') . '>' . $group->name . '</option>'; } ?> </select> <input type="hidden" value="<?php echo $_REQUEST['page']; ?> " name="page"/> <select name="status"> <option value=""><?php _e('All Statuses', 'mainwp'); ?> </option> <option value="online" <?php echo isset($_REQUEST['status']) && $_REQUEST['status'] == 'online' ? 'selected' : ''; ?> >Online</option> <option value="offline" <?php echo isset($_REQUEST['status']) && $_REQUEST['status'] == 'offline' ? 'selected' : ''; ?> >Offline</option> <option value="disconnected" <?php echo isset($_REQUEST['status']) && $_REQUEST['status'] == 'disconnected' ? 'selected' : ''; ?> >Disconnected</option> <option value="update" <?php echo isset($_REQUEST['status']) && $_REQUEST['status'] == 'update' ? 'selected' : ''; ?> >Available update</option> </select> <input type="submit" value="<?php _e('Display'); ?> " class="button" name=""> </form> </div> <div class="alignleft actions"> <form method="GET" action=""> <input type="hidden" value="<?php echo $_REQUEST['page']; ?> " name="page"/> <input type="text" value="<?php echo isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; ?> " autocompletelist="sites" name="s" class="mainwp_autocomplete"/> <datalist id="sites"> <?php if (MainWPDB::is_result($this->items)) { while ($this->items && ($item = @MainWPDB::fetch_array($this->items))) { echo '<option>' . $item['name'] . '</option>'; } MainWPDB::data_seek($this->items, 0); } ?> </datalist> <input type="submit" value="<?php _e('Search Sites'); ?> " class="button" name=""/> </form> </div> <?php }
public static function renderSites() { $current_wpid = MainWPUtility::get_current_wpid(); if ($current_wpid) { $sql = MainWPDB::Instance()->getSQLWebsiteById($current_wpid); } else { $sql = MainWPDB::Instance()->getSQLWebsitesForCurrentUser(); } $websites = MainWPDB::Instance()->query($sql); if (!$websites) { return; } $total_securityIssues = 0; @MainWPDB::data_seek($websites, 0); while ($websites && ($website = @MainWPDB::fetch_object($websites))) { if (MainWPUtility::ctype_digit($website->securityIssues)) { $total_securityIssues += $website->securityIssues; } } //We found some with security issues! if ($total_securityIssues > 0) { ?> <div class="clear"> <div class="mainwp-row-top darkred"> <span class="mainwp-left-col"><span class="mainwp-rightnow-number"><?php echo $total_securityIssues; ?> </span> <?php _e('Security issue', 'mainwp'); echo $total_securityIssues > 1 ? 's' : ''; ?> </span> <span class="mainwp-mid-col"> </span> <span class="mainwp-right-col"><a href="#" id="mainwp_securityissues_show" onClick="return rightnow_show('securityissues');"><?php _e('Show All', 'mainwp'); ?> </a> <input type="button" class="securityIssues_dashboard_allFixAll button-primary" value="<?php _e('Fix All', 'mainwp'); ?> "/></span> </div> <div id="wp_securityissues" style="display: none"> <?php @MainWPDB::data_seek($websites, 0); while ($websites && ($website = @MainWPDB::fetch_object($websites))) { if (!MainWPUtility::ctype_digit($website->securityIssues) || $website->securityIssues == 0) { continue; } ?> <div class="mainwp-row" siteid="<?php echo $website->id; ?> "> <span class="mainwp-left-col"><a href="admin.php?page=managesites&scanid=<?php echo $website->id; ?> "><?php echo stripslashes($website->name); ?> </a></span> <span class="mainwp-mid-col"><span class="<?php echo $website->securityIssues > 0 ? 'darkred' : 'mainwp_ga_plus'; ?> "><span class="mainwp-rightnow-number"><?php echo $website->securityIssues; ?> </span> Issue<?php echo $website->securityIssues > 1 ? 's' : ''; ?> </span></span> <span class="mainwp-right-col"><?php if ($website->securityIssues == 0) { ?> <input type="button" class="securityIssues_dashboard_unfixAll button" value="<?php _e('Unfix All', 'mainwp'); ?> "/> <?php } else { ?> <input type="button" class="securityIssues_dashboard_fixAll button-primary" value="<?php _e('Fix All', 'mainwp'); ?> "/> <?php } ?> <i class="fa fa-spinner fa-pulse img-loader" style="display: none;"></i> </span> </div> <?php } ?> </div> </div> <?php } }
public static function renderIgnore() { $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesForCurrentUser()); $userExtension = MainWPDB::Instance()->getUserExtension(); $decodedIgnoredThemes = json_decode($userExtension->ignored_themes, true); $ignoredThemes = is_array($decodedIgnoredThemes) && count($decodedIgnoredThemes) > 0; $cnt = 0; while ($websites && ($website = @MainWPDB::fetch_object($websites))) { if ($website->is_ignoreThemeUpdates) { continue; } $tmpDecodedIgnoredThemes = json_decode($website->ignored_themes, true); if (!is_array($tmpDecodedIgnoredThemes) || count($tmpDecodedIgnoredThemes) == 0) { continue; } $cnt++; } self::renderHeader('Ignore'); ?> <table id="mainwp-table" class="wp-list-table widefat" cellspacing="0"> <caption><?php _e('Globally Ignored 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_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_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 themes', 'mainwp'); ?> </td></tr> <?php } ?> </tbody> </table> <table id="mainwp-table" class="wp-list-table widefat" cellspacing="0"> <caption><?php _e('Per Site Ignored 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_detail_all();"><?php _e('Allow All', 'mainwp'); ?> </a><?php } } ?> </th> </tr> </thead> <tbody id="ignored-themes-list" class="list:sites"> <?php if ($cnt > 0) { @MainWPDB::data_seek($websites, 0); while ($websites && ($website = @MainWPDB::fetch_object($websites))) { if ($website->is_ignoreThemeUpdates) { continue; } $decodedIgnoredThemes = json_decode($website->ignored_themes, 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_detail('<?php echo urlencode($ignoredTheme); ?> ', <?php echo $website->id; ?> )"><i class="fa fa-check"></i> <?php _e('Allow', 'mainwp'); ?> </a> <?php } ?> </td> </tr> <?php } } @MainWPDB::free_result($websites); } else { ?> <tr><td colspan="3"><?php _e('No ignored themes', 'mainwp'); ?> </td></tr> <?php } ?> </tbody> </table> <?php self::renderFooter('Ignore'); }
public static function renderIgnoredAbandoned() { $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesForCurrentUser()); $userExtension = MainWPDB::Instance()->getUserExtension(); $decodedIgnoredPlugins = json_decode($userExtension->dismissed_plugins, true); $ignoredPlugins = is_array($decodedIgnoredPlugins) && count($decodedIgnoredPlugins) > 0; $cnt = 0; while ($websites && ($website = @MainWPDB::fetch_object($websites))) { $tmpDecodedDismissedPlugins = json_decode(MainWPDB::Instance()->getWebsiteOption($website, 'plugins_outdate_dismissed'), true); if (!is_array($tmpDecodedDismissedPlugins) || count($tmpDecodedDismissedPlugins) == 0) { continue; } $cnt++; } self::renderHeader('IgnoreAbandoned'); ?> <table id="mainwp-table" class="wp-list-table widefat" cellspacing="0"> <caption><?php _e('Globally Ignored Abandoned Plugins', 'mainwp'); ?> </caption> <thead> <tr> <th scope="col" class="manage-column" style="width: 300px"><?php _e('Plugin', 'mainwp'); ?> </th> <th scope="col" class="manage-column" style="width: 650px"><?php _e('Plugin File', '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 ($ignoredPlugins) { ?> <a href="#" class="button-primary mainwp-unignore-globally-all" onClick="return rightnow_plugins_abandoned_unignore_globally_all();"><?php _e('Allow All', 'mainwp'); ?> </a><?php } } ?> </th> </tr> </thead> <tbody id="globally-ignored-plugins-list" class="list:sites"> <?php if ($ignoredPlugins) { foreach ($decodedIgnoredPlugins as $ignoredPlugin => $ignoredPluginName) { ?> <tr plugin_slug="<?php echo urlencode($ignoredPlugin); ?> "> <td> <strong><a href="<?php echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . urlencode(dirname($ignoredPlugin)) . '&TB_iframe=true&width=640&height=477'; ?> " target="_blank" class="thickbox" title="More information about <?php echo $ignoredPluginName; ?> "><?php echo $ignoredPluginName; ?> </a></strong> </td> <td> <?php echo $ignoredPlugin; ?> </td> <td style="text-align: right; padding-right: 30px"> <?php if (mainwp_current_user_can("dashboard", "ignore_unignore_updates")) { ?> <a href="#" onClick="return rightnow_plugins_abandoned_unignore_globally('<?php echo urlencode($ignoredPlugin); ?> ')"><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 plugins', 'mainwp'); ?> </td></tr> <?php } ?> </tbody> </table> <table id="mainwp-table" class="wp-list-table widefat" cellspacing="0"> <caption><?php _e('Per Site Ignored Abandoned Plugins', '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('Plugins', 'mainwp'); ?> </th> <th scope="col" class="manage-column" style="text-align: right; padding-right: 10px"><?php if ($cnt > 0) { ?> <a href="#" class="button-primary mainwp-unignore-detail-all" onClick="return rightnow_plugins_unignore_abandoned_detail_all();"><?php _e('Allow All', 'mainwp'); ?> </a><?php } ?> </th> </tr> </thead> <tbody id="ignored-plugins-list" class="list:sites"> <?php if ($cnt > 0) { @MainWPDB::data_seek($websites, 0); while ($websites && ($website = @MainWPDB::fetch_object($websites))) { $decodedIgnoredPlugins = json_decode(MainWPDB::Instance()->getWebsiteOption($website, 'plugins_outdate_dismissed'), true); if (!is_array($decodedIgnoredPlugins) || count($decodedIgnoredPlugins) == 0) { continue; } $first = true; foreach ($decodedIgnoredPlugins as $ignoredPlugin => $ignoredPluginName) { ?> <tr site_id="<?php echo $website->id; ?> " plugin_slug="<?php echo urlencode($ignoredPlugin); ?> "> <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><a href="<?php echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . urlencode(dirname($ignoredPlugin)) . '&TB_iframe=true&width=640&height=477'; ?> " target="_blank" class="thickbox" title="More information about <?php echo $ignoredPluginName; ?> "><?php echo $ignoredPluginName; ?> </a></strong> (<?php echo $ignoredPlugin; ?> ) </td> <td style="text-align: right; padding-right: 30px"> <a href="#" onClick="return rightnow_plugins_unignore_abandoned_detail('<?php echo urlencode($ignoredPlugin); ?> ', <?php echo $website->id; ?> )"><i class="fa fa-check"></i> <?php _e('Allow', 'mainwp'); ?> </a> </td> </tr> <?php } } @MainWPDB::free_result($websites); } else { ?> <tr><td colspan="3"><?php _e('No ignored abandoned plugins', 'mainwp'); ?> </td></tr> <?php } ?> </tbody> </table> <?php self::renderFooter('IgnoreAbandoned'); }