public static function renderSites($renew, $pExit = true)
    {
        $current_wpid = MainWP_Utility::get_current_wpid();
        if ($current_wpid) {
            $sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid);
        } else {
            $sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser();
        }
        $websites = MainWP_DB::Instance()->query($sql);
        $allPages = array();
        if ($websites) {
            while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                if ($website->recent_pages == '') {
                    continue;
                }
                $pages = json_decode($website->recent_pages, 1);
                if (count($pages) == 0) {
                    continue;
                }
                foreach ($pages as $page) {
                    $page['website'] = (object) array('id' => $website->id, 'url' => $website->url);
                    $allPages[] = $page;
                }
            }
            @MainWP_DB::free_result($websites);
        }
        $recent_pages_published = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'publish');
        $recent_pages_published = MainWP_Utility::sortmulti($recent_pages_published, 'dts', 'desc');
        $recent_pages_draft = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'draft');
        $recent_pages_draft = MainWP_Utility::sortmulti($recent_pages_draft, 'dts', 'desc');
        $recent_pages_pending = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'pending');
        $recent_pages_pending = MainWP_Utility::sortmulti($recent_pages_pending, 'dts', 'desc');
        $recent_pages_trash = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'trash');
        $recent_pages_trash = MainWP_Utility::sortmulti($recent_pages_trash, 'dts', 'desc');
        ?>
		<div class="clear">
			<a href="<?php 
        echo admin_url('admin.php?page=PageBulkAdd&select=' . ($current_wpid ? $current_wpid : 'all'));
        ?>
" class="button-primary" style="float: right"><?php 
        _e('Add New', 'mainwp');
        ?>
</a>
			<a class="mainwp_action left mainwp_action_down recent_posts_published_lnk" href="#"><?php 
        _e('Published', 'mainwp');
        ?>
 (<?php 
        echo count($recent_pages_published);
        ?>
)</a><a class="mainwp_action mid recent_posts_draft_lnk" href="#"><?php 
        _e('Draft', 'mainwp');
        ?>
 (<?php 
        echo count($recent_pages_draft);
        ?>
)</a><a class="mainwp_action mid recent_posts_pending_lnk" href="#"><?php 
        _e('Pending', 'mainwp');
        ?>
 (<?php 
        echo count($recent_pages_pending);
        ?>
)</a><a class="mainwp_action right recent_posts_trash_lnk" href="#"><?php 
        _e('Trash', 'mainwp');
        ?>
 (<?php 
        echo count($recent_pages_trash);
        ?>
)</a><br/><br/>

			<div class="recent_posts_published">
				<?php 
        for ($i = 0; $i < count($recent_pages_published) && $i < 5; $i++) {
            if (!isset($recent_pages_published[$i]['title']) || $recent_pages_published[$i]['title'] == '') {
                $recent_pages_published[$i]['title'] = '(No Title)';
            }
            if (isset($recent_pages_published[$i]['dts'])) {
                if (!stristr($recent_pages_published[$i]['dts'], '-')) {
                    $recent_pages_published[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_published[$i]['dts']));
                }
            }
            ?>
					<div class="mainwp-row mainwp-recent">
						<input class="postId" type="hidden" name="id" value="<?php 
            echo $recent_pages_published[$i]['id'];
            ?>
"/>
						<input class="websiteId" type="hidden" name="id" value="<?php 
            echo $recent_pages_published[$i]['website']->id;
            ?>
"/>
						<span class="mainwp-left-col" style="width: 60% !important; margin-right: 1em;"><a href="<?php 
            echo $recent_pages_published[$i]['website']->url;
            ?>
?p=<?php 
            echo $recent_pages_published[$i]['id'];
            ?>
