예제 #1
0
    public static function renderSites($renew, $pExit = true)
    {
        $current_wpid = MainWPUtility::get_current_wpid();
        if ($current_wpid) {
            $sql = MainWPDB::Instance()->getSQLWebsiteById($current_wpid);
        } else {
            $sql = MainWPDB::Instance()->getSQLWebsitesForCurrentUser();
        }
        $websites = MainWPDB::Instance()->query($sql);
        $allPosts = array();
        if ($websites) {
            while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                if ($website->recent_posts == '') {
                    continue;
                }
                $posts = json_decode($website->recent_posts, 1);
                if (count($posts) == 0) {
                    continue;
                }
                foreach ($posts as $post) {
                    $post['website'] = (object) array('id' => $website->id, 'url' => $website->url);
                    $allPosts[] = $post;
                }
            }
            @MainWPDB::free_result($websites);
        }
        $recent_posts_published = MainWPUtility::getSubArrayHaving($allPosts, 'status', 'publish');
        $recent_posts_published = MainWPUtility::sortmulti($recent_posts_published, 'dts', 'desc');
        $recent_posts_draft = MainWPUtility::getSubArrayHaving($allPosts, 'status', 'draft');
        $recent_posts_draft = MainWPUtility::sortmulti($recent_posts_draft, 'dts', 'desc');
        $recent_posts_pending = MainWPUtility::getSubArrayHaving($allPosts, 'status', 'pending');
        $recent_posts_pending = MainWPUtility::sortmulti($recent_posts_pending, 'dts', 'desc');
        $recent_posts_trash = MainWPUtility::getSubArrayHaving($allPosts, 'status', 'trash');
        $recent_posts_trash = MainWPUtility::sortmulti($recent_posts_trash, 'dts', 'desc');
        ?>
        <div class="clear">
            <a href="<?php 
        echo admin_url('admin.php?page=PostBulkAdd&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_posts_published);
        ?>
)</a><a class="mainwp_action mid recent_posts_draft_lnk" href="#" ><?php 
        _e('Draft', 'mainwp');
        ?>
 (<?php 
        echo count($recent_posts_draft);
        ?>
)</a><a class="mainwp_action mid recent_posts_pending_lnk" href="#"><?php 
        _e('Pending', 'mainwp');
        ?>
 (<?php 
        echo count($recent_posts_pending);
        ?>
)</a><a class="mainwp_action right recent_posts_trash_lnk" href="#"><?php 
        _e('Trash', 'mainwp');
        ?>
 (<?php 
        echo count($recent_posts_trash);
        ?>
)</a><br/><br/>
            <div class="recent_posts_published">
                <?php 
        for ($i = 0; $i < count($recent_posts_published) && $i < 5; $i++) {
            if (!isset($recent_posts_published[$i]['title']) || $recent_posts_published[$i]['title'] == '') {
                $recent_posts_published[$i]['title'] = '(No Title)';
            }
            if (isset($recent_posts_published[$i]['dts'])) {
                if (!stristr($recent_posts_published[$i]['dts'], '-')) {
                    $recent_posts_published[$i]['dts'] = MainWPUtility::formatTimestamp(MainWPUtility::getTimestamp($recent_posts_published[$i]['dts']));
                }
            }
            ?>
                <div class="mainwp-row mainwp-recent">
                    <input class="postId" type="hidden" name="id" value="<?php 
            echo $recent_posts_published[$i]['id'];
            ?>
"/>
                    <input class="websiteId" type="hidden" name="id" value="<?php 
            echo $recent_posts_published[$i]['website']->id;
            ?>
"/>
                    <span class="mainwp-left-col" style="width: 60% !important;  margin-right: 1em;"><a href="<?php 
            echo $recent_posts_published[$i]['website']->url;
            ?>
?p=<?php 
            echo $recent_posts_published[$i]['id'];
            ?>
" target="_blank"><?php 
            echo htmlentities($recent_posts_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_posts_published[$i]['website']->id . '&postid=' . $recent_posts_published[$i]['id']);
            ?>
" title="<?php 
            echo $recent_posts_published[$i]['comment_count'];
            ?>
" class="post-com-count" style="display: inline-block !important;">
                                <span class="comment-count"><?php 
            echo $recent_posts_published[$i]['comment_count'];
            ?>
</span>
                            </a>
                    </span>
                    <span class="mainwp-right-col"><a href="<?php 
            echo $recent_posts_published[$i]['website']->url;
            ?>
" target="_blank"><i class="fa fa-external-link"></i> <?php 
            echo MainWPUtility::getNiceURL($recent_posts_published[$i]['website']->url);
            ?>
</a> <br/><?php 
            echo $recent_posts_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_posts_published[$i]['website']->id;
            ?>
&location=<?php 
            echo base64_encode('post.php?action=editpost&post=' . $recent_posts_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_posts_published[$i]['website']->url . (substr($recent_posts_published[$i]['website']->url, -1) != '/' ? '/' : '') . '?p=' . $recent_posts_published[$i]['id'];
            ?>
" target="_blank" title="View '<?php 
            echo $recent_posts_published[$i]['title'];
            ?>
'" rel="permalink"><?php 
            _e('View', '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>&nbsp;</div>
                    </div>
                </div>
                <?php 
        }
        ?>
            </div>

            <div class="recent_posts_draft" style="display: none">
                <?php 
        for ($i = 0; $i < count($recent_posts_draft) && $i < 5; $i++) {
            if (!isset($recent_posts_draft[$i]['title']) || $recent_posts_draft[$i]['title'] == '') {
                $recent_posts_draft[$i]['title'] = '(No Title)';
            }
            if (isset($recent_posts_draft[$i]['dts'])) {
                if (!stristr($recent_posts_draft[$i]['dts'], '-')) {
                    $recent_posts_draft[$i]['dts'] = MainWPUtility::formatTimestamp(MainWPUtility::getTimestamp($recent_posts_draft[$i]['dts']));
                }
            }
            ?>
                <div class="mainwp-row mainwp-recent">
                    <input class="postId" type="hidden" name="id" value="<?php 
            echo $recent_posts_draft[$i]['id'];
            ?>
"/>
                    <input class="websiteId" type="hidden" name="id" value="<?php 
            echo $recent_posts_draft[$i]['website']->id;
            ?>
"/>
                    <span class="mainwp-left-col" style="width: 60% !important;  margin-right: 1em;"><a href="<?php 
            echo $recent_posts_draft[$i]['website']->url;
            ?>
?p=<?php 
            echo $recent_posts_draft[$i]['id'];
            ?>
" target="_blank"><?php 
            echo htmlentities($recent_posts_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_posts_draft[$i]['website']->id . '&postid=' . $recent_posts_draft[$i]['id']);
            ?>
" title="<?php 
            echo $recent_posts_draft[$i]['comment_count'];
            ?>
" class="post-com-count" style="display: inline-block !important;">
                                <span class="comment-count"><?php 
            echo $recent_posts_draft[$i]['comment_count'];
            ?>
</span>
                            </a>
                    </span>
                    <span class="mainwp-right-col"><?php 
            echo MainWPUtility::getNiceURL($recent_posts_draft[$i]['website']->url);
            ?>
 <br/><?php 
            echo $recent_posts_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_posts_draft[$i]['website']->id;
            ?>
&location=<?php 
            echo base64_encode('post.php?action=editpost&post=' . $recent_posts_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_posts_pending) && $i < 5; $i++) {
            if (!isset($recent_posts_pending[$i]['title']) || $recent_posts_pending[$i]['title'] == '') {
                $recent_posts_pending[$i]['title'] = '(No Title)';
            }
            if (isset($recent_posts_pending[$i]['dts'])) {
                if (!stristr($recent_posts_pending[$i]['dts'], '-')) {
                    $recent_posts_pending[$i]['dts'] = MainWPUtility::formatTimestamp(MainWPUtility::getTimestamp($recent_posts_pending[$i]['dts']));
                }
            }
            ?>
                <div class="mainwp-row mainwp-recent">
                    <input class="postId" type="hidden" name="id" value="<?php 
            echo $recent_posts_pending[$i]['id'];
            ?>
"/>
                    <input class="websiteId" type="hidden" name="id" value="<?php 
            echo $recent_posts_pending[$i]['website']->id;
            ?>
"/>
                    <span class="mainwp-left-col" style="width: 60% !important;  margin-right: 1em;"><a href="<?php 
            echo $recent_posts_pending[$i]['website']->url;
            ?>
?p=<?php 
            echo $recent_posts_pending[$i]['id'];
            ?>
" target="_blank"><?php 
            echo htmlentities($recent_posts_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_posts_pending[$i]['website']->id . '&postid=' . $recent_posts_pending[$i]['id']);
            ?>
" title="<?php 
            echo $recent_posts_pending[$i]['comment_count'];
            ?>
" class="post-com-count" style="display: inline-block !important;">
                                <span class="comment-count"><?php 
            echo $recent_posts_pending[$i]['comment_count'];
            ?>
</span>
                            </a>
                    </span>
                    <span class="mainwp-right-col"><?php 
            echo MainWPUtility::getNiceURL($recent_posts_pending[$i]['website']->url);
            ?>
 <br/><?php 
            echo $recent_posts_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_posts_pending[$i]['website']->id;
            ?>
&location=<?php 
            echo base64_encode('post.php?action=editpost&post=' . $recent_posts_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_posts_trash) && $i < 5; $i++) {
            if (!isset($recent_posts_trash[$i]['title']) || $recent_posts_trash[$i]['title'] == '') {
                $recent_posts_trash[$i]['title'] = '(No Title)';
            }
            if (isset($recent_posts_trash[$i]['dts'])) {
                if (!stristr($recent_posts_trash[$i]['dts'], '-')) {
                    $recent_posts_trash[$i]['dts'] = MainWPUtility::formatTimestamp(MainWPUtility::getTimestamp($recent_posts_trash[$i]['dts']));
                }
            }
            ?>
                <div class="mainwp-row mainwp-recent">
                    <input class="postId" type="hidden" name="id" value="<?php 
            echo $recent_posts_trash[$i]['id'];
            ?>
"/>
                    <input class="websiteId" type="hidden" name="id" value="<?php 
            echo $recent_posts_trash[$i]['website']->id;
            ?>
"/>
                    <span class="mainwp-left-col" style="width: 60% !important;  margin-right: 1em;"><?php 
            echo htmlentities($recent_posts_trash[$i]['title'], ENT_COMPAT | ENT_HTML401, "UTF-8");
            ?>
</span>
                    <span class="mainwp-mid-col">
                            <a href="<?php 
            echo admin_url('admin.php?page=CommentBulkManage&siteid=' . $recent_posts_trash[$i]['website']->id . '&postid=' . $recent_posts_trash[$i]['id']);
            ?>
" title="<?php 
            echo $recent_posts_trash[$i]['comment_count'];
            ?>
" class="post-com-count" style="display: inline-block !important;">
                                <span class="comment-count"><?php 
            echo $recent_posts_trash[$i]['comment_count'];
            ?>
</span>
                            </a>
                    </span>
                    <span class="mainwp-right-col"><?php 
            echo MainWPUtility::getNiceURL($recent_posts_trash[$i]['website']->url);
            ?>
 <br/><?php 
            echo $recent_posts_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;
        }
    }
예제 #2
0
    public static function renderWidget($renew, $pExit = true)
    {
        $current_wpid = MainWPUtility::get_current_wpid();
        if (empty($current_wpid)) {
            return;
        }
        $sql = MainWPDB::Instance()->getSQLWebsiteById($current_wpid);
        $websites = MainWPDB::Instance()->query($sql);
        $allPlugins = array();
        if ($websites) {
            $website = @MainWPDB::fetch_object($websites);
            if ($website && $website->plugins != '') {
                $plugins = json_decode($website->plugins, 1);
                if (is_array($plugins) && count($plugins) != 0) {
                    foreach ($plugins as $plugin) {
                        $allPlugins[] = $plugin;
                    }
                }
            }
            @MainWPDB::free_result($websites);
        }
        $actived_plugins = MainWPUtility::getSubArrayHaving($allPlugins, 'active', 1);
        $actived_plugins = MainWPUtility::sortmulti($actived_plugins, 'name', 'desc');
        $inactive_plugins = MainWPUtility::getSubArrayHaving($allPlugins, 'active', 0);
        $inactive_plugins = MainWPUtility::sortmulti($inactive_plugins, 'name', 'desc');
        $plugins_outdate = array();
        if (count($allPlugins) > 0 && $website) {
            $plugins_outdate = json_decode(MainWPDB::Instance()->getWebsiteOption($website, 'plugins_outdate_info'), true);
            if (!is_array($plugins_outdate)) {
                $plugins_outdate = array();
            }
            $pluginsOutdateDismissed = json_decode(MainWPDB::Instance()->getWebsiteOption($website, 'plugins_outdate_dismissed'), true);
            if (is_array($pluginsOutdateDismissed)) {
                $plugins_outdate = array_diff_key($plugins_outdate, $pluginsOutdateDismissed);
            }
            $userExtension = MainWPDB::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 = MainWPUtility::get_current_wpid();
        if (empty($current_wpid)) {
            return;
        }
        $sql = MainWPDB::Instance()->getSQLWebsiteById($current_wpid);
        $websites = MainWPDB::Instance()->query($sql);
        $allPlugins = array();
        if ($websites) {
            $website = @MainWPDB::fetch_object($websites);
            if ($website && $website->plugins != '') {
                $plugins = json_decode($website->plugins, 1);
                if (is_array($plugins) && count($plugins) != 0) {
                    foreach ($plugins as $plugin) {
                        $allPlugins[] = $plugin;
                    }
                }
            }
            @MainWPDB::free_result($websites);
        }
        $actived_plugins = MainWPUtility::getSubArrayHaving($allPlugins, 'active', 1);
        $actived_plugins = MainWPUtility::sortmulti($actived_plugins, 'name', 'desc');
        $inactive_plugins = MainWPUtility::getSubArrayHaving($allPlugins, 'active', 0);
        $inactive_plugins = MainWPUtility::sortmulti($inactive_plugins, 'name', 'desc');
        ?>
        <div class="clear">            
            <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 
        for ($i = 0; $i < count($actived_plugins); $i++) {
            ?>
                <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'];
            ?>
 
					</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++) {
            ?>
                <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'];
            ?>
 							
                    </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 = MainWPUtility::get_current_wpid();
        if (empty($current_wpid)) {
            return;
        }
        $sql = MainWPDB::Instance()->getSQLWebsiteById($current_wpid);
        $websites = MainWPDB::Instance()->query($sql);
        $allThemes = array();
        if ($websites) {
            $website = @MainWPDB::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;
                    }
                }
            }
            @MainWPDB::free_result($websites);
        }
        $actived_themes = MainWPUtility::getSubArrayHaving($allThemes, 'active', 1);
        $actived_themes = MainWPUtility::sortmulti($actived_themes, 'name', 'desc');
        $inactive_themes = MainWPUtility::getSubArrayHaving($allThemes, 'active', 0);
        $inactive_themes = MainWPUtility::sortmulti($inactive_themes, 'name', 'desc');
        ?>
        <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 
        for ($i = 0; $i < count($actived_themes); $i++) {
            ?>
                <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'];
            ?>
                            
                    </span>					       
                </div>
                <?php 
        }
        ?>
            </div>

            <div class="mainwp_themes_inactive" style="display: none">
                <?php 
        for ($i = 0; $i < count($inactive_themes); $i++) {
            ?>
                <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'];
            ?>
							
                    </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;
        }
    }