/**
  * List information about added child sites
  *
  * ## OPTIONS
  *
  * [--list]
  *  : Get a list of all child sites
  *
  * @todo: allow to add or remove child sites
  * @synopsis [--list]
  */
 public function sites($args, $assoc_args)
 {
     $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
     $idLength = strlen('id');
     $nameLength = strlen('name');
     $urlLength = strlen('url');
     $versionLength = strlen('version');
     while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
         if ($idLength < strlen($website->id)) {
             $idLength = strlen($website->id);
         }
         if ($nameLength < strlen($website->name)) {
             $nameLength = strlen($website->name);
         }
         if ($urlLength < strlen($website->url)) {
             $urlLength = strlen($website->url);
         }
         if ($versionLength < strlen($website->version)) {
             $versionLength = strlen($website->version);
         }
     }
     @MainWP_DB::data_seek($websites, 0);
     WP_CLI::line(sprintf("+%'--" . ($idLength + 2) . "s+%'--" . ($nameLength + 2) . "s+%'--" . ($urlLength + 2) . "s+%'--" . ($versionLength + 2) . "s+", '', '', '', ''));
     WP_CLI::line(sprintf("| %-" . $idLength . "s | %-" . $nameLength . "s | %-" . $urlLength . "s | %-" . $versionLength . "s |", 'id', 'name', 'url', 'version'));
     WP_CLI::line(sprintf("+%'--" . ($idLength + 2) . "s+%'--" . ($nameLength + 2) . "s+%'--" . ($urlLength + 2) . "s+%'--" . ($versionLength + 2) . "s+", '', '', '', ''));
     while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
         WP_CLI::line(sprintf("| %-" . $idLength . "s | %-" . $nameLength . "s | %-" . $urlLength . "s | %-" . $versionLength . "s |", $website->id, $website->name, $website->url, $website->version));
     }
     WP_CLI::line(sprintf("+%'--" . ($idLength + 2) . "s+%'--" . ($nameLength + 2) . "s+%'--" . ($urlLength + 2) . "s+%'--" . ($versionLength + 2) . "s+", '', '', '', ''));
     @MainWP_DB::free_result($websites);
 }
示例#2
0
    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');
    }