" target="_blank"><?php 
            echo htmlentities($recent_pages_published[$i]['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8');
            ?>
</a></span>
						<span class="mainwp-mid-col">
							<a href="<?php 
            echo admin_url('admin.php?page=CommentBulkManage&siteid=' . $recent_pages_published[$i]['website']->id . '&postid=' . $recent_pages_published[$i]['id']);
            ?>
" title="<?php 
            echo $recent_pages_published[$i]['comment_count'];
            ?>
" class="post-com-count" style="display: inline-block !important;">
								<span class="comment-count"><?php 
            echo $recent_pages_published[$i]['comment_count'];
            ?>
</span>
							</a>
						</span>
						<span class="mainwp-right-col">
							<a href="<?php 
            echo $recent_pages_published[$i]['website']->url;
            ?>
" target="_blank">
								<i class="fa fa-external-link"></i> <?php 
            echo MainWP_Utility::getNiceURL($recent_pages_published[$i]['website']->url);
            ?>
							</a>
							<br/>
							<?php 
            echo $recent_pages_published[$i]['dts'];
            ?>
						</span>

						<div style="clear: left;"></div>
						<div class="mainwp-row-actions">
							<a href="#" class="mainwp-post-unpublish"><?php 
            _e('Unpublish', 'mainwp');
            ?>
</a> |
							<a href="admin.php?page=SiteOpen&websiteid=<?php 
            echo $recent_pages_published[$i]['website']->id;
            ?>
&location=<?php 
            echo base64_encode('post.php?action=editpost&post=' . $recent_pages_published[$i]['id'] . '&action=edit');
            ?>
" title="Edit this post"><?php 
            _e('Edit', 'mainwp');
            ?>
</a> |
							<a href="#" class="mainwp-post-trash"><?php 
            _e('Trash', 'mainwp');
            ?>
</a>|
							<a href="<?php 
            echo $recent_pages_published[$i]['website']->url . (substr($recent_pages_published[$i]['website']->url, -1) != '/' ? '/' : '') . '?p=' . $recent_pages_published[$i]['id'];
            ?>
" target="_blank" title="View '<?php 
            echo $recent_pages_published[$i]['title'];
            ?>
'" rel="permalink"><?php 
            _e('View', 'mainwp');
            ?>
</a> |
							<a href="admin.php?page=PageBulkManage" class="mainwp-post-viewall"><?php 
            _e('View All', 'mainwp');
            ?>
</a>
						</div>
						<div class="mainwp-row-actions-working">
							<i class="fa fa-spinner fa-pulse"></i> <?php 
            _e('Please wait', 'mainwp');
            ?>
							<div>&nbsp;</div>
						</div>
					</div>
				<?php 
        }
        ?>
			</div>

			<div class="recent_posts_draft" style="display: none">
				<?php 
        for ($i = 0; $i < count($recent_pages_draft) && $i < 5; $i++) {
            if (!isset($recent_pages_draft[$i]['title']) || $recent_pages_draft[$i]['title'] == '') {
                $recent_pages_draft[$i]['title'] = '(No Title)';
            }
            if (isset($recent_pages_draft[$i]['dts'])) {
                if (!stristr($recent_pages_draft[$i]['dts'], '-')) {
                    $recent_pages_draft[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_draft[$i]['dts']));
                }
            }
            ?>
					<div class="mainwp-row mainwp-recent">
						<input class="postId" type="hidden" name="id" value="<?php 
            echo $recent_pages_draft[$i]['id'];
            ?>
"/>
						<input class="websiteId" type="hidden" name="id" value="<?php 
            echo $recent_pages_draft[$i]['website']->id;
            ?>
"/>
						<span class="mainwp-left-col" style="width: 60% !important;  margin-right: 1em;"><a href="<?php 
            echo $recent_pages_draft[$i]['website']->url;
            ?>
?p=<?php 
            echo $recent_pages_draft[$i]['id'];
            ?>
" target="_blank"><?php 
            echo htmlentities($recent_pages_draft[$i]['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8');
            ?>
</a></span>
						<span class="mainwp-mid-col">
							<a href="<?php 
            echo admin_url('admin.php?page=CommentBulkManage&siteid=' . $recent_pages_draft[$i]['website']->id . '&postid=' . $recent_pages_draft[$i]['id']);
            ?>
" title="<?php 
            echo $recent_pages_draft[$i]['comment_count'];
            ?>
" class="post-com-count" style="display: inline-block !important;">
								<span class="comment-count"><?php 
            echo $recent_pages_draft[$i]['comment_count'];
            ?>
</span>
							</a>
						</span>
						<span class="mainwp-right-col"><?php 
            echo MainWP_Utility::getNiceURL($recent_pages_draft[$i]['website']->url);
            ?>
							<br/><?php 
            echo $recent_pages_draft[$i]['dts'];
            ?>
</span>

						<div style="clear: left;"></div>
						<div class="mainwp-row-actions">
							<a href="#" class="mainwp-post-publish"><?php 
            _e('Publish', 'mainwp');
            ?>
</a> |
							<a href="admin.php?page=SiteOpen&websiteid=<?php 
            echo $recent_pages_draft[$i]['website']->id;
            ?>
&location=<?php 
            echo base64_encode('post.php?action=editpost&post=' . $recent_pages_draft[$i]['id'] . '&action=edit');
            ?>
" title="Edit this post"><?php 
            _e('Edit', 'mainwp');
            ?>
</a> |
							<a href="#" class="mainwp-post-trash"><?php 
            _e('Trash', 'mainwp');
            ?>
</a> |
							<a href="admin.php?page=PostBulkManage" class="mainwp-post-viewall"><?php 
            _e('View All', 'mainwp');
            ?>
</a>
						</div>
						<div class="mainwp-row-actions-working">
							<i class="fa fa-spinner fa-pulse"></i> <?php 
            _e('Please wait', 'mainwp');
            ?>
						</div>
						<div>&nbsp;</div>
					</div>
				<?php 
        }
        ?>
			</div>

			<div class="recent_posts_pending" style="display: none">
				<?php 
        for ($i = 0; $i < count($recent_pages_pending) && $i < 5; $i++) {
            if (!isset($recent_pages_pending[$i]['title']) || $recent_pages_pending[$i]['title'] == '') {
                $recent_pages_pending[$i]['title'] = '(No Title)';
            }
            if (isset($recent_pages_pending[$i]['dts'])) {
                if (!stristr($recent_pages_pending[$i]['dts'], '-')) {
                    $recent_pages_pending[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_pending[$i]['dts']));
                }
            }
            ?>
					<div class="mainwp-row mainwp-recent">
						<input class="postId" type="hidden" name="id" value="<?php 
            echo $recent_pages_pending[$i]['id'];
            ?>
"/>
						<input class="websiteId" type="hidden" name="id" value="<?php 
            echo $recent_pages_pending[$i]['website']->id;
            ?>
"/>
						<span class="mainwp-left-col" style="width: 60% !important;  margin-right: 1em;"><a href="<?php 
            echo $recent_pages_pending[$i]['website']->url;
            ?>
?p=<?php 
            echo $recent_pages_pending[$i]['id'];
            ?>
" target="_blank"><?php 
            echo htmlentities($recent_pages_pending[$i]['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8');
            ?>
</a></span>
                    <span class="mainwp-mid-col">
                            <a href="<?php 
            echo admin_url('admin.php?page=CommentBulkManage&siteid=' . $recent_pages_pending[$i]['website']->id . '&postid=' . $recent_pages_pending[$i]['id']);
            ?>
" title="<?php 
            echo $recent_pages_pending[$i]['comment_count'];
            ?>
" class="post-com-count" style="display: inline-block !important;">
	                            <span class="comment-count"><?php 
            echo $recent_pages_pending[$i]['comment_count'];
            ?>
</span>
                            </a>
                    </span>
						<span class="mainwp-right-col"><?php 
            echo MainWP_Utility::getNiceURL($recent_pages_pending[$i]['website']->url);
            ?>
							<br/><?php 
            echo $recent_pages_pending[$i]['dts'];
            ?>
</span>

						<div style="clear: left;"></div>
						<div class="mainwp-row-actions">
							<a href="#" class="mainwp-post-publish"><?php 
            _e('Publish', 'mainwp');
            ?>
</a> |
							<a href="admin.php?page=SiteOpen&websiteid=<?php 
            echo $recent_pages_pending[$i]['website']->id;
            ?>
&location=<?php 
            echo base64_encode('post.php?action=editpost&post=' . $recent_pages_pending[$i]['id'] . '&action=edit');
            ?>
" title="Edit this post"><?php 
            _e('Edit', 'mainwp');
            ?>
</a> |
							<a href="#" class="mainwp-post-trash"><?php 
            _e('Trash', 'mainwp');
            ?>
</a> |
							<a href="admin.php?page=PostBulkManage" class="mainwp-post-viewall"><?php 
            _e('View All', 'mainwp');
            ?>
</a>
						</div>
						<div class="mainwp-row-actions-working">
							<i class="fa fa-spinner fa-pulse"></i> <?php 
            _e('Please wait', 'mainwp');
            ?>
						</div>
						<div>&nbsp;</div>
					</div>
				<?php 
        }
        ?>
			</div>
			<div class="recent_posts_trash" style="display: none">
				<?php 
        for ($i = 0; $i < count($recent_pages_trash) && $i < 5; $i++) {
            if (!isset($recent_pages_trash[$i]['title']) || $recent_pages_trash[$i]['title'] == '') {
                $recent_pages_trash[$i]['title'] = '(No Title)';
            }
            if (isset($recent_pages_trash[$i]['dts'])) {
                if (!stristr($recent_pages_trash[$i]['dts'], '-')) {
                    $recent_pages_trash[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_trash[$i]['dts']));
                }
            }
            ?>
					<div class="mainwp-row mainwp-recent">
						<input class="postId" type="hidden" name="id" value="<?php 
            echo $recent_pages_trash[$i]['id'];
            ?>