示例#3
0
    function update_footer()
    {
        if (!self::isMainWP_Pages()) {
            return;
        }
        $current_wpid = MainWP_Utility::get_current_wpid();
        if ($current_wpid) {
            $website = MainWP_DB::Instance()->getWebsiteById($current_wpid);
            $websites = array($website);
        } else {
            $websites = MainWP_DB::Instance()->query(MainWP_DB::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 = @MainWP_DB::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 esc_html($cntr);
        ?>
</span>
			<span id="refresh-status-text"><?php 
        esc_html_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>' . MainWP_Utility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWP_Utility::getNiceURL($website->url) . '" siteid="' . $website->id . '">PENDING</span></td></tr>';
                } else {
                    echo '<tr class="mainwp_wp_offline"><td>' . MainWP_Utility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWP_Utility::getNiceURL($website->url) . '" siteid="' . $website->id . '">DISCONNECTED</span></td></tr>';
                }
            }
        } else {
            @MainWP_DB::data_seek($websites, 0);
            while ($website = @MainWP_DB::fetch_object($websites)) {
                if ($website->sync_errors == '') {
                    echo '<tr><td>' . MainWP_Utility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWP_Utility::getNiceURL($website->url) . '" siteid="' . $website->id . '">PENDING</span></td></tr>';
                } else {
                    echo '<tr class="mainwp_wp_offline"><td>' . MainWP_Utility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWP_Utility::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://mainwp.com/extensions/" 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 esc_attr($_REQUEST['page']);
        ?>
" name="page"/>
				<select name="g">
					<option value=""><?php 
        _e('All Groups', 'mainwp');
        ?>
</option>
					<?php 
        $groups = MainWP_DB::Instance()->getGroupsForCurrentUser();
        foreach ($groups as $group) {
            echo '<option value="' . $group->id . '" ' . (isset($_REQUEST['g']) && $_REQUEST['g'] == $group->id ? 'selected' : '') . '>' . stripslashes($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']) ? esc_attr($_REQUEST['s']) : '';
        ?>
"
					autocompletelist="sites" name="s" class="mainwp_autocomplete"/>
				<datalist id="sites">
					<?php 
        if (MainWP_DB::is_result($this->items)) {
            while ($this->items && ($item = @MainWP_DB::fetch_array($this->items))) {
                echo '<option>' . $item['name'] . '</option>';
            }
            MainWP_DB::data_seek($this->items, 0);
        }
        ?>
				</datalist>
				<input type="submit" value="<?php 
        _e('Search Sites');
        ?>
" class="button" name=""/>
			</form>
		</div>
		<?php 
    }
    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);
    }
示例#6
0
    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">&nbsp;</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">&nbsp;</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">&nbsp;</span>
				<span class="mainwp-right-col">
					</a>
					<?php 
        if (mainwp_current_user_can('dashboard', 'update_wordpress')) {
            if ($total_wp_upgrades > 0) {
                ?>
							&nbsp;
							<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 {
                ?>
							&nbsp;
							<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 
                }
            }
            ?>
								&nbsp;
								<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) {
                ?>
&nbsp; <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) {
                    ?>
&nbsp; <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 {
                    ?>
 &nbsp; <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> &nbsp;
											<?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) {
                        ?>
&nbsp;&nbsp;&nbsp;<?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')) {
                        ?>
												&nbsp;
												<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')) {
                        ?>
		                        &nbsp; <?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 {
                            ?>
 &nbsp;
			                        <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) {
                        ?>
	                                    &nbsp;&nbsp;&nbsp;
	                                    <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')) {
                        ?>
		                                &nbsp;
		                                <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) {
                ?>
&nbsp;
							<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) {
                    ?>
&nbsp;
							<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 {
                    ?>
 &nbsp;
							<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> &nbsp;
		                        <?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) {
                        ?>
&nbsp;&nbsp;&nbsp;<?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')) {
                        ?>
		                                &nbsp;
		                                <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')) {
                        ?>
		                        &nbsp; <?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 {
                            ?>
 &nbsp;
			                        <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) {
                        ?>
	                                    &nbsp;&nbsp;&nbsp;
	                                    <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')) {
                        ?>
		                                &nbsp;
		                                <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>&nbsp;<?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) {
                        ?>
&nbsp;&nbsp;&nbsp;<?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')) {
                        ?>
		                                    &nbsp;
		                                    <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) {
                        ?>
	                                    &nbsp;&nbsp;&nbsp;
	                                    <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')) {
                        ?>
	                                    &nbsp;
	                                    <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>&nbsp;<?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) {
                        ?>
&nbsp;&nbsp;&nbsp;<?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')) {
                        ?>
		                                    &nbsp;
		                                    <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) {
                        ?>
	                                    &nbsp;&nbsp;&nbsp;
	                                    <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')) {
                        ?>
	                                    &nbsp;
	                                    <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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;
	                        <?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);
    }
    public static function renderSites()
    {
        $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);
        if (!$websites) {
            return;
        }
        $total_securityIssues = 0;
        @MainWP_DB::data_seek($websites, 0);
        while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
            if (MainWP_Utility::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">&nbsp;</span>
					<span class="mainwp-right-col"><a href="#" id="mainwp_securityissues_show" onClick="return rightnow_show('securityissues');"><?php 
            _e('Show All', 'mainwp');
            ?>
</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<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 
            @MainWP_DB::data_seek($websites, 0);
            while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                if (!MainWP_Utility::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 
        } else {
            esc_html_e('No security issues detected.', 'mainwp');
        }
    }
示例#8
0
 public function getLastSyncStatus($userId = null)
 {
     $sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser();
     $websites = MainWP_DB::Instance()->query($sql);
     if (!$websites) {
         return 'all_synced';
     }
     $total_sites = 0;
     $synced_sites = 0;
     @MainWP_DB::data_seek($websites, 0);
     while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
         if (empty($website) || $website->sync_errors != '') {
             continue;
         }
         $total_sites++;
         if (time() - $website->dtsSync < 60 * 60 * 24) {
             $synced_sites++;
         }
     }
     if ($total_sites == $synced_sites) {
         return 'all_synced';
     } else {
         if ($synced_sites == 0) {
             return 'not_synced';
         }
     }
     return false;
 }