"/>
						<input class="websiteId" type="hidden" name="id" value="<?php 
            echo $recent_pages_trash[$i]['website']->id;
            ?>
"/>
						<span class="mainwp-left-col" style="width: 60% !important;  margin-right: 1em;"><?php 
            echo $recent_pages_trash[$i]['title'];
            ?>
</span>
						<span class="mainwp-mid-col">
							<a href="<?php 
            echo admin_url('admin.php?page=CommentBulkManage&siteid=' . $recent_pages_trash[$i]['website']->id . '&postid=' . $recent_pages_trash[$i]['id']);
            ?>
" title="<?php 
            echo $recent_pages_trash[$i]['comment_count'];
            ?>
" class="post-com-count" style="display: inline-block !important;">
								<span class="comment-count"><?php 
            echo $recent_pages_trash[$i]['comment_count'];
            ?>
</span>
							</a>
						</span>
						<span class="mainwp-right-col"><?php 
            echo MainWP_Utility::getNiceURL($recent_pages_trash[$i]['website']->url);
            ?>
							<br/><?php 
            echo $recent_pages_trash[$i]['dts'];
            ?>
</span>

						<div style="clear: left;"></div>
						<div class="mainwp-row-actions">
							<a href="#" class="mainwp-post-restore"><?php 
            _e('Restore', 'mainwp');
            ?>
</a> |
							<a href="#" class="mainwp-post-delete delete" style="color: red;"><?php 
            _e('Delete Permanently', 'mainwp');
            ?>
</a>
						</div>
						<div class="mainwp-row-actions-working">
							<i class="fa fa-spinner fa-pulse"></i> <?php 
            _e('Please wait', 'mainwp');
            ?>
						</div>
						<div>&nbsp;</div>
					</div>
				<?php 
        }
        ?>
			</div>
		</div>
		<div class="clear"></div>
		<?php 
        if ($pExit == true) {
            exit;
        }
    }
    public static function renderWidget($renew, $pExit = true)
    {
        $current_wpid = MainWP_Utility::get_current_wpid();
        if (empty($current_wpid)) {
            return;
        }
        $sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid);
        $websites = MainWP_DB::Instance()->query($sql);
        $allPlugins = array();
        if ($websites) {
            $website = @MainWP_DB::fetch_object($websites);
            if ($website && $website->plugins != '') {
                $plugins = json_decode($website->plugins, 1);
                if (is_array($plugins) && count($plugins) != 0) {
                    foreach ($plugins as $plugin) {
                        if (isset($plugin['mainwp']) && $plugin['mainwp'] == 'T') {
                            continue;
                        }
                        $allPlugins[] = $plugin;
                    }
                }
            }
            @MainWP_DB::free_result($websites);
        }
        $actived_plugins = MainWP_Utility::getSubArrayHaving($allPlugins, 'active', 1);
        $actived_plugins = MainWP_Utility::sortmulti($actived_plugins, 'name', 'desc');
        $inactive_plugins = MainWP_Utility::getSubArrayHaving($allPlugins, 'active', 0);
        $inactive_plugins = MainWP_Utility::sortmulti($inactive_plugins, 'name', 'desc');
        $plugins_outdate = array();
        if (count($allPlugins) > 0 && $website) {
            $plugins_outdate = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'plugins_outdate_info'), true);
            if (!is_array($plugins_outdate)) {
                $plugins_outdate = array();
            }
            $pluginsOutdateDismissed = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'plugins_outdate_dismissed'), true);
            if (is_array($pluginsOutdateDismissed)) {
                $plugins_outdate = array_diff_key($plugins_outdate, $pluginsOutdateDismissed);
            }
            $userExtension = MainWP_DB::Instance()->getUserExtension();
            $decodedDismissedPlugins = json_decode($userExtension->dismissed_plugins, true);
            if (is_array($decodedDismissedPlugins)) {
                $plugins_outdate = array_diff_key($plugins_outdate, $decodedDismissedPlugins);
            }
        }
        ?>
		<div class="clear mwp_plugintheme_widget">
			<a class="mainwp_action left mainwp_action_down plugins_actived_lnk" href="#"><?php 
        _e('Active', 'mainwp');
        ?>
 (<?php 
        echo count($actived_plugins);
        ?>
)</a><a class="mainwp_action mid plugins_inactive_lnk right" href="#"><?php 
        _e('Inactive', 'mainwp');
        ?>
 (<?php 
        echo count($inactive_plugins);
        ?>
)</a><br/><br/>

			<div class="mainwp_plugins_active">
				<?php 
        $str_format = __(' | Last Updated %s Days Ago', 'mainwp');
        for ($i = 0; $i < count($actived_plugins); $i++) {
            $outdate_notice = '';
            $slug = $actived_plugins[$i]['slug'];
            if (isset($plugins_outdate[$slug])) {
                $plugin_outdate = $plugins_outdate[$slug];
                $now = new \DateTime();
                $last_updated = $plugin_outdate['last_updated'];
                $plugin_last_updated_date = new \DateTime('@' . $last_updated);
                $diff_in_days = $now->diff($plugin_last_updated_date)->format('%a');
                $outdate_notice = sprintf($str_format, $diff_in_days);
            }
            ?>
					<div class="mainwp-row mainwp-active">
						<input class="pluginSlug" type="hidden" name="slug" value="<?php 
            echo $actived_plugins[$i]['slug'];
            ?>
"/>
						<input class="websiteId" type="hidden" name="id" value="<?php 
            echo $website->id;
            ?>
"/>
						<span class="mainwp-left-col">
							<a href="<?php 
            echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . dirname($actived_plugins[$i]['slug']) . '&TB_iframe=true&width=640&height=477';
            ?>
" target="_blank" class="thickbox" title="More information about <?php 
            echo $actived_plugins[$i]['name'];
            ?>
">
								<?php 
            echo $actived_plugins[$i]['name'];
            ?>
							</a>
							<?php 
            echo ' ' . $actived_plugins[$i]['version'];
            ?>
 <?php 
            echo $outdate_notice;
            ?>
						</span>

						<div class="mainwp-right-col pluginsAction">
							<?php 
            if (mainwp_current_user_can('dashboard', 'activate_deactivate_plugins')) {
                ?>
								<a href="#" class="mainwp-plugin-deactivate"><i class="fa fa-toggle-off"></i> <?php 
                _e('Deactivate', 'mainwp');
                ?>
								</a>
							<?php 
            }
            ?>
						</div>
						<div style="clear: left;"></div>
						<div class="mainwp-row-actions-working">
							<i class="fa fa-spinner fa-pulse"></i> <?php 
            _e('Please wait', 'mainwp');
            ?>
</div>
						<div>&nbsp;</div>
					</div>
				<?php 
        }
        ?>
			</div>

			<div class="mainwp_plugins_inactive" style="display: none">
				<?php 
        for ($i = 0; $i < count($inactive_plugins); $i++) {
            $outdate_notice = '';
            $slug = $inactive_plugins[$i]['slug'];
            if (isset($plugins_outdate[$slug])) {
                $plugin_outdate = $plugins_outdate[$slug];
                $now = new \DateTime();
                $last_updated = $plugin_outdate['last_updated'];
                $plugin_last_updated_date = new \DateTime('@' . $last_updated);
                $diff_in_days = $now->diff($plugin_last_updated_date)->format('%a');
                $outdate_notice = sprintf($str_format, $diff_in_days);
            }
            ?>
					<div class="mainwp-row mainwp-inactive">
						<input class="pluginSlug" type="hidden" name="slug" value="<?php 
            echo $inactive_plugins[$i]['slug'];
            ?>
"/>
						<input class="websiteId" type="hidden" name="id" value="<?php 
            echo $website->id;
            ?>
"/>
						<span class="mainwp-left-col">
						<a href="<?php 
            echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . dirname($inactive_plugins[$i]['slug']) . '&TB_iframe=true&width=640&height=477';
            ?>
" target="_blank" class="thickbox" title="More information about <?php 
            echo $inactive_plugins[$i]['name'];
            ?>
">
							<?php 
            echo $inactive_plugins[$i]['name'];
            ?>
						</a>
						<?php 
            echo ' ' . $inactive_plugins[$i]['version'];
            ?>
 <?php 
            echo $outdate_notice;
            ?>
						</span>

						<div class="mainwp-right-col pluginsAction">
							<?php 
            if (mainwp_current_user_can('dashboard', 'activate_deactivate_plugins')) {
                ?>
								<a href="#" class="mainwp-plugin-activate"><i class="fa fa-toggle-on"></i> <?php 
                _e('Activate', 'mainwp');
                ?>
								</a> |
							<?php 
            }
            ?>
							<?php 
            if (mainwp_current_user_can('dashboard', 'delete_plugins')) {
                ?>
								<a href="#" class="mainwp-plugin-delete mainwp-red"><i class="fa fa-trash"></i> <?php 
                _e('Delete', 'mainwp');
                ?>
								</a>
							<?php 
            }
            ?>
						</div>
						<div style="clear: left;"></div>
						<div class="mainwp-row-actions-working">
							<i class="fa fa-spinner fa-pulse"></i> <?php 
            _e('Please wait', 'mainwp');
            ?>
</div>
						<div>&nbsp;</div>
					</div>
				<?php 
        }
        ?>
			</div>
		</div>
		<div class="clear"></div>
		<?php 
        if ($pExit == true) {
            exit;
        }
    }
    public static function renderWidget($renew, $pExit = true)
    {
        $current_wpid = MainWP_Utility::get_current_wpid();
        if (empty($current_wpid)) {
            return;
        }
        $sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid);
        $websites = MainWP_DB::Instance()->query($sql);
        $allThemes = array();
        if ($websites) {
            $website = @MainWP_DB::fetch_object($websites);
            if ($website && $website->themes != '') {
                $themes = json_decode($website->themes, 1);
                if (is_array($themes) && count($themes) != 0) {
                    foreach ($themes as $theme) {
                        $allThemes[] = $theme;
                    }
                }
            }
            @MainWP_DB::free_result($websites);
        }
        $actived_themes = MainWP_Utility::getSubArrayHaving($allThemes, 'active', 1);
        $actived_themes = MainWP_Utility::sortmulti($actived_themes, 'name', 'desc');
        $inactive_themes = MainWP_Utility::getSubArrayHaving($allThemes, 'active', 0);
        $inactive_themes = MainWP_Utility::sortmulti($inactive_themes, 'name', 'desc');
        if (count($allThemes) > 0 && $website) {
            $themes_outdate = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_info'), true);
            if (!is_array($themes_outdate)) {
                $themes_outdate = array();
            }
            $themesOutdateDismissed = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_dismissed'), true);
            if (is_array($themesOutdateDismissed)) {
                $themes_outdate = array_diff_key($themes_outdate, $themesOutdateDismissed);
            }
            $userExtension = MainWP_DB::Instance()->getUserExtension();
            $decodedDismissedThemes = json_decode($userExtension->dismissed_themes, true);
            if (is_array($decodedDismissedThemes)) {
                $themes_outdate = array_diff_key($themes_outdate, $decodedDismissedThemes);
            }
        }
        ?>
		<div class="clear">
			<a class="mainwp_action left mainwp_action_down themes_actived_lnk" href="#"><?php 
        _e('Active', 'mainwp');
        ?>
 (<?php 
        echo count($actived_themes);
        ?>
)</a><a class="mainwp_action mid themes_inactive_lnk right" href="#"><?php 
        _e('Inactive', 'mainwp');
        ?>
 (<?php 
        echo count($inactive_themes);
        ?>
)</a><br/><br/>

			<div class="mainwp_themes_active">
				<?php 
        $str_format = __(' | Last Updated %s Days Ago', 'mainwp');
        for ($i = 0; $i < count($actived_themes); $i++) {
            $outdate_notice = '';
            $slug = $actived_themes[$i]['slug'];
            if (isset($themes_outdate[$slug])) {
                $theme_outdate = $themes_outdate[$slug];
                $now = new \DateTime();
                $last_updated = $theme_outdate['last_updated'];
                $theme_last_updated_date = new \DateTime('@' . $last_updated);
                $diff_in_days = $now->diff($theme_last_updated_date)->format('%a');
                $outdate_notice = sprintf($str_format, $diff_in_days);
            }
            ?>
					<div class="mainwp-row mainwp-active">
						<input class="themeName" type="hidden" name="name" value="<?php 
            echo $actived_themes[$i]['name'];
            ?>
"/>
						<input class="websiteId" type="hidden" name="id" value="<?php 
            echo $website->id;
            ?>
"/>
						<span class="mainwp-left-col">
							<?php 
            echo $actived_themes[$i]['name'] . ' ' . $actived_themes[$i]['version'];
            echo $outdate_notice;
            ?>
						</span>
					</div>
				<?php 
        }
        ?>
			</div>

			<div class="mainwp_themes_inactive" style="display: none">
				<?php 
        for ($i = 0; $i < count($inactive_themes); $i++) {
            $outdate_notice = '';
            $slug = $inactive_themes[$i]['slug'];
            if (isset($themes_outdate[$slug])) {
                $theme_outdate = $themes_outdate[$slug];
                $now = new \DateTime();
                $last_updated = $theme_outdate['last_updated'];
                $theme_last_updated_date = new \DateTime('@' . $last_updated);
                $diff_in_days = $now->diff($theme_last_updated_date)->format('%a');
                $outdate_notice = sprintf($str_format, $diff_in_days);
            }
            ?>
					<div class="mainwp-row mainwp-inactive">
						<input class="themeName" type="hidden" name="name" value="<?php 
            echo $inactive_themes[$i]['name'];
            ?>
"/>
						<input class="websiteId" type="hidden" name="id" value="<?php 
            echo $website->id;
            ?>
"/>
						<span class="mainwp-left-col">
							<?php 
            echo $inactive_themes[$i]['name'] . ' ' . $inactive_themes[$i]['version'];
            echo $outdate_notice;
            ?>
						</span>

						<div class="mainwp-right-col themesAction">
							<?php 
            if (mainwp_current_user_can('dashboard', 'activate_themes')) {
                ?>
								<a href="#" class="mainwp-theme-activate"><i class="fa fa-toggle-on"></i> <?php 
                _e('Activate', 'mainwp');
                ?>
								</a> |
							<?php 
            }
            ?>
							<?php 
            if (mainwp_current_user_can('dashboard', 'delete_themes')) {
                ?>
								<a href="#" class="mainwp-theme-delete mainwp-red"><i class="fa fa-trash"></i> <?php 
                _e('Delete', 'mainwp');
                ?>
								</a>
							<?php 
            }
            ?>
						</div>
						<div style="clear: left;"></div>
						<div class="mainwp-row-actions-working">
							<i class="fa fa-spinner fa-pulse"></i> <?php 
            _e('Please wait', 'mainwp');
            ?>
</div>
						<div>&nbsp;</div>
					</div>
				<?php 
        }
        ?>
			</div>
		</div>
		<div class="clear"></div>
		<?php 
        if ($pExit == true) {
            exit;
        }
    }