Exemplo n.º 1
0
 public static function render()
 {
     if (!mainwp_current_user_can('dashboard', 'access_wpadmin_on_child_sites')) {
         mainwp_do_not_have_permissions(__('WP-Admin on child sites', 'mainwp'));
         return;
     }
     if (!isset($_GET['websiteid'])) {
         exit;
     }
     $id = $_GET['websiteid'];
     $website = MainWP_DB::Instance()->getWebsiteById($id);
     if (!MainWP_Utility::can_edit_website($website)) {
         exit;
     }
     $location = '';
     if (isset($_GET['location'])) {
         $location = base64_decode($_GET['location']);
     }
     MainWP_Site_Open::openSite($website, $location, isset($_GET['newWindow']) ? $_GET['newWindow'] : null);
 }
 function column_task_name($item)
 {
     $actions = array('edit' => sprintf('<a href="admin.php?page=ManageBackups&id=%s">' . '<i class="fa fa-pencil-square-o"></i> ' . __('Edit', 'mainwp') . '</a>', $item->id), 'delete' => sprintf('<a class="submitdelete" href="#" task_id="%s" onClick="return managebackups_remove(this);">' . '<i class="fa fa-trash-o"></i> ' . __('Delete', 'mainwp') . '</a>', $item->id));
     if (!mainwp_current_user_can('dashboard', 'edit_backup_tasks')) {
         unset($actions['edit']);
     }
     if (!mainwp_current_user_can('dashboard', 'delete_backup_tasks')) {
         unset($actions['delete']);
     }
     if ($item->paused == 1) {
         if (mainwp_current_user_can('dashboard', 'pause_resume_backup_tasks')) {
             $actions['resume'] = sprintf('<a href="#" task_id="%s" onClick="return managebackups_resume(this)">' . '<i class="fa fa-play"></i> ' . __('Resume', 'mainwp') . '</a>', $item->id);
         }
         return sprintf('<strong><a style="color: #999;" href="admin.php?page=ManageBackups&id=%s" title="Paused">%s</a></strong><br /><div id="task-status-%s" style="float: left; padding-right: 20px"></div>%s', $item->id, $item->name, $item->id, $this->row_actions($actions));
     } else {
         if (mainwp_current_user_can('dashboard', 'pause_resume_backup_tasks')) {
             $actions['pause'] = sprintf('<a href="#" task_id="%s" onClick="return managebackups_pause(this)">' . '<i class="fa fa-pause"></i> ' . __('Pause', 'mainwp') . '</a>', $item->id);
         }
         return sprintf('<strong><a href="admin.php?page=ManageBackups&id=%s">%s</a></strong><br /><div id="task-status-%s" style="float: left; padding-right: 20px"></div>%s', $item->id, $item->name, $item->id, $this->row_actions($actions));
     }
 }
 public static function initMenu()
 {
     if (mainwp_current_user_can('dashboard', 'manage_security_issues')) {
         add_submenu_page('mainwp_tab', 'SecurityIssues', '<div class="mainwp-hidden">' . __('SecurityIssues', 'mainwp') . '</div>', 'read', 'SecurityIssues', array(MainWP_Security_Issues::getClassName(), 'render'));
     }
 }
Exemplo n.º 4
0
    public static function render()
    {
        if (!mainwp_current_user_can("dashboard", "manage_users")) {
            mainwp_do_not_have_permissions("manage users");
            return;
        }
        $cachedSearch = MainWPCache::getCachedContext('Users');
        self::renderHeader('');
        ?>
         <div>
            <div class="postbox mainwp-postbox" style="width: 555px !important;">
            <h3 class="mainwp_box_title"><i class="fa fa-binoculars"></i> <?php 
        _e('Search Users', 'mainwp');
        ?>
</h3>
            <div class="inside">                  
            <div class="mainwp-search-box">
                <input type="text" aria-required="true" value="<?php 
        if ($cachedSearch != null && isset($cachedSearch['keyword'])) {
            echo $cachedSearch['keyword'];
        }
        ?>
"
                        id="mainwp_search_users" name="mainwp_search_users">
                <input type="button" value="<?php 
        _e('Search Users', 'mainwp');
        ?>
" class="button"
                        id="mainwp_btn_search_users" name="mainwp_btn_search_users">
                <span id="mainwp_users_searching">
                    <i class="fa fa-spinner fa-pulse"></i>
                </span>                 
            </div>
            <h3><?php 
        _e('Show Users', 'mainwp');
        ?>
</h3>
            <ul class="mainwp_checkboxes">
                <li>
                    <input type="checkbox" id="mainwp_user_role_administrator" <?php 
        echo $cachedSearch == null || $cachedSearch != null && in_array('administrator', $cachedSearch['status']) ? 'checked="checked"' : '';
        ?>
 class="mainwp-checkbox2"/>
                    <label for="mainwp_user_role_administrator" class="mainwp-label2"><?php 
        _e('Administrator', 'mainwp');
        ?>
</label>
                </li>
                <li>
                    <input type="checkbox" id="mainwp_user_role_editor" <?php 
        echo $cachedSearch != null && in_array('editor', $cachedSearch['status']) ? 'checked="checked"' : '';
        ?>
 class="mainwp-checkbox2"/>
                    <label for="mainwp_user_role_editor" class="mainwp-label2"><?php 
        _e('Editor', 'mainwp');
        ?>
</label>
                </li>
                <li>
                    <input type="checkbox" id="mainwp_user_role_author" <?php 
        echo $cachedSearch != null && in_array('author', $cachedSearch['status']) ? 'checked="checked"' : '';
        ?>
 class="mainwp-checkbox2"/>
                    <label for="mainwp_user_role_author" class="mainwp-label2"><?php 
        _e('Author', 'mainwp');
        ?>
</label>
                </li>
                <li>
                    <input type="checkbox" id="mainwp_user_role_contributor" <?php 
        echo $cachedSearch != null && in_array('contributor', $cachedSearch['status']) ? 'checked="checked"' : '';
        ?>
 class="mainwp-checkbox2"/>
                    <label for="mainwp_user_role_contributor" class="mainwp-label2"><?php 
        _e('Contributor', 'mainwp');
        ?>
</label>
                </li>
                <li>
                    <input type="checkbox" id="mainwp_user_role_subscriber" <?php 
        echo $cachedSearch != null && in_array('subscriber', $cachedSearch['status']) ? 'checked="checked"' : '';
        ?>
 class="mainwp-checkbox2"/>
                    <label for="mainwp_user_role_subscriber" class="mainwp-label2"><?php 
        _e('Subscriber', 'mainwp');
        ?>
</label>
                </li>
            </ul>
            </div>
            </div>
            <?php 
        MainWPUI::select_sites_box(__("Select Sites", 'mainwp'), 'checkbox', true, true, 'mainwp_select_sites_box_left');
        ?>
            <div class="postbox" style="float: left; width: 255px; margin-left: 2em;">
            <h3 class="box_title mainwp_box_title"><i class="fa fa-key"></i> <?php 
        _e('Update Password', 'mainwp');
        ?>
</h3>
            <div class="inside mainwp_inside" style="padding-bottom: .2em !important;">
            <div class="form-field">
               <label for="pass1"><?php 
        _e('Twice Required', 'mainwp');
        ?>
</label>
                <input name="user_login" type="hidden" id="user_login" value="admin">
               <div><input name="pass1" type="password" id="pass1" autocomplete="off"/></div>
               <div><input name="pass2" type="password" id="pass2" autocomplete="off"/></div>
            </div>
            <div id="pass-strength-result" style="display: block"><?php 
        _e('Strength Indicator', 'mainwp');
        ?>
</div>
            <br><br>
            <p class="description indicator-hint"><?php 
        _e('Hint: The password should be at least seven
                characters long. To make it stronger, use upper and lower case letters, numbers and
                symbols like ! " ? $ % ^ &amp; ).', 'mainwp');
        ?>
</p>
             <p style="text-align: center;"><input type="button" value="<?php 
        _e('Update Password', 'mainwp');
        ?>
" class="button-primary"
                    id="mainwp_btn_update_password" name="mainwp_btn_update_password">
                <span id="mainwp_users_password_updating"><i class="fa fa-spinner fa-pulse"></i></span>   
             </p> 
             <p><div id="mainwp_update_password_error" style="display: none"></div></p>
             </div>
        </div>
            <div style="clear: both;"></div>
            <input type="button" name="mainwp_show_users" id="mainwp_show_users" class="button-primary" value="<?php 
        _e('Show Users', 'mainwp');
        ?>
"/>
            <span id="mainwp_users_loading"><i class="fa fa-spinner fa-pulse"></i> <em><?php 
        _e('Grabbing information from Child Sites', 'mainwp');
        ?>
</em></span>
            <br/><br/>
        </div>
        <div class="clear"></div>

        <div id="mainwp_users_error"></div>
        <div id="mainwp_users_main" <?php 
        if ($cachedSearch != null) {
            echo 'style="display: block;"';
        }
        ?>
>
            <div class="alignleft">
                <select name="bulk_action" id="mainwp_bulk_action">
                    <option value="none"><?php 
        _e('Bulk Action', 'mainwp');
        ?>
</option>
                    <option value="delete"><?php 
        _e('Delete', 'mainwp');
        ?>
</option>
                </select> <input type="button" name="" id="mainwp_bulk_user_action_apply" class="button" value="<?php 
        _e('Apply', 'mainwp');
        ?>
"/>
                <select name="bulk_action" id="mainwp_bulk_role_action">
                    <option value="none"><?php 
        _e('Change Role to ...', 'mainwp');
        ?>
</option>
                    <option value="role_to_administrator"> <?php 
        _e('Administrator', 'mainwp');
        ?>
</option>
                    <option value="role_to_editor"> <?php 
        _e('Editor', 'mainwp');
        ?>
</option>
                    <option value="role_to_author"> <?php 
        _e('Author', 'mainwp');
        ?>
</option>
                    <option value="role_to_contributor"> <?php 
        _e('Contributor', 'mainwp');
        ?>
</option>
                    <option value="role_to_subscriber"> <?php 
        _e('Subscriber', 'mainwp');
        ?>
</option>
                </select> <input type="button" name="" id="mainwp_bulk_role_action_apply" class="button" value="<?php 
        _e('Change', 'mainwp');
        ?>
"/>
            </div>
            <div class="alignright" id="mainwp_users_total_results">
                <?php 
        _e('Total Results:', 'mainwp');
        ?>
 <span id="mainwp_users_total"><?php 
        echo $cachedSearch != null ? $cachedSearch['count'] : '0';
        ?>
</span>
            </div>
            <div class="clear"></div>
            <div id="mainwp_users_content">
                <table class="wp-list-table widefat fixed pages tablesorter" id="mainwp_users_table"
                       cellspacing="0">
                    <thead>
                    <tr>
                        <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input
                                type="checkbox"></th>
                        <th scope="col" id="username" class="manage-column column-username sortable desc" style="">
                            <a href="#" onclick="return false;"><span><?php 
        _e('Username', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
                        </th>
                        <th scope="col" id="name" class="manage-column column-author sortable desc" style="">
                            <a href="#" onclick="return false;"><span><?php 
        _e('Name', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
                        </th>
                        <th scope="col" id="email" class="manage-column column-email sortable desc" style="">
                            <a href="#" onclick="return false;"><span><?php 
        _e('E-mail', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
                        </th>
                        <th scope="col" id="role" class="manage-column column-role sortable desc" style="">
                            <a href="#" onclick="return false;"><span><?php 
        _e('Role', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
                        </th>
                        <th scope="col" id="posts" class="manage-column column-posts sortable desc" style="">
                            <a href="#" onclick="return false;"><span><?php 
        _e('Posts', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
                        </th>
                        <th scope="col" id="website" class="manage-column column-website sortable desc" style="">
                            <a href="#" onclick="return false;"><span><?php 
        _e('Website', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
                        </th>
                    </tr>
                    </thead>

                    <tfoot>
                    <tr>
                        <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input
                                type="checkbox"></th>
                        <th scope="col" id="username" class="manage-column column-username sortable desc" style="">
                            <a href="#" onclick="return false;"><span><?php 
        _e('Username', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
                        </th>
                        <th scope="col" id="name" class="manage-column column-author sortable desc" style="">
                            <a href="#" onclick="return false;"><span><?php 
        _e('Name', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
                        </th>
                        <th scope="col" id="email" class="manage-column column-email sortable desc" style="">
                            <a href="#" onclick="return false;"><span><?php 
        _e('E-mail', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
                        </th>
                        <th scope="col" id="role" class="manage-column column-role sortable desc" style="">
                            <a href="#" onclick="return false;"><span><?php 
        _e('Role', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
                        </th>
                        <th scope="col" id="posts" class="manage-column column-posts sortable desc" style="">
                            <a href="#" onclick="return false;"><span><?php 
        _e('Posts', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
                        </th>
                        <th scope="col" id="website" class="manage-column column-website sortable desc" style="">
                            <a href="#" onclick="return false;"><span><?php 
        _e('Website', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
                        </th>
                    </tr>
                    </tfoot>

                    <tbody id="the-list" class="list:user">
                        <?php 
        MainWPCache::echoBody('Users');
        ?>
                    </tbody>
                </table>
                <div class="pager" id="pager">
                    <form>
                        <img src="<?php 
        echo plugins_url('images/first.png', dirname(__FILE__));
        ?>
" class="first">
                        <img src="<?php 
        echo plugins_url('images/prev.png', dirname(__FILE__));
        ?>
" class="prev">
                        <input type="text" class="pagedisplay">
                        <img src="<?php 
        echo plugins_url('images/next.png', dirname(__FILE__));
        ?>
" class="next">
                        <img src="<?php 
        echo plugins_url('images/last.png', dirname(__FILE__));
        ?>
" class="last">
                        <span>&nbsp;&nbsp;<?php 
        _e('Show:', 'mainwp');
        ?>
 </span><select class="pagesize">
                            <option selected="selected" value="10">10</option>
                            <option value="25">25</option>
                            <option value="50">50</option>
                            <option value="100">100</option>
                            <option value="1000000000">All</option>
                        </select><span> <?php 
        _e('Users per page', 'mainwp');
        ?>
</span>
                    </form>
                </div>
                <div class="clear"></div>
            </div>
        </div>
    <?php 
        if ($cachedSearch != null) {
            echo '<script>mainwp_users_table_reinit();</script>';
        }
        self::renderFooter('');
    }
    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 render()
    {
        if (!mainwp_current_user_can("dashboard", "see_server_information")) {
            mainwp_do_not_have_permissions("server information");
            return;
        }
        self::renderHeader('');
        ?>
        <div class="updated below-h2">
            <p><?php 
        _e("Please include this information when requesting support:", "mainwp");
        ?>
</p><span class="mwp_close_srv_info"><a href="#" id="mwp_download_srv_info"><?php 
        _e("Download", "mainwp");
        ?>
</a> | <a href="#" id="mwp_close_srv_info"><i class="fa fa-eye-slash"></i> <?php 
        _e("Hide", "mainwp");
        ?>
</a></span>
            <p class="submit"><a class="button-primary mwp-get-system-report-btn" href="#"><?php 
        _e("Get System Report", "mainwp");
        ?>
</a></p>
            <div id="mwp-server-information"><textarea readonly="readonly"  wrap="off"></textarea></div>
        </div>
        <br />
        <div class="mwp_server_info_box">
                <table id="mainwp-table" class="wp-list-table widefat" cellspacing="0">
                    <thead>
                    <tr>
                        <th scope="col" class="manage-column column-posts mwp-not-generate-row" style="width: 1px;"><?php 
        _e('', 'mainwp');
        ?>
</th>
                        <th scope="col" class="manage-column sorted" style=""><span><?php 
        _e('Server Configuration', 'mainwp');
        ?>
</span></th>
                        <th scope="col" class="manage-column column-posts" style=""><?php 
        _e('Required Value', 'mainwp');
        ?>
</th>
                        <th scope="col" class="manage-column column-posts" style=""><?php 
        _e('Value', 'mainwp');
        ?>
</th>
                        <th scope="col" class="manage-column column-posts" style=""><?php 
        _e('Status', 'mainwp');
        ?>
</th>
                    </tr>
                    </thead>

                    <tbody id="the-sites-list" class="list:sites">
                        <tr><td style="background: #333; color: #fff;" colspan="5"><?php 
        _e('MAINWP DASHBOARD', 'mainwp');
        ?>
</td></tr>
                        <tr><td><?php 
        MainWPUtility::renderToolTip('MainWP requires the latest version to be installed for extension and child plugin compatibility issues.', 'mainwp');
        ?>
</td><td>MainWP Dashboard Version</td><td><?php 
        echo self::getMainWPVersion();
        ?>
</td><td><?php 
        echo self::getCurrentVersion();
        ?>
</td><td><?php 
        echo self::getMainWPVersionCheck();
        ?>
</td></tr>
                        <?php 
        self::checkDirectoryMainWPDirectory();
        ?>
                        <tr><td style="background: #333; color: #fff;" colspan="5"><?php 
        _e('WORDPRESS', 'mainwp');
        ?>
</td></tr><?php 
        self::renderRow('WordPress Version', '>=', '3.6', 'getWordpressVersion', '', '', null, 'MainWP requires the WordPress version 3.6 or higher. If the condition is not met, please update your Website. Click the help icon to read more.');
        self::renderRow('WordPress Memory Limit', '>=', '64M', 'getWordpressMemoryLimit', '', '', null, 'MainWP requires at least 64MB for proper functioning.');
        ?>
<tr><td style="background: #333; color: #fff;" colspan="5"><?php 
        _e('PHP SETTINGS', 'mainwp');
        ?>
</td></tr><?php 
        self::renderRow('PHP Version', '>=', '5.3', 'getPHPVersion', '', '', null, 'MainWP requires the PHP version 5.3 or higher. If the condition is not met, PHP version needs to be updated on your server. Before doing anything by yourself, we highly recommend contacting your hosting support department and asking them to do it for you. Click the help icon to read more.');
        self::renderRow('PHP Safe Mode Disabled', '=', true, 'getPHPSafeMode', '', '', null, 'MainWP Requires PHP Safe Mode to be disabled.');
        self::renderRow('PHP Max Execution Time', '>=', '30', 'getMaxExecutionTime', 'seconds', '=', '0', 'Changed by modifying the value max_execution_time in your php.ini file. Click the help icon to read more.');
        self::renderRow('PHP Memory Limit', '>=', '128M', 'getPHPMemoryLimit', '', '', null, 'MainWP requires at least 128MB for proper functioning (256M+ recommended for big backups)', 'filesize');
        self::renderRow('PHP Upload Max Filesize', '>=', '2M', 'getUploadMaxFilesize', '(2MB+ best for upload of big plugins)', '', null, 'Changed by modifying the value upload_max_filesize in your php.ini file. Click the help icon to read more.', 'filesize');
        self::renderRow('PHP Post Max Size', '>=', '2M', 'getPostMaxSize', '(2MB+ best for upload of big plugins)', '', null, 'Changed by modifying the value post_max_size in your php.ini file. Click the help icon to read more.', 'filesize');
        self::renderRow('SSL Extension Enabled', '=', true, 'getSSLSupport', '', '', null, 'Changed by uncommenting the ;extension=php_openssl.dll line in your php.ini file by removing the ";" character. Click the help icon to read more.');
        self::renderRow('SSL Warnings', '=', '', 'getSSLWarning', 'empty', '', null, 'If your SSL Warnings has any errors we suggest speaking with your web host so they can help troubleshoot the specific error you are getting. Click the help icon to read more.');
        self::renderRow('cURL Extension Enabled', '=', true, 'getCurlSupport', '', '', null, 'Changed by uncommenting the ;extension=php_curl.dll line in your php.ini file by removing the ";" character. Click the help icon to read more.');
        self::renderRow('cURL Timeout', '>=', '300', 'getCurlTimeout', 'seconds', '=', '0', 'Changed by modifying the value default_socket_timeout in your php.ini file. Click the help icon to read more.');
        if (function_exists('curl_version')) {
            self::renderRow('cURL Version', '>=', "7.18.1", 'getCurlVersion', '', '', null, 'MainWP Requires cURL 7.18.1 version or later.');
            self::renderRow('cURL SSL Version', '>=', array('version_number' => 0x9080cf, 'version' => 'OpenSSL/0.9.8l'), 'getCurlSSLVersion', '', '', null, 'MainWP Requires cURL SSL OpenSSL/0.9.8l version or later.', 'curlssl');
        }
        ?>
<tr><td style="background: #333; color: #fff;" colspan="5"><?php 
        _e('MySQL SETTINGS', 'mainwp');
        ?>
</td></tr><?php 
        self::renderRow('MySQL Version', '>=', '5.0', 'getMySQLVersion', '', '', null, 'MainWP requires the MySQL version 5.0 or higher. If the condition is not met, MySQL version needs to be updated on your server. Before doing anything by yourself, we highly recommend contacting your hosting support department and asking them to do it for you. Click the help icon to read more.');
        ?>
<tr><td style="background: #333; color: #fff;" colspan="5"><?php 
        _e('MISC', 'mainwp');
        ?>
</td></tr><?php 
        self::renderRow('PCRE Backtracking Limit', '>=', '10000', 'getOutputBufferSize', '', '', null, 'Changed by modifying the value pcre.backtrack_limit in your php.ini file. Click the help icon to read more.');
        ?>
<tr><td><?php 
        MainWPUtility::renderToolTip('MainWP requires the FS_METHOD to be set to direct', 'mainwp');
        ?>
</td><td><?php 
        _e('FileSystem Method', 'mainwp');
        ?>
</td><td><?php 
        echo '= ' . __('direct', 'mainwp');
        ?>
</td><td><?php 
        echo self::getFileSystemMethod();
        ?>
</td><td><?php 
        echo self::getFileSystemMethodCheck();
        ?>
</td></tr><?php 
        ?>
<tr><td style="background: #333; color: #fff;" colspan="5"><?php 
        _e('SERVER INFORMATION', 'mainwp');
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('WordPress Root Directory', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getWPRoot();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('Server Name', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getSeverName();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('Server Sofware', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getServerSoftware();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('Operating System', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getOS();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('Architecture', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getArchitecture();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('Server IP', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getServerIP();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('Server Protocol', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getServerProtocol();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('HTTP Host', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getHTTPHost();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('HTTPS', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getHTTPS();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('Server Admin', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getServerAdmin();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('Server Port', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getServerPort();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('Getaway Interface', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getServerGetawayInterface();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('Request Method', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getServerRequestMethod();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('Accept Content', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getServerHTTPAccept();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('Remote Host', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getRemoteHost();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('Remote Port', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getRemotePort();
        ?>
</td></tr>
                          <tr><td style="background: #333; color: #fff;" colspan="5"><?php 
        _e('PHP INFORMATION', 'mainwp');
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('PHP Allow URL fopen', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getPHPAllowUrlFopen();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('PHP Exif Support', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getPHPExif();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('PHP IPTC Support', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getPHPIPTC();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('PHP XML Support', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getPHPXML();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('PHP Disabled Functions', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::mainwpRequiredFunctions();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('PHP Loaded Extensions', 'mainwp');
        ?>
</td><td colspan="3" style="width: 73% !important;"><?php 
        self::getLoadedPHPExtensions();
        ?>
</td></tr>
                          <tr><td style="background: #333; color: #fff;" colspan="5"><?php 
        _e('MySQL INFORMATION', 'mainwp');
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('MySQL Mode', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        self::getSQLMode();
        ?>
</td></tr>
                          <tr><td></td><td><?php 
        _e('MySQL Client Encoding', 'mainwp');
        ?>
</td><td colspan="3"><?php 
        echo defined('DB_CHARSET') ? DB_CHARSET : '';
        ?>
</td></tr>
                    </tbody>
                </table>
                </div>
                <br />
            </div>
    <?php 
        self::renderFooter('');
    }
Exemplo n.º 7
0
    public static function renderMainWPTools()
    {
        if (!mainwp_current_user_can('dashboard', 'manage_dashboard_settings')) {
            mainwp_do_not_have_permissions(__('manage dashboard settings', 'mainwp'));
            return;
        }
        $wp_menu_items = array('dashboard' => __('Dashboard', 'mainwp'), 'posts' => __('Posts', 'mainwp'), 'media' => __('Media', 'mainwp'), 'pages' => __('Pages', 'mainwp'), 'appearance' => __('Appearance', 'mainwp'), 'comments' => __('Comments', 'mainwp'), 'users' => __('Users', 'mainwp'), 'tools' => __('Tools', 'mainwp'));
        $hide_menus = get_option('mwp_setup_hide_wp_menus');
        if (!is_array($hide_menus)) {
            $hide_menus = array();
        }
        self::renderHeader('MainWPTools');
        ?>
		<form method="POST" action="">
			<div class="postbox" id="mainwp-tools">
				<h3 class="mainwp_box_title">
					<span><i class="fa fa-wrench"></i> <?php 
        _e('MainWP Tools', 'mainwp');
        ?>
</span></h3>

				<div class="inside">
					<table class="form-table">
						<tbody>
						<tr>
							<th scope="row"><?php 
        _e('Force Dashboard to Establish New Connection', 'mainwp');
        ?>
&nbsp;<?php 
        MainWP_Utility::renderToolTip(__('Use this option to establish new connection with child sites.', 'mainwp'));
        ?>
</th>
							<td>
								<input type="submit" name="" id="force-destroy-sessions-button" class="button-primary button" value="<?php 
        esc_attr_e('Establish New Connection', 'mainwp');
        ?>
"/><br/>
								<em>
									<?php 
        _e('Forces your Dashboard to reconnect with your Child sites. This feature will log out any currently logged in users on the Child sites and require them to re-log in. Only needed if suggested by MainWP Support.', 'mainwp');
        ?>
								</em>
							</td>
						</tr>
						<tr>
							<th scope="row"><?php 
        _e('Scan child sites for known issues', 'mainwp');
        ?>
&nbsp;<?php 
        MainWP_Utility::renderToolTip(__('Use this option to scan child sites for known issues.', 'mainwp'));
        ?>
</th>
							<td>
								<a href="<?php 
        echo admin_url('admin.php?page=MainWP_Child_Scan');
        ?>
" class="button-primary button"><?php 
        _e('Scan', 'mainwp');
        ?>
</a><br/>
								<em>
									<?php 
        _e('Scans each site individually for known issues.', 'mainwp');
        ?>
								</em>
							</td>
						</tr>
						<tr>
							<th scope="row"><?php 
        _e('MainWP Quick Setup', 'mainwp');
        ?>
</th>
							<td>
								<a href="admin.php?page=mainwp-setup" class="button-primary button"/><?php 
        _e('Start Quick Setup', 'mainwp');
        ?>
</a><br/>
								<em>
									<?php 
        _e('MainWP Quick Setup allows you to quickly set your MainWP Dashboard preferences.', 'mainwp');
        ?>
								</em>
							</td>
						</tr>
						</tbody>
					</table>
					<div class="mainwp_info-box"><?php 
        _e('Changing this settings will overwrite Clean & Lock Extension settings. Do not forget to migrate the settings you wish to keep.', 'mainwp');
        ?>
</div>
					<table class="form-table">
						<tbody>
						<tr>
							<th scope="row"><?php 
        _e('Hide WP Menus', 'mainwp');
        ?>
</th>
							<td>
								<ul class="mainwp_checkboxes mainwp_hide_wpmenu_checkboxes">
									<?php 
        foreach ($wp_menu_items as $name => $item) {
            $_selected = '';
            if (in_array($name, $hide_menus)) {
                $_selected = 'checked';
            }
            ?>
										<li>
											<input type="checkbox" id="mainwp_hide_wpmenu_<?php 
            echo $name;
            ?>
" name="mainwp_hide_wpmenu[]" <?php 
            echo $_selected;
            ?>
 value="<?php 
            echo $name;
            ?>
" class="mainwp-checkbox2">
											<label for="mainwp_hide_wpmenu_<?php 
            echo $name;
            ?>
" class="mainwp-label2"><?php 
            echo $item;
            ?>
</label>
										</li>
									<?php 
        }
        ?>
								</ul>
							</td>
						</tr>
						</tbody>
					</table>
				</div>
			</div>
			<p class="submit"><input type="submit" name="submit" id="submit" class="button-primary button button-hero" value="<?php 
        esc_attr_e('Save Settings', 'mainwp');
        ?>
"/></p>
		</form>
		<?php 
        self::renderFooter('MainWPTools');
    }
Exemplo n.º 8
0
    public static function render()
    {
        if (!mainwp_current_user_can('dashboard', 'manage_offline_checks')) {
            mainwp_do_not_have_permissions(__('manage offline checks', 'mainwp'));
            return;
        }
        $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
        $statusses = array('hourly', '2xday', 'daily', 'weekly');
        do_action('mainwp-pageheader-settings', 'OfflineChecks');
        ?>
        <div class="mainwp_info-box-red">
        <strong>IMPORTANT:</strong> This feature is being retired and replaced by the Free MainWP Advanced Uptime Monitor Extension which provides more advanced monitoring system.<br/>
        <a href="https://mainwp.com/extension/advanced-uptime-monitor/">Get the Free MainWP Advanced Uptime Monitor Extension here!</a>
        </div>
		<div class="mainwp_info-box">
			<strong><?php 
        _e('Notifications will be sent to', 'mainwp');
        ?>
				<i><?php 
        echo MainWP_Utility::getNotificationEmail();
        ?>
</i> (<a href="<?php 
        echo admin_url();
        ?>
admin.php?page=Settings"><?php 
        _e('change', 'mainwp');
        ?>
</a>)</strong>
			<br/><br/><?php 
        _e('MainWP performs two tests when checking your site for up-time.', 'mainwp');
        ?>
			<br/>
			<?php 
        _e('The first test we do is to check that the domain is valid.', 'mainwp');
        ?>
			<br/>
			<?php 
        _e('If this test passes we use a browser emulator to visit the website, this sends out a user agent (just like your web browser from your computer) and waits for a status message.', 'mainwp');
        ?>
			<br/>
			<?php 
        _e('We report any http status code from 200-399 as a success. Any other http status code returned is considered "offline" which is treated as a failure.', 'mainwp');
        ?>
		</div>
		<table class="wp-list-table widefat fixed" id="mainwp_offlinechecks">
			<thead>
			<tr>
				<th scope="col" class="manage-column" style="text-align: left"><?php 
        _e('Site', 'mainwp');
        ?>
</th>
				<th scope="col" id="col_status" class="manage-column"><?php 
        _e('Status', 'mainwp');
        ?>
</th>
				<th scope="col" id="col_disabled" class="manage-column">
					<a href="#" class="mainwp_offline_check_bulk" value="disabled"><?php 
        _e('Disabled', 'mainwp');
        ?>
</a>
				</th>
				<th scope="col" id="col_hourly" class="manage-column">
					<a href="#" class="mainwp_offline_check_bulk" value="hourly"><?php 
        _e('Hourly', 'mainwp');
        ?>
</a>
				</th>
				<th scope="col" id="col_2timesday" class="manage-column">
					<a href="#" class="mainwp_offline_check_bulk" value="2xday"><?php 
        _e('2x Day', 'mainwp');
        ?>
</a>
				</th>
				<th scope="col" id="col_daily" class="manage-column">
					<a href="#" class="mainwp_offline_check_bulk" value="daily"><?php 
        _e('Daily', 'mainwp');
        ?>
</a>
				</th>
				<th scope="col" id="col_weekly" class="manage-column">
					<a href="#" class="mainwp_offline_check_bulk" value="weekly"><?php 
        _e('Weekly', 'mainwp');
        ?>
</a>
				</th>
				<th scope="col" id="col_test" class="manage-column">
					<a href="#" class="button button-primary" id="mainwp_offline_check_check_all"><?php 
        _e('Check All', 'mainwp');
        ?>
</a>
				</th>
			</tr>
			</thead>
			<tbody id="the-list">
			<?php 
        while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
            ?>
				<tr>
					<input type="hidden" name="offline_check_website_id" id="offline_check_website_id"
						value="<?php 
            echo $website->id;
            ?>
"/>
					<td class="url">
						<a href="admin.php?page=managesites&dashboard=<?php 
            echo $website->id;
            ?>
"><?php 
            echo stripslashes($website->name);
            ?>
</a>
						<span class="offline_check_saved"><?php 
            _e('Saved', 'mainwp');
            ?>
</span></td>
					<td>
                        <i class="fa fa-exclamation-circle fa-2x mwp-red" title="Site Offline" <?php 
            echo $website->offline_check_result == -1 ? '' : 'style="display:none;"';
            ?>
></i>
                        <i class="fa fa-check-circle fa-2x mwp-l-green" title="Site Online" <?php 
            echo $website->offline_check_result == 1 ? '' : 'style="display:none;"';
            ?>
></i>
                   </td>
					<td class="column-rating">
						<input type="radio" id="disabled" class="mainwp_offline_check" value="disabled"
							name="offline_check_<?php 
            echo $website->id;
            ?>
"
							<?php 
            echo !in_array($website->offline_checks, $statusses) ? 'checked="true"' : '';
            ?>
 />
					</td>
					<td><input type="radio" id="hourly" class="mainwp_offline_check" value="hourly"
							name="offline_check_<?php 
            echo $website->id;
            ?>
"
							<?php 
            echo $website->offline_checks == 'hourly' ? 'checked="true"' : '';
            ?>
 /></td>
					<td><input type="radio" id="2xday" class="mainwp_offline_check" value="2xday"
							name="offline_check_<?php 
            echo $website->id;
            ?>
"
							<?php 
            echo $website->offline_checks == '2xday' ? 'checked="true"' : '';
            ?>
 /></td>
					<td><input type="radio" id="daily" class="mainwp_offline_check" value="daily"
							name="offline_check_<?php 
            echo $website->id;
            ?>
"
							<?php 
            echo $website->offline_checks == 'daily' ? 'checked="true"' : '';
            ?>
 /></td>
					<td><input type="radio" id="weekly" class="mainwp_offline_check" value="weekly"
							name="offline_check_<?php 
            echo $website->id;
            ?>
"
							<?php 
            echo $website->offline_checks == 'weekly' ? 'checked="true"' : '';
            ?>
 /></td>
					<td><a href="#" class="mainwp_offline_check_check"><?php 
            _e('Check', 'mainwp');
            ?>
</a></td>
				</tr>
				<?php 
        }
        ?>
			</tbody>
		</table>
		<?php 
        do_action('mainwp-pagefooter-settings', 'OfflineChecks');
    }
Exemplo n.º 9
0
    public static function renderAllGroups()
    {
        if (!mainwp_current_user_can("dashboard", "manage_groups")) {
            mainwp_do_not_have_permissions("manage groups");
            return;
        }
        ?>
        <div class="wrap">
            <?php 
        do_action("mainwp-pageheader-sites", "ManageGroups");
        ?>
                <div class="mainwp_managegroups-outsidebox">
                    <span id="mainwp_managegroups-addnew-container"><input type="button" name="Add new" value="<?php 
        _e('Add New', 'mainwp');
        ?>
" class="managegroups-addnew button" /></span>
                    <h3><?php 
        _e('Groups', 'mainwp');
        ?>
</h3>
                    <div class="mainwp_managegroups-insidebox">
                        <input id="managegroups-filter" style="margin-top: .5em;" type="text" value="" placeholder="Type here to filter groups" />
                        <hr>
                        <ul id="managegroups-list">
                            <li class="managegroups-listitem managegroups-group-add hidden">
                                <span class="mainwp_group-actions actions-input"><a href="#" class="managegroups-savenew"><?php 
        _e('Save', 'mainwp');
        ?>
</a> | <a href="#" class="managegroups-cancel"><?php 
        _e('Cancel', 'mainwp');
        ?>
</a></span>
                                <input type="text" name="name" value="" />
                            </li>
                            <?php 
        echo MainWPManageGroups::getGroupListContent();
        ?>
                        </ul>
                    </div>
                </div>

                <div class="mainwp_managegroups-outsidebox">
                    <div style="float: right; margin-top: 12px;"><?php 
        _e('Display by:', 'mainwp');
        ?>
 <a href="#" class="mainwp_action left mainwp_action_down" id="group_sites_by_name"><strong><?php 
        _e('Site Name', 'mainwp');
        ?>
</strong></a><a href="#" class="mainwp_action right" id="group_sites_by_url"><?php 
        _e('URL', 'mainwp');
        ?>
</a></div>
                    <h3><?php 
        _e('Websites', 'mainwp');
        ?>
</h3>
                    <div class="mainwp_managegroups-insidebox" id="managegroups-sites-list">
                        <input id="managegroups_site-filter" style="margin-top: .5em;" type="text" value="" placeholder="Type here to filter sites" />
                        <div style="float:right; margin-top: .7em"><?php 
        _e('Select: ', 'mainwp');
        ?>
<a href="#" onClick="return mainwp_managegroups_ss_select(this, true)"><?php 
        _e('All', 'mainwp');
        ?>
</a> | <a href="#" onClick="return mainwp_managegroups_ss_select(this, false)"><?php 
        _e('None', 'mainwp');
        ?>
</a></div>
                        <hr>
                        <ul id="managegroups-listsites">
                            <?php 
        echo MainWPManageGroups::getWebsiteListContent();
        ?>
                        </ul>
                    </div>
                </div>
                <div style="clear: both;"></div>
                <br />
                <input type="button" name="Save selection" value="<?php 
        _e('Save Selection', 'mainwp');
        ?>
" class="managegroups-saveAll button-primary" /> <span id="managegroups-saved"><?php 
        _e('Saved', 'mainwp');
        ?>
</span>
        </div>
        <?php 
        do_action("mainwp-pagefooter-sites", "ManageGroups");
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function () {
                jQuery('#group_sites_by_name').live('click', function(event)
                {
                    jQuery(this).addClass('mainwp_action_down');
                    jQuery('#group_sites_by_url').removeClass('mainwp_action_down');
                    jQuery('#managegroups-sites-list').find('.website_url').hide();
                    jQuery('#managegroups-sites-list').find('.website_name').show();
                    return false;
                });
                jQuery('#group_sites_by_url').live('click', function(event)
                {
                    jQuery(this).addClass('mainwp_action_down');
                    jQuery('#group_sites_by_name').removeClass('mainwp_action_down');
                    jQuery('#managegroups-sites-list').find('.website_name').hide();
                    jQuery('#managegroups-sites-list').find('.website_url').show();
                    return false;
                });

                jQuery('.managegroups-listitem').live({
                    mouseenter:
                        function() {
                            if (jQuery(this).find('.text').is(":visible")) jQuery(this).find('.actions-text').show();
                            else jQuery(this).find('.actions-input').show();
                        },
                    mouseleave:
                        function() {
                            jQuery(this).find('.actions-text').hide();
                            jQuery(this).find('.actions-input').hide();
                        }
                });

                jQuery('.managegroups-rename').live('click', function()
                {
                    var parentObj = jQuery(this).parents('.managegroups-listitem');
                    parentObj.find('.text').hide();
                    parentObj.find('.actions-text').hide();
                    parentObj.find('.input').show();
                    parentObj.find('.actions-input').show();
                    return false;
                });

                jQuery('.managegroups-save').live('click', function()
                {
                    var parentObj = jQuery(this).parents('.managegroups-listitem');
                    var groupId = parentObj.attr('id');
                    var newName = parentObj.find('.input input').val();

                    var data = mainwp_secure_data({
                        action:'mainwp_group_rename',
                        groupId:groupId,
                        newName: newName
                    });

                    jQuery.post(ajaxurl, data, function(pParentObj) { return function (response) {
                        if (response.error) return;

                        response = jQuery.trim(response.result);
                        pParentObj.find('.input input').val(response);
                        pParentObj.find('.text').html(response);

                        pParentObj.find('.input').hide();
                        pParentObj.find('.actions-input').hide();
                        pParentObj.find('.text').show();
                        pParentObj.find('.actions-text').show();
                    } }(parentObj), 'json');

                    return false;
                });

                jQuery('.managegroups-delete').live('click', function()
                {
                    var confirmed = confirm('This will permanently delete this group. Proceed?');
                    if (confirmed)
                    {
                        var parentObj = jQuery(this).parents('.managegroups-listitem');
                        parentObj.css('background-color', '#F8E0E0');
                        var groupId = parentObj.attr('id');

                        var data = {
                            action:'mainwp_group_delete',
                            groupId:groupId
                        };

                        jQuery.post(ajaxurl, data, function(pParentObj) { return function (response) {
                            response = jQuery.trim(response);
                            if (response == 'OK') pParentObj.animate({opacity: 0}, 300, function() {pParentObj.remove()});
                        } }(parentObj));
                    }
                    return false;
                });

                jQuery('.managegroups-addnew').live('click', function()
                {
                    var addNewContainer = jQuery('.managegroups-group-add');
                    addNewContainer.find('input').val('');
                    addNewContainer.show();
                });

                jQuery('.managegroups-cancel').live('click', function()
                {
                    var addNewContainer = jQuery('.managegroups-group-add');
                    addNewContainer.hide();
                    addNewContainer.find('input').val('');
                });

                jQuery('.managegroups-savenew').live('click', function()
                {
                    var parentObj = jQuery(this).parents('.managegroups-listitem');
                    var newName = parentObj.find('input').val();

                    var data = mainwp_secure_data({
                        action:'mainwp_group_add',
                        newName: newName
                    });

                    jQuery.post(ajaxurl, data, function (response) {
                        try
                        {
                            resp = jQuery.parseJSON(response);

                            if (resp.error != undefined) return;
                        }
                        catch (err)
                        {

                        }

                        response = jQuery.trim(response);

                        var addNewContainer = jQuery('.managegroups-group-add');
                        addNewContainer.hide();
                        addNewContainer.find('input').val('');

                        addNewContainer.after(response);
                    });

                    return false;
                });

                jQuery('.managegroups-radio').live('click', function()
                {
                    var parentObj = jQuery(this).parents('.managegroups-listitem');
                    var groupId = parentObj.attr('id');

                    var data = {
                        action:'mainwp_group_getsites',
                        groupId: groupId
                    }

                    jQuery.post(ajaxurl, data, function (response) {
                        response = jQuery.trim(response);
                        if (response == 'ERROR') return;

                        jQuery('input[name="sites"]').attr('checked', false);

                        var websiteIds = jQuery.parseJSON(response);
                        for (var i = 0; i < websiteIds.length; i++)
                        {
                            jQuery('input[name="sites"][value="'+websiteIds[i]+'"]').attr('checked', true);
                        }
                    });
                });

                jQuery('.managegroups-saveAll').live('click', function()
                {
                    var checkedGroup = jQuery('input[name="groups"]:checked');
                    var groupId = checkedGroup.val();
                    if (groupId == undefined) return;

                    var allCheckedWebsites = jQuery('input[name="sites"]:checked');
                    var allCheckedIds = [];
                    for (var i = 0; i < allCheckedWebsites.length; i++)
                    {
                        allCheckedIds.push(jQuery(allCheckedWebsites[i]).val());
                    }

                    var data = mainwp_secure_data({
                        action:'mainwp_group_updategroup',
                        groupId: groupId,
                        websiteIds: allCheckedIds
                    });

                    jQuery.post(ajaxurl, data, function (response) {
                        jQuery('#managegroups-saved').stop(true, true);
                        jQuery('#managegroups-saved').show();
                        jQuery('#managegroups-saved').fadeOut(2000);
                        return;
                    }, 'json');
                });
            });
        </script>
        <?php 
    }
Exemplo n.º 10
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);
    }
Exemplo n.º 11
0
    public static function render($title, $type = "plugin")
    {
        if ($type == "plugin" && !mainwp_current_user_can("dashboard", "install_plugins") || $type == "theme" && !mainwp_current_user_can("dashboard", "install_themes")) {
            mainwp_do_not_have_permissions("install plugins");
            return;
        }
        $tab = 'search';
        if (isset($_REQUEST['tab'])) {
            $tab = $_REQUEST['tab'];
        }
        ?>
            <?php 
        if ($tab == 'install') {
        } else {
            ?>
                <a href="#" class="mainwp_action left <?php 
            if ($tab == 'search') {
                echo 'mainwp_action_down';
            }
            ?>
" id="MainWPInstallBulkNavSearch"><?php 
            _e('Search', 'mainwp');
            ?>
</a><a href="#" class="mainwp_action right <?php 
            if ($tab == 'upload') {
                echo 'mainwp_action_down';
            }
            ?>
" id="MainWPInstallBulkNavUpload"><?php 
            _e('Upload', 'mainwp');
            ?>
</a>


                <br class="clear" /><br />
                <form method="POST" action="">
                    <div class="mainwp_config_box_right stick-to-window">
<!--                    <div>-->
                        <?php 
            MainWPUI::select_sites_box();
            ?>
                  	</div>
                        <div class="mainwp_config_box_left">
               	 	<div class="error below-h2" style="display: none;" id="ajax-error-zone"></div>
                    <div id="MainWPInstallBulkAjax">
                        <?php 
            switch ($tab) {
                case 'search':
                    MainWPInstallBulk::renderSearch($title);
                    break;
                case 'upload':
                    MainWPInstallBulk::renderUpload($title);
                    break;
                default:
                    MainWPInstallBulk::renderSearch($title);
            }
            ?>
                    </div>
                   	</div>
                </form>
                <?php 
        }
        ?>
            <div id="MainWPInstallBulkNew" style="display: none">
                <br />
                <a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=<?php 
        echo $title;
        ?>
Install" class="add-new-h2" target="_top"><?php 
        _e('Add New', 'mainwp');
        ?>
</a>
                <a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=mainwp_tab" class="add-new-h2" target="_top"><?php 
        _e('Return to Dashboard', 'mainwp');
        ?>
</a>
            </div>
        <?php 
    }
Exemplo n.º 12
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');
        ?>
        <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;
        }
    }
Exemplo n.º 13
0
    public static function renderMetabox()
    {
        $website = MainWPUtility::get_current_wpid();
        if (!$website) {
            return;
        }
        $website = MainWPDB::Instance()->getWebsiteById($website);
        MainWPManageSites::showBackups($website);
        ?>
        <?php 
        if (mainwp_current_user_can("dashboard", "execute_backups")) {
            ?>
        <hr />
        <div style="text-align: center;"><a href="<?php 
            echo admin_url('admin.php?page=managesites&backupid=' . $website->id);
            ?>
" class="button-primary"><?php 
            _e('Backup Now', 'mainwp');
            ?>
</a></div>
        <?php 
        }
        ?>
        <?php 
    }
Exemplo n.º 14
0
 public static function renderAllSites()
 {
     global $current_user;
     if (isset($_REQUEST['do'])) {
         if ($_REQUEST['do'] == 'new') {
             self::renderNewSite();
         } else {
             if ($_REQUEST['do'] == 'test') {
                 self::renderTest();
             }
         }
         return;
     }
     $website = null;
     if (isset($_GET['backupid']) && MainWPUtility::ctype_digit($_GET['backupid'])) {
         $websiteid = $_GET['backupid'];
         $backupwebsite = MainWPDB::Instance()->getWebsiteById($websiteid);
         if (MainWPUtility::can_edit_website($backupwebsite)) {
             MainWPManageSites::renderBackupSite($backupwebsite);
             return;
         }
     }
     if (isset($_GET['scanid']) && MainWPUtility::ctype_digit($_GET['scanid'])) {
         $websiteid = $_GET['scanid'];
         $scanwebsite = MainWPDB::Instance()->getWebsiteById($websiteid);
         if (MainWPUtility::can_edit_website($scanwebsite)) {
             MainWPManageSites::renderScanSite($scanwebsite);
             return;
         }
     }
     if (isset($_GET['seowebsiteid']) && MainWPUtility::ctype_digit($_GET['seowebsiteid'])) {
         $websiteid = $_GET['seowebsiteid'];
         $seoWebsite = MainWPDB::Instance()->getWebsiteById($websiteid);
         if (MainWPUtility::can_edit_website($seoWebsite)) {
             MainWPManageSites::renderSeoPage($seoWebsite);
             return;
         }
     }
     if (isset($_GET['dashboard']) && MainWPUtility::ctype_digit($_GET['dashboard'])) {
         $websiteid = $_GET['dashboard'];
         $dashboardWebsite = MainWPDB::Instance()->getWebsiteById($websiteid);
         if (MainWPUtility::can_edit_website($dashboardWebsite)) {
             MainWPManageSites::renderDashboard($dashboardWebsite);
             return;
         }
     }
     if (isset($_GET['id']) && MainWPUtility::ctype_digit($_GET['id'])) {
         $websiteid = $_GET['id'];
         $website = MainWPDB::Instance()->getWebsiteById($websiteid);
         if (!MainWPUtility::can_edit_website($website)) {
             $website = null;
         }
     }
     if ($website == null) {
         self::_renderAllSites();
     } else {
         $updated = false;
         //Edit website!
         if (isset($_POST['submit']) && isset($_POST['mainwp_managesites_edit_siteadmin']) && $_POST['mainwp_managesites_edit_siteadmin'] != '') {
             //update site
             $groupids = array();
             $groupnames = array();
             if (isset($_POST['selected_groups'])) {
                 foreach ($_POST['selected_groups'] as $group) {
                     $groupids[] = $group;
                 }
             }
             if (isset($_POST['mainwp_managesites_edit_addgroups']) && $_POST['mainwp_managesites_edit_addgroups'] != '') {
                 $tmpArr = explode(',', $_POST['mainwp_managesites_edit_addgroups']);
                 foreach ($tmpArr as $tmp) {
                     $group = MainWPDB::Instance()->getGroupByNameForUser(trim($tmp));
                     if ($group) {
                         if (!in_array($group->id, $groupids)) {
                             $groupids[] = $group->id;
                         }
                     } else {
                         $groupnames[] = trim($tmp);
                     }
                 }
             }
             $newPluginDir = isset($_POST['mainwp_options_footprint_plugin_folder']) ? $_POST['mainwp_options_footprint_plugin_folder'] : '';
             $maximumFileDescriptorsOverride = isset($_POST['mainwp_options_maximumFileDescriptorsOverride']);
             $maximumFileDescriptorsAuto = isset($_POST['mainwp_maximumFileDescriptorsAuto']);
             $maximumFileDescriptors = isset($_POST['mainwp_options_maximumFileDescriptors']) && MainWPUtility::ctype_digit($_POST['mainwp_options_maximumFileDescriptors']) ? $_POST['mainwp_options_maximumFileDescriptors'] : 150;
             $archiveFormat = isset($_POST['mainwp_archiveFormat']) ? $_POST['mainwp_archiveFormat'] : 'global';
             $http_user = $_POST['mainwp_managesites_edit_http_user'];
             $http_pass = $_POST['mainwp_managesites_edit_http_pass'];
             MainWPDB::Instance()->updateWebsite($website->id, $current_user->ID, $_POST['mainwp_managesites_edit_sitename'], $_POST['mainwp_managesites_edit_siteadmin'], $groupids, $groupnames, $_POST['offline_checks'], $newPluginDir, $maximumFileDescriptorsOverride, $maximumFileDescriptorsAuto, $maximumFileDescriptors, $_POST['mainwp_managesites_edit_verifycertificate'], $archiveFormat, isset($_POST['mainwp_managesites_edit_uniqueId']) ? $_POST['mainwp_managesites_edit_uniqueId'] : '', $http_user, $http_pass);
             do_action('mainwp_update_site', $website->id);
             $backup_before_upgrade = isset($_POST['mainwp_backup_before_upgrade']) ? intval($_POST['mainwp_backup_before_upgrade']) : 2;
             if ($backup_before_upgrade > 2) {
                 $backup_before_upgrade = 2;
             }
             $newValues = array('automatic_update' => !isset($_POST['mainwp_automaticDailyUpdate']) ? 0 : 1, 'backup_before_upgrade' => $backup_before_upgrade, 'loadFilesBeforeZip' => $_POST['mainwp_options_loadFilesBeforeZip']);
             if (mainwp_current_user_can("dashboard", "ignore_unignore_updates")) {
                 $newValues['is_ignoreCoreUpdates'] = isset($_POST['mainwp_is_ignoreCoreUpdates']) && $_POST['mainwp_is_ignoreCoreUpdates'] ? 1 : 0;
                 $newValues['is_ignorePluginUpdates'] = isset($_POST['mainwp_is_ignorePluginUpdates']) && $_POST['mainwp_is_ignorePluginUpdates'] ? 1 : 0;
                 $newValues['is_ignoreThemeUpdates'] = isset($_POST['mainwp_is_ignoreThemeUpdates']) && $_POST['mainwp_is_ignoreThemeUpdates'] ? 1 : 0;
             }
             MainWPDB::Instance()->updateWebsiteValues($website->id, $newValues);
             $updated = true;
             //Reload the site
             $website = MainWPDB::Instance()->getWebsiteById($website->id);
         }
         $groups = MainWPDB::Instance()->getGroupsForCurrentUser();
         $statusses = array('hourly', '2xday', 'daily', 'weekly');
         $pluginDir = $website->pluginDir;
         self::renderHeader('ManageSitesEdit');
         MainWPManageSitesView::renderAllSites($website, $updated, $groups, $statusses, $pluginDir);
         self::renderFooter('ManageSitesEdit');
     }
 }
Exemplo n.º 15
0
    public static function renderAllGroups()
    {
        if (!mainwp_current_user_can('dashboard', 'manage_groups')) {
            mainwp_do_not_have_permissions(__('manage groups', 'mainwp'));
            return;
        }
        ?>
		<div class="wrap">
			<?php 
        do_action('mainwp-pageheader-sites', 'ManageGroups');
        ?>
			<div class="mainwp_info-box-blue">
				<span><?php 
        _e('In case you are managing large number of WordPress sites, it would be very useful for you to split them in different groups. Later, you will be able to make site selection by group which will speed up your work and make it much easier.', 'mainwp');
        ?>
</span>
			</div>
			<div class="mainwp_managegroups-outsidebox">
				<div class="mainwp_managegroups-insidebox">
					<h2 style="border-bottom: 1px Solid #e5e5e5;"><?php 
        _e('Groups', 'mainwp');
        ?>
</h2>
					<input id="managegroups-filter" style="margin: 1em 0; width: 40%;" type="text" value="" placeholder="<?php 
        esc_attr_e('Type here to filter groups', 'mainwp');
        ?>
" />
					<span id="mainwp_managegroups-addnew-container"><a class="managegroups-addnew" href="javascript:void(0)"><i class="fa fa-plus"></i> <?php 
        _e('Create New Group', 'mainwp');
        ?>
</a></span>
					<hr>
					<ul id="managegroups-list">
						<li class="managegroups-listitem managegroups-group-add hidden">
							<span class="mainwp_group-actions actions-input"><a href="#" class="managegroups-savenew"><i class="fa fa-floppy-o"></i> <?php 
        _e('Save', 'mainwp');
        ?>
</a> | <a href="#" class="managegroups-cancel"><i class="fa fa-times-circle"></i> <?php 
        _e('Cancel', 'mainwp');
        ?>
</a></span>
							<input type="text" style="width: 50%;" placeholder="<?php 
        esc_attr_e('Enter Group Name', 'mainwp');
        ?>
" name="name" value="" />
						</li>
						<?php 
        echo MainWP_Manage_Groups::getGroupListContent();
        ?>
					</ul>
				</div>
			</div>

			<div class="mainwp_managegroups-outsidebox">
				<div class="mainwp_managegroups-insidebox" id="managegroups-sites-list">
					<h2 style="border-bottom: 1px Solid #e5e5e5;"><?php 
        _e('Child Sites', 'mainwp');
        ?>
</h2>
					<input id="managegroups_site-filter" style="margin: 1em 0; width: 40%;" type="text" value="" placeholder="<?php 
        esc_attr_e('Type here to filter sites', 'mainwp');
        ?>
" />
					<div style="float: right; margin-top: 20px; margin-left: 1em;"><?php 
        _e('Select: ', 'mainwp');
        ?>
<a href="#" onClick="return mainwp_managegroups_ss_select(this, true)"><?php 
        _e('All', 'mainwp');
        ?>
</a> | <a href="#" onClick="return mainwp_managegroups_ss_select(this, false)"><?php 
        _e('None', 'mainwp');
        ?>
</a></div>
					<div style="float: right; margin-top: 20px;"><?php 
        _e('Display by:', 'mainwp');
        ?>
 <a href="#" id="group_sites_by_name"><?php 
        _e('Site Name', 'mainwp');
        ?>
</a> | <a href="#" id="group_sites_by_url"><?php 
        _e('URL', 'mainwp');
        ?>
</a></div>
					<div style="clear: both;"></div>
					<hr>
					<ul id="managegroups-listsites">
						<?php 
        echo MainWP_Manage_Groups::getWebsiteListContent();
        ?>
					</ul>
				</div>
			</div>
			<div style="clear: both;"></div>
			<br/>
			<input type="button" name="Save selection" value="<?php 
        _e('Save Selection', 'mainwp');
        ?>
" class="managegroups-saveAll button-primary button button-hero"/>
			<span id="managegroups-saved"><?php 
        _e('Saved', 'mainwp');
        ?>
</span>
		</div>
		<?php 
        do_action('mainwp-pagefooter-sites', 'ManageGroups');
        ?>
		<script type="text/javascript">
			jQuery( document ).ready( function () {
				jQuery( '#group_sites_by_name' ).live( 'click', function ( event ) {
					//jQuery( this ).addClass( 'mainwp_action_down' );
					//jQuery( '#group_sites_by_url' ).removeClass( 'mainwp_action_down' );
					jQuery( '#managegroups-sites-list' ).find( '.website_url' ).hide();
					jQuery( '#managegroups-sites-list' ).find( '.website_name' ).show();
					return false;
				} );
				jQuery( '#group_sites_by_url' ).live( 'click', function ( event ) {
					//jQuery( this ).addClass( 'mainwp_action_down' );
					//jQuery( '#group_sites_by_name' ).removeClass( 'mainwp_action_down' );
					jQuery( '#managegroups-sites-list' ).find( '.website_name' ).hide();
					jQuery( '#managegroups-sites-list' ).find( '.website_url' ).show();
					return false;
				} );

				jQuery( '.managegroups-listitem' ).live( {
					mouseenter: function () {
						if ( jQuery( this ).find( '.text' ).is( ":visible" ) ) jQuery( this ).find( '.actions-text' ).show();
						else jQuery( this ).find( '.actions-input' ).show();
					},
					mouseleave: function () {
						jQuery( this ).find( '.actions-text' ).hide();
						jQuery( this ).find( '.actions-input' ).hide();
					}
				} );

				jQuery( '.managegroups-rename' ).live( 'click', function () {
					var parentObj = jQuery( this ).parents( '.managegroups-listitem' );
					parentObj.find( '.text' ).hide();
					parentObj.find( '.actions-text' ).hide();
					parentObj.find( '.input' ).show();
					parentObj.find( '.actions-input' ).show();
					return false;
				} );

				jQuery( '.managegroups-save' ).live( 'click', function () {
					var parentObj = jQuery( this ).parents( '.managegroups-listitem' );
					var groupId = parentObj.attr( 'id' );
					var newName = parentObj.find( '.input input' ).val();

					var data = mainwp_secure_data( {
						action: 'mainwp_group_rename',
						groupId: groupId,
						newName: newName
					} );

					jQuery.post( ajaxurl, data, function ( pParentObj ) {
						return function ( response ) {
							if ( response.error ) return;

							response = jQuery.trim( response.result );
							pParentObj.find( '.input input' ).val( response );
							pParentObj.find( '.text' ).html( response );

							pParentObj.find( '.input' ).hide();
							pParentObj.find( '.actions-input' ).hide();
							pParentObj.find( '.text' ).show();
							pParentObj.find( '.actions-text' ).show();
						}
					}( parentObj ), 'json' );

					return false;
				} );

				jQuery( '.managegroups-delete' ).live( 'click', function () {
					var confirmed = confirm( 'This will permanently delete this group. Proceed?' );
					if ( confirmed ) {
						var parentObj = jQuery( this ).parents( '.managegroups-listitem' );
						parentObj.css( 'background-color', '#F8E0E0' );
						var groupId = parentObj.attr( 'id' );

						var data = {
							action: 'mainwp_group_delete',
							groupId: groupId
						};

						jQuery.post( ajaxurl, data, function ( pParentObj ) {
							return function ( response ) {
								response = jQuery.trim( response );
								if ( response == 'OK' ) pParentObj.animate( {opacity: 0}, 300, function () {
									pParentObj.remove()
								} );
							}
						}( parentObj ) );
					}
					return false;
				} );

				jQuery( '.managegroups-addnew' ).live( 'click', function () {
					var addNewContainer = jQuery( '.managegroups-group-add' );
					addNewContainer.find( 'input' ).val( '' );
					addNewContainer.show();
				} );

				jQuery( '.managegroups-cancel' ).live( 'click', function () {
					var addNewContainer = jQuery( '.managegroups-group-add' );
					addNewContainer.hide();
					addNewContainer.find( 'input' ).val( '' );
				} );

				jQuery( '.managegroups-savenew' ).live( 'click', function () {
					var parentObj = jQuery( this ).parents( '.managegroups-listitem' );
					var newName = parentObj.find( 'input' ).val();

					var data = mainwp_secure_data( {
						action: 'mainwp_group_add',
						newName: newName
					} );

					jQuery.post( ajaxurl, data, function ( response ) {
						try {
							resp = jQuery.parseJSON( response );

							if ( resp.error != undefined ) return;
						}
						catch ( err ) {

						}

						response = jQuery.trim( response );

						var addNewContainer = jQuery( '.managegroups-group-add' );
						addNewContainer.hide();
						addNewContainer.find( 'input' ).val( '' );

						addNewContainer.after( response );
					} );

					return false;
				} );

				jQuery( '.managegroups-radio' ).live( 'click', function () {
					var parentObj = jQuery( this ).parents( '.managegroups-listitem' );
					var groupId = parentObj.attr( 'id' );

					var data = {
						action: 'mainwp_group_getsites',
						groupId: groupId
					}

					jQuery.post( ajaxurl, data, function ( response ) {
						response = jQuery.trim( response );
						if ( response == 'ERROR' ) return;

						jQuery( 'input[name="sites"]' ).attr( 'checked', false );

						var websiteIds = jQuery.parseJSON( response );
						for ( var i = 0; i < websiteIds.length; i++ ) {
							jQuery( 'input[name="sites"][value="' + websiteIds[i] + '"]' ).attr( 'checked', true );
						}
					} );
				} );

				jQuery( '.managegroups-saveAll' ).live( 'click', function () {
					var checkedGroup = jQuery( 'input[name="groups"]:checked' );
					var groupId = checkedGroup.val();
					if ( groupId == undefined ) return;

					var allCheckedWebsites = jQuery( 'input[name="sites"]:checked' );
					var allCheckedIds = [];
					for ( var i = 0; i < allCheckedWebsites.length; i++ ) {
						allCheckedIds.push( jQuery( allCheckedWebsites[i] ).val() );
					}

					var data = mainwp_secure_data( {
						action: 'mainwp_group_updategroup',
						groupId: groupId,
						websiteIds: allCheckedIds
					} );

					jQuery.post( ajaxurl, data, function ( response ) {
						jQuery( '#managegroups-saved' ).stop( true, true );
						jQuery( '#managegroups-saved' ).show();
						jQuery( '#managegroups-saved' ).fadeOut( 2000 );
						return;
					}, 'json' );
				} );
			} );
		</script>
		<?php 
    }
Exemplo n.º 16
0
    public static function renderMainWPTools()
    {
        if (!mainwp_current_user_can("dashboard", "manage_dashboard_settings")) {
            mainwp_do_not_have_permissions("manage dashboard settings");
            return;
        }
        self::renderHeader('MainWPTools');
        ?>
            <div class="postbox" id="mainwp-tools">
                <h3 class="mainwp_box_title"><span><i class="fa fa-wrench"></i> <?php 
        _e('MainWP Tools', 'mainwp');
        ?>
</span></h3>
                <div class="inside">
                    <table class="form-table">
                        <tbody>
                            <tr>
                                <th scope="row"><?php 
        _e('Force Dashboard to Establish New Connection', 'mainwp');
        ?>
 <?php 
        MainWPUtility::renderToolTip(__('Use this option to establish new connection with child sites.', 'mainwp'));
        ?>
</th>
                                <td>
                                    <input type="submit" name="" id="force-destroy-sessions-button" class="button-primary button" value="<?php 
        _e('Establish New Connection', 'mainwp');
        ?>
"/><br/>
                                    <em>
                                        <?php 
        _e('Forces your Dashboard to reconnect with your Child sites. This feature will log out any currently logged in users on the Child sites and require them to re-log in. Only needed if suggested by MainWP Support.', 'mainwp');
        ?>
                                    </em>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row"><?php 
        _e('Scan child sites for known issues', 'mainwp');
        ?>
 <?php 
        MainWPUtility::renderToolTip(__('Use this option to scan child sites for known issues.', 'mainwp'));
        ?>
</th>
                                <td>
                                    <a href="<?php 
        echo admin_url('admin.php?page=MainWPChildScan');
        ?>
" class="button-primary button"><?php 
        _e('Scan', 'mainwp');
        ?>
</a><br/>
                                    <em>
                                        <?php 
        _e('Scans each site individually for known issues.', 'mainwp');
        ?>
                                    </em>
                                </td>
                            </tr>
                            </tbody>
                    </table>
                </div>
            </div>
        <?php 
        self::renderFooter('MainWPTools');
    }
Exemplo n.º 17
0
    public static function renderBulkAdd()
    {
        if (!mainwp_current_user_can('dashboard', 'manage_posts')) {
            mainwp_do_not_have_permissions(__('manage posts', 'mainwp'));
            return;
        }
        $src = get_site_url() . '/wp-admin/post-new.php?post_type=bulkpost&hideall=1' . (isset($_REQUEST['select']) ? '&select=' . $_REQUEST['select'] : '');
        $src = apply_filters('mainwp_bulkpost_edit_source', $src);
        //Loads the post screen via AJAX, which redirects to the "posting()" to really post the posts to the saved sites
        self::renderHeader('BulkAdd');
        ?>
		<iframe scrolling="auto" id="mainwp_iframe" src="<?php 
        echo $src;
        ?>
"></iframe>
		<?php 
        self::renderFooter('BulkAdd');
    }
Exemplo n.º 18
0
    public static function renderAllSites(&$website, $updated, $groups, $statusses, $pluginDir)
    {
        if (!mainwp_current_user_can('dashboard', 'edit_sites')) {
            mainwp_do_not_have_permissions(__('edit sites', 'mainwp'));
            return;
        }
        $remote_destinations = apply_filters('mainwp_backups_remote_get_destinations', null, array('website' => $website->id));
        $hasRemoteDestinations = $remote_destinations == null ? $remote_destinations : count($remote_destinations);
        ?>
        <div class="error below-h2" style="display: none;" id="ajax-error-zone"></div>
        <div id="ajax-information-zone" class="updated" style="display: none;"></div>
        <?php 
        if ($updated) {
            ?>
            <div id="mainwp_managesites_edit_message" class="updated"><p><?php 
            _e('Website updated.', 'mainwp');
            ?>
</p></div>
            <?php 
        }
        ?>
        <form method="POST" action="" id="mainwp-edit-single-site-form" enctype="multipart/form-data">
            <div class="postbox">
            <h3 class="mainwp_box_title"><i class="fa fa-cog"></i> <?php 
        _e('General Options', 'mainwp');
        ?>
</h3>
            <div class="inside">
            <table class="form-table">
                <tbody>
                <tr>
                    <th scope="row"><?php 
        _e('Site Name', 'mainwp');
        ?>
</th>
                    <td><input type="text" name="mainwp_managesites_edit_sitename"
                               value="<?php 
        echo stripslashes($website->name);
        ?>
" class="regular-text"/></td>
                </tr>
                <tr>
                    <th scope="row"><?php 
        _e('Site URL', 'mainwp');
        ?>
</th>
                    <td><select id="mainwp_managesites_edit_siteurl_protocol" name="mainwp_managesites_edit_siteurl_protocol"><option <?php 
        echo MainWP_Utility::startsWith($website->url, 'http:') ? 'selected' : '';
        ?>
 value="http">http://</option><option <?php 
        echo MainWP_Utility::startsWith($website->url, 'https:') ? 'selected' : '';
        ?>
 value="https">https://</option></select> <input type="text" id="mainwp_managesites_edit_siteurl" disabled="disabled"
                               value="<?php 
        echo MainWP_Utility::removeHttpPrefix($website->url, true);
        ?>
" class="regular-text" /> <span
                            class="mainwp-form_hint-display"><?php 
        _e('Site URL cannot be changed.', 'mainwp');
        ?>
</span></td>
                </tr>
                <tr>
                    <th scope="row"><?php 
        _e('Administrator Username', 'mainwp');
        ?>
</th>
                    <td><input type="text" name="mainwp_managesites_edit_siteadmin"
                               id="mainwp_managesites_edit_siteadmin"
                               value="<?php 
        echo $website->adminname;
        ?>
"
                               class="regular-text"/></td>
                </tr>
                <tr>
                    <th scope="row"><?php 
        _e('Groups', 'mainwp');
        ?>
</th>
                    <td>
                        <input type="text" name="mainwp_managesites_edit_addgroups"
                               id="mainwp_managesites_edit_addgroups" value=""
                               class="regular-text"/> <span
                            class="mainwp-form_hint"><?php 
        _e('Separate groups by commas (e.g. Group 1, Group 2).', 'mainwp');
        ?>
</span>

                        <div id="selected_groups" style="display: block; width: 25em">
                            <?php 
        if (count($groups) == 0) {
            echo 'No groups added yet.';
        }
        $groupsSite = MainWP_DB::Instance()->getGroupsByWebsiteId($website->id);
        foreach ($groups as $group) {
            echo '<div class="mainwp_selected_groups_item"><input type="checkbox" name="selected_groups[]" value="' . $group->id . '" ' . (isset($groupsSite[$group->id]) && $groupsSite[$group->id] ? 'checked' : '') . ' />&nbsp' . stripslashes($group->name) . '</div>';
        }
        ?>
                        </div>
                        <span class="description"><?php 
        _e('Or assign existing groups.', 'mainwp');
        ?>
</span>
                    </td>
                </tr>
                <tr>
                    <th scope="row"><?php 
        _e('Offline Checks', 'mainwp');
        ?>
</th>
                    <td>
                        <input type="radio" name="offline_checks" id="check_disabled" value="disabled"
                            <?php 
        echo !in_array($website->offline_checks, $statusses) ? 'checked="true"' : '';
        ?>
 /> <?php 
        _e('Disabled', 'mainwp');
        ?>
 &nbsp;&nbsp;&nbsp;
                        <input type="radio" name="offline_checks" id="check_hourly"
                               value="hourly" <?php 
        echo $website->offline_checks == 'hourly' ? 'checked="true"' : '';
        ?>
/> <?php 
        _e('Hourly', 'mainwp');
        ?>
 &nbsp;&nbsp;&nbsp;
                        <input type="radio" name="offline_checks" id="check_2xday"
                               value="2xday" <?php 
        echo $website->offline_checks == '2xday' ? 'checked="true"' : '';
        ?>
/> <?php 
        _e('2x Day', 'mainwp');
        ?>
 &nbsp;&nbsp;&nbsp;
                        <input type="radio" name="offline_checks" id="check_daily"
                               value="daily" <?php 
        echo $website->offline_checks == 'daily' ? 'checked="true"' : '';
        ?>
/> <?php 
        _e('Daily', 'mainwp');
        ?>
 &nbsp;&nbsp;&nbsp;
                        <input type="radio" name="offline_checks" id="check_weekly" value="weekly"
                            <?php 
        echo $website->offline_checks == 'weekly' ? 'checked="true"' : '';
        ?>
/>
                        Weekly  &nbsp;
                    <span class="mainwp-form_hint-display"><?php 
        _e('Notifications are sent to:', 'mainwp');
        ?>
 <?php 
        echo MainWP_Utility::getNotificationEmail();
        ?>
                        (<?php 
        _e('this address can be changed', 'mainwp');
        ?>
 <a
                                href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=Settings"><?php 
        _e('here', 'mainwp');
        ?>
</a>)</span>
                    </td>
                </tr>
                <tr>
                    <th scope="row"><?php 
        _e('Client Plugin Folder Option', 'mainwp');
        ?>
 <?php 
        MainWP_Utility::renderToolTip('Default, files/folders on the child site are viewable.<br />Hidden, when attempting to view files a 404 file will be returned, however a footprint does still exist.<br /><strong>Hiding the Child Plugin does require the plugin to make changes to your .htaccess file that in rare instances or server configurations could cause problems.</strong>');
        ?>
</th>
                    <td>
                        <div class="mainwp-radio" style="float: left;">
                          <input type="radio" value="" name="mainwp_options_footprint_plugin_folder" id="mainwp_options_footprint_plugin_folder_global" <?php 
        echo $pluginDir == '' ? 'checked="true"' : '';
        ?>
"/>
                          <label for="mainwp_options_footprint_plugin_folder_global"></label>
                        </div>Global Setting (<a href="<?php 
        echo admin_url('admin.php?page=Settings#network-footprint');
        ?>
">Change Here</a>)<br/>
                        <div class="mainwp-radio" style="float: left;">
                          <input type="radio" value="default" name="mainwp_options_footprint_plugin_folder" id="mainwp_options_footprint_plugin_folder_default" <?php 
        echo $pluginDir == 'default' ? 'checked="true"' : '';
        ?>
"/>
                          <label for="mainwp_options_footprint_plugin_folder_default"></label>
                        </div>Default<br/>
                        <div class="mainwp-radio" style="float: left;">
                          <input type="radio" value="hidden" name="mainwp_options_footprint_plugin_folder" id="mainwp_options_footprint_plugin_folder_hidden" <?php 
        echo $pluginDir == 'hidden' ? 'checked="true"' : '';
        ?>
/>
                          <label for="mainwp_options_footprint_plugin_folder_hidden"></label>
                        </div>Hidden (<strong>Note: </strong><i>If the heatmap is turned on, the heatmap javascript will still be visible.</i>) <br/>
                    </td>
                </tr>               
                <tr>
                    <th scope="row"><?php 
        _e('Require Backup Before Upgrade', 'mainwp');
        ?>
 <?php 
        MainWP_Utility::renderToolTip(__('Backup only works when enabled in the global settings as well.', 'mainwp'), admin_url('admin.php?page=Settings'));
        ?>
</th>
                    <td>
                         <select id="mainwp_backup_before_upgrade" name="mainwp_backup_before_upgrade">
                             <option <?php 
        echo $website->backup_before_upgrade == 1 ? 'selected' : '';
        ?>
 value="1"><?php 
        _e('Yes', 'mainwp');
        ?>
</option>
                             <option <?php 
        echo $website->backup_before_upgrade == 0 ? 'selected' : '';
        ?>
 value="0"><?php 
        _e('No', 'mainwp');
        ?>
</option>
                             <option <?php 
        echo $website->backup_before_upgrade == 2 ? 'selected' : '';
        ?>
 value="2"><?php 
        _e('Use Global Setting', 'mainwp');
        ?>
</option>
                         </select> <i>(<?php 
        _e('Default', 'mainwp');
        ?>
: <?php 
        _e('Use Global Setting', 'mainwp');
        ?>
)</i>
                         
                    </td>
                </tr>
                 <tr>
                    <th scope="row"><?php 
        _e('Auto Update Core', 'mainwp');
        ?>
 <?php 
        MainWP_Utility::renderToolTip('Auto update only works when enabled in the global settings as well.', admin_url('admin.php?page=Settings'));
        ?>
</th>
                    <td>
                        <div class="mainwp-checkbox">
                        <input type="checkbox" name="mainwp_automaticDailyUpdate"
                               id="mainwp_automaticDailyUpdate" <?php 
        echo $website->automatic_update == 1 ? 'checked="true"' : '';
        ?>
 />
                        <label for="mainwp_automaticDailyUpdate"></label>
                        </div>
                    </td>
                </tr>
                <?php 
        if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) {
            ?>
                <tr>
                    <th scope="row"><?php 
            _e('Ignore Core Updates', 'mainwp');
            ?>
 <?php 
            MainWP_Utility::renderToolTip('Set to YES if you want to Ignore Core Updates.');
            ?>
</th>
                    <td>
                        <div class="mainwp-checkbox">
                        <input type="checkbox" name="mainwp_is_ignoreCoreUpdates"
                               id="mainwp_is_ignoreCoreUpdates" <?php 
            echo $website->is_ignoreCoreUpdates == 1 ? 'checked="true"' : '';
            ?>
 />
                        <label for="mainwp_is_ignoreCoreUpdates"></label>
                        </div>
                    </td>
                </tr>  
                <tr>
                    <th scope="row"><?php 
            _e('Ignore All Plugin Updates', 'mainwp');
            ?>
 <?php 
            MainWP_Utility::renderToolTip('Set to YES if you want to Ignore All Plugin Updates.');
            ?>
</th>
                    <td>
                        <div class="mainwp-checkbox">
                        <input type="checkbox" name="mainwp_is_ignorePluginUpdates"
                               id="mainwp_is_ignorePluginUpdates" <?php 
            echo $website->is_ignorePluginUpdates == 1 ? 'checked="true"' : '';
            ?>
 />
                        <label for="mainwp_is_ignorePluginUpdates"></label>
                        </div>
                    </td>
                </tr>  
                <tr>
                    <th scope="row"><?php 
            _e('Ignore All Theme Updates', 'mainwp');
            ?>
 <?php 
            MainWP_Utility::renderToolTip('Set to YES if you want to Ignore All Theme Updates.');
            ?>
</th>
                    <td>
                        <div class="mainwp-checkbox">
                        <input type="checkbox" name="mainwp_is_ignoreThemeUpdates"
                               id="mainwp_is_ignoreThemeUpdates" <?php 
            echo $website->is_ignoreThemeUpdates == 1 ? 'checked="true"' : '';
            ?>
 />
                        <label for="mainwp_is_ignoreThemeUpdates"></label>
                        </div>
                    </td>
                </tr>
                <?php 
        }
        ?>
                <?php 
        do_action('mainwp_extension_sites_edit_tablerow', $website);
        ?>
                </tbody>
            </table>
            </div>
            </div>
            <div class="clear"></div>
            <div class="postbox">
            <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
        _e('Advanced Options', 'mainwp');
        ?>
</span></h3>
            <div class="inside">
            <table class="form-table" style="width: 100%">
                <?php 
        $disabled_unique = empty($website->uniqueId) ? true : false;
        ?>
                <tr class="form-field form-required">
                    <th scope="row"><?php 
        _e('Child Unique Security ID ', 'mainwp');
        MainWP_Utility::renderToolTip('The Unique Security ID adds additional protection between the Child plugin and your Main Dashboard. The Unique Security ID will need to match when being added to the Main Dashboard. This is additional security and should not be needed in most situations.');
        ?>
</th>
                    <td><input type="text" id="mainwp_managesites_edit_uniqueId" style="width: 350px;" <?php 
        echo $disabled_unique ? 'disabled="disabled"' : '';
        ?>
                             name="mainwp_managesites_edit_uniqueId" value="<?php 
        echo $website->uniqueId;
        ?>
" class=""/><span class="mainwp-form_hint">The Unique Security ID adds additional protection between the Child plugin and your Main Dashboard. The Unique Security ID will need to match when being added to the Main Dashboard. This is additional security and should not be needed in most situations.</span></td>
                </tr>                
                 <tr class="form-field form-required">
                    <th scope="row"><?php 
        _e('Verify Certificate', 'mainwp');
        ?>
 <?php 
        MainWP_Utility::renderToolTip(__('Verify the childs SSL certificate. This should be disabled if you are using out of date or self signed certificates.', 'mainwp'));
        ?>
</th>
                    <td>
                        <select id="mainwp_managesites_edit_verifycertificate" name="mainwp_managesites_edit_verifycertificate">
                             <option <?php 
        echo $website->verify_certificate == 1 ? 'selected' : '';
        ?>
 value="1"><?php 
        _e('Yes', 'mainwp');
        ?>
</option>
                             <option <?php 
        echo $website->verify_certificate == 0 ? 'selected' : '';
        ?>
 value="0"><?php 
        _e('No', 'mainwp');
        ?>
</option>
                             <option <?php 
        echo $website->verify_certificate == 2 ? 'selected' : '';
        ?>
 value="2"><?php 
        _e('Use Global Setting', 'mainwp');
        ?>
</option>
                         </select> <i>(Default: Yes)</i>
                    </td>
                </tr>
                <tr class="form-field form-required">
                   <th scope="row"><?php 
        _e('SSL Version', 'mainwp');
        ?>
 <?php 
        MainWP_Utility::renderToolTip(__('Prefered SSL Version to connect to your site.', 'mainwp'));
        ?>
</th>
                    <td>
                        <select id="mainwp_managesites_edit_ssl_version" name="mainwp_managesites_edit_ssl_version">
                             <option <?php 
        echo $website->ssl_version == 'auto' ? 'selected' : '';
        ?>
 value="auto"><?php 
        _e('Auto detect', 'mainwp');
        ?>
</option>
                             <option <?php 
        echo $website->ssl_version == '1.x' ? 'selected' : '';
        ?>
 value="1.x"><?php 
        _e('TLS v1.x', 'mainwp');
        ?>
</option>
                             <option <?php 
        echo $website->ssl_version == '2' ? 'selected' : '';
        ?>
 value="2"><?php 
        _e('SSL v2', 'mainwp');
        ?>
</option>
                             <option <?php 
        echo $website->ssl_version == '3' ? 'selected' : '';
        ?>
 value="3"><?php 
        _e('SSL v3', 'mainwp');
        ?>
</option>
                             <option <?php 
        echo $website->ssl_version == '1.0' ? 'selected' : '';
        ?>
 value="1.0"><?php 
        _e('TLS v1.0', 'mainwp');
        ?>
</option>
                             <option <?php 
        echo $website->ssl_version == '1.1' ? 'selected' : '';
        ?>
 value="1.1"><?php 
        _e('TLS v1.1', 'mainwp');
        ?>
</option>
                             <option <?php 
        echo $website->ssl_version == '1.2' ? 'selected' : '';
        ?>
 value="1.2"><?php 
        _e('TLS v1.2', 'mainwp');
        ?>
</option>
                         </select> <em>(<?php 
        _e('Default: Auto detect', 'mainwp');
        ?>
)</em>
                    </td>
                </tr>

                <!-- fake fields are a workaround for chrome autofill getting the wrong fields -->
                <input style="display:none" type="text" name="fakeusernameremembered"/>
                <input style="display:none" type="password" name="fakepasswordremembered"/>

                <tr>
                    <td colspan="2"><div class="mainwp_info-box"><?php 
        _e('If your Child Site is protected with HTTP basic authentication, please set the username and password for authentication here.', 'mainwp');
        ?>
</div></td>
                </tr>

                <tr class="form-field form-required">
                     <th scope="row"><?php 
        _e('HTTP username ', 'mainwp');
        ?>
</th>
                     <td><input type="text" id="mainwp_managesites_edit_http_user" style="width: 350px;" name="mainwp_managesites_edit_http_user" value="<?php 
        echo empty($website->http_user) ? '' : $website->http_user;
        ?>
" class=""/></td>
                </tr>
                <tr class="form-field form-required">
                     <th scope="row"><?php 
        _e('HTTP password ', 'mainwp');
        ?>
</th>
                     <td><input type="password" id="mainwp_managesites_edit_http_pass" style="width: 350px;" name="mainwp_managesites_edit_http_pass" value="<?php 
        echo empty($website->http_pass) ? '' : $website->http_pass;
        ?>
" class=""/></td>
                </tr>
            </table>
            </div>
            </div>
            
            <div class="clear"></div>
            <div class="postbox">
            <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
        _e('Backup Settings', 'mainwp');
        ?>
</span></h3>
            <div class="inside">
            <table class="form-table" style="width: 100%">
                <?php 
        $globalArchiveFormat = get_option('mainwp_archiveFormat');
        if ($globalArchiveFormat == false) {
            $globalArchiveFormat = 'tar.gz';
        }
        if ($globalArchiveFormat == 'zip') {
            $globalArchiveFormatText = 'Zip';
        } else {
            if ($globalArchiveFormat == 'tar') {
                $globalArchiveFormatText = 'Tar';
            } else {
                if ($globalArchiveFormat == 'tar.gz') {
                    $globalArchiveFormatText = 'Tar GZip';
                } else {
                    if ($globalArchiveFormat == 'tar.bz2') {
                        $globalArchiveFormatText = 'Tar BZip2';
                    }
                }
            }
        }
        $backupSettings = MainWP_DB::Instance()->getWebsiteBackupSettings($website->id);
        $archiveFormat = $backupSettings->archiveFormat;
        $useGlobal = $archiveFormat == 'global';
        ?>
                <tr>
                    <th scope="row"><?php 
        _e('Archive Format', 'mainwp');
        ?>
 <?php 
        MainWP_Utility::renderToolTip(__('', 'mainwp'));
        ?>
</th>
                    <td>
                        <table class="mainwp-nomarkup">
                            <tr>
                                <td valign="top">
                                    <span class="mainwp-select-bg"><select name="mainwp_archiveFormat" id="mainwp_archiveFormat">
                                        <option value="global" <?php 
        if ($useGlobal) {
            ?>
selected<?php 
        }
        ?>
>Global setting (<?php 
        echo $globalArchiveFormatText;
        ?>
)</option>
                                        <option value="zip" <?php 
        if ($archiveFormat == 'zip') {
            ?>
selected<?php 
        }
        ?>
>Zip</option>
                                        <option value="tar" <?php 
        if ($archiveFormat == 'tar') {
            ?>
selected<?php 
        }
        ?>
>Tar</option>
                                        <option value="tar.gz" <?php 
        if ($archiveFormat == 'tar.gz') {
            ?>
selected<?php 
        }
        ?>
>Tar GZip</option>
                                        <option value="tar.bz2" <?php 
        if ($archiveFormat == 'tar.bz2') {
            ?>
selected<?php 
        }
        ?>
>Tar BZip2</option>
                                    </select><label></label></span>
                                </td>
                                <td>
                                    <i>
                                    <span id="info_global" class="archive_info" <?php 
        if (!$useGlobal) {
            ?>
style="display: none;"<?php 
        }
        ?>
><?php 
        if ($globalArchiveFormat == 'zip') {
            ?>
Uses PHP native Zip-library, when missing, the PCLZip library included in Wordpress will be used. (Good compression, fast with native zip-library)<?php 
        } elseif ($globalArchiveFormat == 'tar') {
            ?>
Uses PHP native Zip-library, when missing, the PCLZip library included in Wordpress will be used. (Good compression, fast with native zip-library)<?php 
        } elseif ($globalArchiveFormat == 'tar.gz') {
            ?>
Creates a GZipped tar-archive. (Good compression, fast, low memory usage)<?php 
        } elseif ($globalArchiveFormat == 'tar.bz2') {
            ?>
Creates a BZipped tar-archive. (Best compression, fast, low memory usage)<?php 
        }
        ?>
</span>
                                    <span id="info_zip" class="archive_info" <?php 
        if ($archiveFormat != 'zip') {
            ?>
style="display: none;"<?php 
        }
        ?>
>Uses PHP native Zip-library, when missing, the PCLZip library included in Wordpress will be used. (Good compression, fast with native zip-library)</span>
                                    <span id="info_tar" class="archive_info" <?php 
        if ($archiveFormat != 'tar') {
            ?>
style="display: none;"<?php 
        }
        ?>
>Creates an uncompressed tar-archive. (No compression, fast, low memory usage)</span>
                                    <span id="info_tar.gz" class="archive_info" <?php 
        if ($archiveFormat != 'tar.gz') {
            ?>
style="display: none;"<?php 
        }
        ?>
>Creates a GZipped tar-archive. (Good compression, fast, low memory usage)</span>
                                    <span id="info_tar.bz2" class="archive_info" <?php 
        if ($archiveFormat != 'tar.bz2') {
            ?>
style="display: none;"<?php 
        }
        ?>
>Creates a BZipped tar-archive. (Best compression, fast, low memory usage)</span>
                                    </i>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>

                <?php 
        $maximumFileDescriptorsOverride = $website->maximumFileDescriptorsOverride == 1;
        $maximumFileDescriptorsAuto = $website->maximumFileDescriptorsAuto == 1;
        $maximumFileDescriptors = $website->maximumFileDescriptors;
        ?>
                <tr class="archive_method archive_zip" <?php 
        if ($archiveFormat != 'zip') {
            ?>
style="display: none;"<?php 
        }
        ?>
>
                    <th scope="row"><?php 
        _e('Maximum File Descriptors on Child', 'mainwp');
        ?>
 <?php 
        MainWP_Utility::renderToolTip('The maximum number of open file descriptors on the child hosting.', 'http://docs.mainwp.com/maximum-number-of-file-descriptors/');
        ?>
</th>
                    <td>
                        <div class="mainwp-radio" style="float: left;">
                          <input type="radio" value="" name="mainwp_options_maximumFileDescriptorsOverride" id="mainwp_options_maximumFileDescriptorsOverride_global" <?php 
        echo !$maximumFileDescriptorsOverride ? 'checked="true"' : '';
        ?>
"/>
                          <label for="mainwp_options_maximumFileDescriptorsOverride_global"></label>
                        </div>Global Setting (<a href="<?php 
        echo admin_url('admin.php?page=Settings');
        ?>
">Change Here</a>)<br/>
                        <div class="mainwp-radio" style="float: left;">
                          <input type="radio" value="override" name="mainwp_options_maximumFileDescriptorsOverride" id="mainwp_options_maximumFileDescriptorsOverride_override" <?php 
        echo $maximumFileDescriptorsOverride ? 'checked="true"' : '';
        ?>
"/>
                          <label for="mainwp_options_maximumFileDescriptorsOverride_override"></label>
                        </div>Override<br/><br />

                        <div style="float: left">Auto Detect:&nbsp;</div><div class="mainwp-checkbox"><input type="checkbox" id="mainwp_maximumFileDescriptorsAuto" name="mainwp_maximumFileDescriptorsAuto" <?php 
        echo $maximumFileDescriptorsAuto ? 'checked="checked"' : '';
        ?>
 /> <label for="mainwp_maximumFileDescriptorsAuto"></label></div><div style="float: left"><i>(<?php 
        _e('Enter a fallback value because not all hosts support this function.', 'mainwp');
        ?>
)</i></div><div style="clear:both"></div>
                        <input type="text" name="mainwp_options_maximumFileDescriptors" id="mainwp_options_maximumFileDescriptors"
                               value="<?php 
        echo $maximumFileDescriptors;
        ?>
"/><span class="mainwp-form_hint"><?php 
        _e('The maximum number of open file descriptors on the child hosting.  0 sets unlimited.', 'mainwp');
        ?>
</span>
                    </td>
                </tr>
                <tr class="archive_method archive_zip" <?php 
        if ($archiveFormat != 'zip') {
            ?>
style="display: none;"<?php 
        }
        ?>
>
                    <th scope="row"><?php 
        _e('Load Files in Memory Before Zipping', 'mainwp');
        ?>
 <?php 
        MainWP_Utility::renderToolTip('This causes the files to be opened and closed immediately, using less simultaneous I/O operations on the disk. For huge sites with a lot of files we advise to disable this, memory usage will drop but we will use more file handlers when backing up.', 'http://docs.mainwp.com/load-files-memory/');
        ?>
</th>
                    <td>
                        <input type="radio" name="mainwp_options_loadFilesBeforeZip" id="mainwp_options_loadFilesBeforeZip_global" value="1" <?php 
        if ($website->loadFilesBeforeZip == false || $website->loadFilesBeforeZip == 1) {
            ?>
checked="true"<?php 
        }
        ?>
/> Global setting (<a href="<?php 
        echo admin_url('admin.php?page=Settings');
        ?>
">Change Here</a>)<br />
                        <input type="radio" name="mainwp_options_loadFilesBeforeZip" id="mainwp_options_loadFilesBeforeZip_yes" value="2" <?php 
        if ($website->loadFilesBeforeZip == 2) {
            ?>
checked="true"<?php 
        }
        ?>
/> Yes<br />
                        <input type="radio" name="mainwp_options_loadFilesBeforeZip" id="mainwp_options_loadFilesBeforeZip_no" value="0" <?php 
        if ($website->loadFilesBeforeZip == 0) {
            ?>
checked="true"<?php 
        }
        ?>
/> No<br />
                    </td>
                </tr>
                <?php 
        if ($hasRemoteDestinations !== null) {
            do_action('mainwp_backups_remote_settings', array('website' => $website->id, 'hide' => 'no'));
        }
        ?>
            </table>
            </div>
            </div>
            
            <?php 
        $plugin_upgrades = json_decode($website->plugin_upgrades, true);
        if (!is_array($plugin_upgrades)) {
            $plugin_upgrades = array();
        }
        $userExtension = MainWP_DB::Instance()->getUserExtension();
        $globalIgnoredPluginConflicts = json_decode($userExtension->ignored_pluginConflicts, true);
        ?>
            <?php 
        do_action('mainwp-extension-sites-edit', $website);
        ?>
<p class="submit"><input type="submit" name="submit" id="submit" class="button-primary button button-hero"
                                     value="<?php 
        _e('Update Site', 'mainwp');
        ?>
"/></p>
        </form>       
        <?php 
    }
Exemplo n.º 19
0
 function mainwp_ignorepluginsthemes()
 {
     $this->secure_request();
     if (!mainwp_current_user_can("dashboard", "ignore_unignore_updates")) {
         die(json_encode(array('error' => mainwp_do_not_have_permissions("ignore/unignor updates"))));
     }
     if (!isset($_POST['slug'])) {
         die(json_encode(array('error' => 'Invalid request')));
     }
     die(json_encode(array('result' => MainWPRightNow::ignorePluginsThemes($_POST['type'], $_POST['slug'], $_POST['name']))));
 }
Exemplo n.º 20
0
    public static function renderSites()
    {
        $globalView = true;
        $current_wpid = MainWPUtility::get_current_wpid();
        if ($current_wpid) {
            $sql = MainWPDB::Instance()->getSQLWebsiteById($current_wpid);
            $globalView = false;
        } else {
            $sql = MainWPDB::Instance()->getSQLWebsitesForCurrentUser();
        }
        $websites = MainWPDB::Instance()->query($sql);
        if (!$websites) {
            return;
        }
        $userExtension = MainWPDB::Instance()->getUserExtension();
        $total_themesIgnored = $total_pluginsIgnored = 0;
        if ($globalView) {
            $decodedIgnoredPlugins = json_decode($userExtension->ignored_plugins, true);
            $decodedIgnoredThemes = json_decode($userExtension->ignored_themes, true);
            $total_pluginsIgnored = is_array($decodedIgnoredPlugins) ? count($decodedIgnoredPlugins) : 0;
            $total_themesIgnored = is_array($decodedIgnoredThemes) ? count($decodedIgnoredThemes) : 0;
        }
        $globalIgnoredPluginConflicts = json_decode($userExtension->ignored_pluginConflicts, true);
        if (!is_array($globalIgnoredPluginConflicts)) {
            $globalIgnoredPluginConflicts = array();
        }
        $globalIgnoredThemeConflicts = json_decode($userExtension->ignored_themeConflicts, true);
        if (!is_array($globalIgnoredThemeConflicts)) {
            $globalIgnoredThemeConflicts = array();
        }
        $total_wp_upgrades = 0;
        $total_plugin_upgrades = 0;
        $total_theme_upgrades = 0;
        $total_sync_errors = 0;
        $total_uptodate = 0;
        $total_offline = 0;
        $total_conflict = 0;
        $allPlugins = array();
        $pluginsInfo = array();
        $allThemes = array();
        $themesInfo = array();
        @MainWPDB::data_seek($websites, 0);
        $currentSite = null;
        $pluginsIgnored_perSites = $themesIgnored_perSites = array();
        while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
            if (!$globalView) {
                $currentSite = $website;
            }
            $wp_upgrades = json_decode(MainWPDB::Instance()->getWebsiteOption($website, 'wp_upgrades'), true);
            if ($website->is_ignoreCoreUpdates) {
                $wp_upgrades = array();
            }
            if (is_array($wp_upgrades) && count($wp_upgrades) > 0) {
                $total_wp_upgrades++;
            }
            $plugin_upgrades = json_decode($website->plugin_upgrades, true);
            if ($website->is_ignorePluginUpdates) {
                $plugin_upgrades = array();
            }
            $theme_upgrades = json_decode($website->theme_upgrades, true);
            if ($website->is_ignoreThemeUpdates) {
                $theme_upgrades = array();
            }
            $decodedPremiumUpgrades = json_decode(MainWPDB::Instance()->getWebsiteOption($website, 'premium_upgrades'), true);
            if (is_array($decodedPremiumUpgrades)) {
                foreach ($decodedPremiumUpgrades as $crrSlug => $premiumUpgrade) {
                    $premiumUpgrade['premium'] = true;
                    if ($premiumUpgrade['type'] == 'plugin') {
                        if (!is_array($plugin_upgrades)) {
                            $plugin_upgrades = array();
                        }
                        if (!$website->is_ignorePluginUpdates) {
                            $plugin_upgrades[$crrSlug] = $premiumUpgrade;
                        }
                    } else {
                        if ($premiumUpgrade['type'] == 'theme') {
                            if (!is_array($theme_upgrades)) {
                                $theme_upgrades = array();
                            }
                            if (!$website->is_ignoreThemeUpdates) {
                                $theme_upgrades[$crrSlug] = $premiumUpgrade;
                            }
                        }
                    }
                }
            }
            if (is_array($plugin_upgrades)) {
                $ignored_plugins = json_decode($website->ignored_plugins, true);
                if (is_array($ignored_plugins)) {
                    $plugin_upgrades = array_diff_key($plugin_upgrades, $ignored_plugins);
                }
                $ignored_plugins = json_decode($userExtension->ignored_plugins, true);
                if (is_array($ignored_plugins)) {
                    $plugin_upgrades = array_diff_key($plugin_upgrades, $ignored_plugins);
                }
                $total_plugin_upgrades += count($plugin_upgrades);
            }
            if (is_array($theme_upgrades)) {
                $ignored_themes = json_decode($website->ignored_themes, true);
                if (is_array($ignored_themes)) {
                    $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes);
                }
                $ignored_themes = json_decode($userExtension->ignored_themes, true);
                if (is_array($ignored_themes)) {
                    $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes);
                }
                $total_theme_upgrades += count($theme_upgrades);
            }
            $ignored_plugins = json_decode($website->ignored_plugins, true);
            $ignored_themes = json_decode($website->ignored_themes, true);
            if (is_array($ignored_plugins)) {
                $ignored_plugins = array_filter($ignored_plugins);
                $pluginsIgnored_perSites = array_merge($pluginsIgnored_perSites, $ignored_plugins);
            }
            if (is_array($ignored_themes)) {
                $ignored_themes = array_filter($ignored_themes);
                $themesIgnored_perSites = array_merge($themesIgnored_perSites, $ignored_themes);
            }
            if ($userExtension->site_view == 0) {
                //Keep track of all the plugins & themes
                if (is_array($plugin_upgrades)) {
                    foreach ($plugin_upgrades as $slug => $plugin_upgrade) {
                        if (!isset($allPlugins[$slug])) {
                            $allPlugins[$slug] = 1;
                        } else {
                            $allPlugins[$slug]++;
                        }
                        $pluginsInfo[$slug] = array('name' => $plugin_upgrade['Name'], 'slug' => $plugin_upgrade['update']['slug'], 'premium' => isset($plugin_upgrade['premium']) ? $plugin_upgrade['premium'] : 0);
                    }
                }
                ksort($allPlugins);
                if (is_array($theme_upgrades)) {
                    foreach ($theme_upgrades as $slug => $theme_upgrade) {
                        if (!isset($allThemes[$slug])) {
                            $allThemes[$slug] = 1;
                        } else {
                            $allThemes[$slug]++;
                        }
                        $themesInfo[$slug] = array('name' => $theme_upgrade['Name'], 'premium' => isset($theme_upgrade['premium']) ? $theme_upgrade['premium'] : 0);
                    }
                }
                ksort($allThemes);
            }
            if ($website->sync_errors != '') {
                $total_sync_errors++;
            }
            if ($website->uptodate == 1) {
                $total_uptodate++;
            }
            if ($website->offline_check_result == -1) {
                $total_offline++;
            }
            $pluginConflicts = json_decode($website->pluginConflicts, true);
            $themeConflicts = json_decode($website->themeConflicts, true);
            $ignoredPluginConflicts = json_decode($website->ignored_pluginConflicts, true);
            if (!is_array($ignoredPluginConflicts)) {
                $ignoredPluginConflicts = array();
            }
            $ignoredThemeConflicts = json_decode($website->ignored_themeConflicts, true);
            if (!is_array($ignoredThemeConflicts)) {
                $ignoredThemeConflicts = array();
            }
            $isConflict = false;
            if (count($pluginConflicts) > 0) {
                foreach ($pluginConflicts as $pluginConflict) {
                    if (!in_array($pluginConflict, $ignoredPluginConflicts) && !in_array($pluginConflict, $globalIgnoredPluginConflicts)) {
                        $isConflict = true;
                    }
                }
            }
            if (!$isConflict && count($themeConflicts) > 0) {
                foreach ($themeConflicts as $themeConflict) {
                    if (!in_array($themeConflict, $ignoredThemeConflicts) && !in_array($themeConflict, $globalIgnoredThemeConflicts)) {
                        $isConflict = true;
                    }
                }
            }
            if ($isConflict) {
                $total_conflict++;
            }
        }
        $errorsDismissed = get_user_option('mainwp_syncerrors_dismissed');
        ?>
    <div class="clear">
        <div id="mainwp-right-now-message" class="mainwp-right-now-error" <?php 
        if ($total_sync_errors <= 0 || $globalView && $errorsDismissed) {
            echo ' style="display: none;"';
        }
        ?>
>
            <p>
                <?php 
        if ($globalView) {
            ?>
                        <span id="mainwp-right-now-message-content"><?php 
            echo $total_sync_errors;
            ?>
 <?php 
            echo _n('Site Timed Out / Errored', 'Sites Timed Out / Errored', $total_sync_errors, 'mainwp');
            ?>
 (There was an error syncing some of your sites. <a href="http://docs.mainwp.com/sync-error/">Please check this help doc for possible solutions.</a>)</span><span style="float: right;"><a href="#" id="mainwp-right-now-message-dismiss"><i class="fa fa-times-circle"></i> <?php 
            _e('Dismiss', 'mainwp');
            ?>
</a></span>
                <?php 
        } else {
            ?>
                    <span id="mainwp-right-now-message-content"><a href="<?php 
            echo admin_url('admin.php?page=managesites&dashboard=' . $currentSite->id);
            ?>
"><?php 
            echo stripslashes($currentSite->name);
            ?>
</a> <?php 
            _e('Timed Out / Errored', 'mainwp');
            ?>
 (There was an error syncing some of your sites. <a href="http://docs.mainwp.com/sync-error/">Please check this help doc for possible solutions.</a>)</span>
                <?php 
        }
        ?>
            </p>
        </div>
    </div>
    <?php 
        $total_pluginsIgnored += count($pluginsIgnored_perSites);
        $total_themesIgnored += count($themesIgnored_perSites);
        //WP Upgrades part:
        $total_upgrades = $total_wp_upgrades + $total_plugin_upgrades + $total_theme_upgrades;
        ?>
    
    <div class="clear">
        <div class="mainwp-row-top">
            <span class="mainwp-left-col"><span class="mainwp-rightnow-number"><?php 
        echo $total_upgrades;
        ?>
</span> <?php 
        _e('Upgrade', 'mainwp');
        if (count($total_upgrades) > 1) {
            ?>
s<?php 
        }
        ?>
 <?php 
        _e('available', 'mainwp');
        ?>
</span>
            <span class="mainwp-mid-col">&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"><span class="mainwp-rightnow-number"><?php 
        echo $total_wp_upgrades;
        ?>
</span> <?php 
        _e('WordPress upgrade', 'mainwp');
        if (count($total_wp_upgrades) > 1) {
            ?>
s<?php 
        }
        ?>
 <?php 
        _e('available', 'mainwp');
        ?>
</span>
            <span class="mainwp-mid-col">&nbsp;</span>
            <span class="mainwp-right-col">
                <a href="#" id="mainwp_upgrades_show" onClick="return rightnow_show('upgrades');"><i class="fa fa-eye-slash"></i> <?php 
        _e('Show', 'mainwp');
        ?>
</a>
                <?php 
        if (mainwp_current_user_can("dashboard", "update_wordpress")) {
            if ($total_wp_upgrades > 0) {
                ?>
                    &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 
        @MainWPDB::data_seek($websites, 0);
        while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
            if ($website->is_ignoreCoreUpdates) {
                continue;
            }
            $wp_upgrades = json_decode(MainWPDB::Instance()->getWebsiteOption($website, 'wp_upgrades'), true);
            if (count($wp_upgrades) == 0 && $website->sync_errors == '') {
                continue;
            }
            ?>
                <div class="mainwp-row mainwp_wordpress_upgrade" site_id="<?php 
            echo $website->id;
            ?>
" site_name="<?php 
            echo rawurlencode($website->name);
            ?>
" updated="<?php 
            echo count($wp_upgrades) > 0 ? '0' : '1';
            ?>
">
                    <span class="mainwp-left-col"><a href="<?php 
            echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
            ?>
"><?php 
            echo stripslashes($website->name);
            ?>
</a><input type="hidden" id="wp_upgraded_<?php 
            echo $website->id;
            ?>
" value="<?php 
            if (count($wp_upgrades) > 0) {
                echo '0';
            } else {
                echo '1';
            }
            ?>
"/></span>
                    <span class="mainwp-mid-col wordpressInfo" id="wp_upgrade_<?php 
            echo $website->id;
            ?>
"><?php 
            if (count($wp_upgrades) > 0) {
                echo $wp_upgrades['current'] . " to " . $wp_upgrades['new'];
            } else {
                if ($website->sync_errors != '') {
                    echo __('Site Error - No update Information available', 'mainwp');
                } else {
                    echo __("Hooray, No Updates Available!", 'mainwp');
                }
            }
            ?>
</span>
                    <span class="mainwp-right-col wordpressAction"><div id="wp_upgradebuttons_<?php 
            echo $website->id;
            ?>
">
                        <?php 
            if (mainwp_current_user_can("dashboard", "update_wordpress")) {
                if (count($wp_upgrades) > 0) {
                    ?>
                                    <a href="#" class="mainwp-upgrade-button button" onClick="rightnow_upgrade(<?php 
                    echo $website->id;
                    ?>
)"><?php 
                    _e('Upgrade', 'mainwp');
                    ?>
</a>
                                <?php 
                }
            }
            ?>
   
                        &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"><span class="mainwp-rightnow-number"><?php 
        echo $total_plugin_upgrades;
        ?>
 </span> <?php 
        _e('Plugin upgrade', 'mainwp');
        if ($total_plugin_upgrades > 1) {
            ?>
s<?php 
        }
        ?>
 <?php 
        _e('available', 'mainwp');
        ?>
</span>
            <span class="mainwp-mid-col"><a href="<?php 
        echo admin_url('admin.php?page=PluginsIgnore');
        ?>
"><?php 
        _e('Ignored', 'mainwp');
        ?>
 (<?php 
        echo $total_pluginsIgnored;
        ?>
)</a></span>            
            <span class="mainwp-right-col"><a href="#" id="mainwp_plugin_upgrades_show" onClick="return rightnow_show('plugin_upgrades');"><i class="fa fa-eye-slash"></i> <?php 
        _e('Show', 'mainwp');
        ?>
</a> <?php 
        if (mainwp_current_user_can("dashboard", "update_plugins")) {
            if ($total_plugin_upgrades > 0 && $userExtension->site_view == 1) {
                ?>
&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) {
            @MainWPDB::data_seek($websites, 0);
            while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                if ($website->is_ignorePluginUpdates) {
                    continue;
                }
                $plugin_upgrades = json_decode($website->plugin_upgrades, true);
                $decodedPremiumUpgrades = json_decode(MainWPDB::Instance()->getWebsiteOption($website, 'premium_upgrades'), true);
                if (is_array($decodedPremiumUpgrades)) {
                    foreach ($decodedPremiumUpgrades as $crrSlug => $premiumUpgrade) {
                        $premiumUpgrade['premium'] = true;
                        if ($premiumUpgrade['type'] == 'plugin') {
                            if (!is_array($plugin_upgrades)) {
                                $plugin_upgrades = array();
                            }
                            $plugin_upgrades[$crrSlug] = $premiumUpgrade;
                        }
                    }
                }
                $ignored_plugins = json_decode($website->ignored_plugins, true);
                if (is_array($ignored_plugins)) {
                    $plugin_upgrades = array_diff_key($plugin_upgrades, $ignored_plugins);
                }
                $ignored_plugins = json_decode($userExtension->ignored_plugins, true);
                if (is_array($ignored_plugins)) {
                    $plugin_upgrades = array_diff_key($plugin_upgrades, $ignored_plugins);
                }
                if ($globalView) {
                    ?>
                <div class="mainwp-row">
                    <span class="mainwp-left-col"><a href="<?php 
                    echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
                    ?>
"><?php 
                    echo stripslashes($website->name);
                    ?>
</a><input type="hidden" id="wp_upgraded_plugin_<?php 
                    echo $website->id;
                    ?>
" value="<?php 
                    if (count($plugin_upgrades) > 0) {
                        echo '0';
                    } else {
                        echo '1';
                    }
                    ?>
"/></span>
                    <span class="mainwp-mid-col" id="wp_upgrade_plugin_<?php 
                    echo $website->id;
                    ?>
">
                        <?php 
                    if (count($plugin_upgrades) > 0) {
                        ?>
                            <a href="#" id="mainwp_plugin_upgrades_<?php 
                        echo $website->id;
                        ?>
_show" onClick="return rightnow_show('plugin_upgrades_<?php 
                        echo $website->id;
                        ?>
', true);"><?php 
                        echo count($plugin_upgrades);
                        ?>
 <?php 
                        _e('Upgrade', 'mainwp');
                        echo count($plugin_upgrades) > 1 ? 's' : '';
                        ?>
</a>
                        <?php 
                    } else {
                        if ($website->sync_errors != '') {
                            echo __('Site Error - No update Information available', 'mainwp');
                        } else {
                            echo __("Hooray, No Updates Available!", 'mainwp');
                        }
                    }
                    ?>
                    </span>
                    <span class="mainwp-right-col"><div id="wp_upgradebuttons_plugin_<?php 
                    echo $website->id;
                    ?>
">
                        <?php 
                    if (mainwp_current_user_can("dashboard", "update_plugins")) {
                        if (count($plugin_upgrades) > 0) {
                            ?>
                                    <a href="#" class="mainwp-upgrade-button button" onClick="return rightnow_upgrade_plugin_all(<?php 
                            echo $website->id;
                            ?>
)"><?php 
                            echo _n('Upgrade', 'Upgrade All', count($plugin_upgrades), 'mainwp');
                            ?>
</a> &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($plugin_upgrade['PluginURI']) ? rawurlencode($plugin_upgrade['PluginURI']) : '') . '&name=' . rawurlencode($plugin_upgrade['Name']) . '&TB_iframe=true&width=640&height=477';
                    ?>
" target="_blank"
                                                                                                                        class="thickbox" title="More information about <?php 
                    echo $pluginsInfo[$slug]['name'];
                    ?>
">
                                <?php 
                    echo $pluginsInfo[$slug]['name'];
                    ?>
                            </a>
                        </span>
                        <span class="mainwp-mid-col">
                            <a href="#" onClick="return rightnow_plugins_detail('<?php 
                    echo $plugin_name;
                    ?>
');">
                                <?php 
                    echo $cnt;
                    ?>
 <?php 
                    _e('Upgrade', 'mainwp');
                    echo $cnt > 1 ? 's' : '';
                    ?>
                            </a>
                        </span>
                        <span class="mainwp-right-col">
                            <?php 
                    if (mainwp_current_user_can("dashboard", "ignore_unignore_updates")) {
                        ?>
                                <a href="#" class="button" onClick="return rightnow_plugins_ignore_all('<?php 
                        echo $plugin_name;
                        ?>
', '<?php 
                        echo urlencode($pluginsInfo[$slug]['name']);
                        ?>
')"><?php 
                        _e('Ignore Globally', 'mainwp');
                        ?>
</a>
                            <?php 
                    }
                    ?>
                            <?php 
                    if (mainwp_current_user_can("dashboard", "update_plugins")) {
                        ?>
                                &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 
                @MainWPDB::data_seek($websites, 0);
                while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                    if ($website->is_ignorePluginUpdates) {
                        continue;
                    }
                    $plugin_upgrades = json_decode($website->plugin_upgrades, true);
                    $decodedPremiumUpgrades = json_decode(MainWPDB::Instance()->getWebsiteOption($website, 'premium_upgrades'), true);
                    if (is_array($decodedPremiumUpgrades)) {
                        foreach ($decodedPremiumUpgrades as $crrSlug => $premiumUpgrade) {
                            $premiumUpgrade['premium'] = true;
                            if ($premiumUpgrade['type'] == 'plugin') {
                                if (!is_array($plugin_upgrades)) {
                                    $plugin_upgrades = array();
                                }
                                $plugin_upgrades[$crrSlug] = $premiumUpgrade;
                            }
                        }
                    }
                    $ignored_plugins = json_decode($website->ignored_plugins, true);
                    if (is_array($ignored_plugins)) {
                        $plugin_upgrades = array_diff_key($plugin_upgrades, $ignored_plugins);
                    }
                    if (!isset($plugin_upgrades[$slug])) {
                        continue;
                    }
                    $plugin_upgrade = $plugin_upgrades[$slug];
                    ?>
                            <div class="mainwp-row" site_id="<?php 
                    echo $website->id;
                    ?>
" site_name="<?php 
                    echo rawurlencode($website->name);
                    ?>
" updated="0">
                                <span class="mainwp-left-col">
                                    <?php 
                    if ($globalView) {
                        ?>
                                    &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"><span class="mainwp-rightnow-number"><?php 
        echo $total_theme_upgrades;
        ?>
 </span> <?php 
        _e('Theme upgrade', 'mainwp');
        if ($total_theme_upgrades > 1) {
            ?>
s<?php 
        }
        ?>
 <?php 
        _e('available', 'mainwp');
        ?>
</span>
            <span class="mainwp-mid-col"><a href="<?php 
        echo admin_url('admin.php?page=ThemesIgnore');
        ?>
"><?php 
        _e('Ignored', 'mainwp');
        ?>
 (<?php 
        echo $total_themesIgnored;
        ?>
)</a></span>            
            <span class="mainwp-right-col"><a href="#" id="mainwp_theme_upgrades_show" onClick="return rightnow_show('theme_upgrades');"><i class="fa fa-eye-slash"></i> <?php 
        _e('Show', 'mainwp');
        ?>
</a> 
                <?php 
        if (mainwp_current_user_can("dashboard", "update_themes")) {
            ?>
                    <?php 
            if ($total_theme_upgrades > 0 && $userExtension->site_view == 1) {
                ?>
&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) {
            @MainWPDB::data_seek($websites, 0);
            while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                if ($website->is_ignoreThemeUpdates) {
                    continue;
                }
                $theme_upgrades = json_decode($website->theme_upgrades, true);
                $decodedPremiumUpgrades = json_decode(MainWPDB::Instance()->getWebsiteOption($website, 'premium_upgrades'), true);
                if (is_array($decodedPremiumUpgrades)) {
                    foreach ($decodedPremiumUpgrades as $crrSlug => $premiumUpgrade) {
                        $premiumUpgrade['premium'] = true;
                        if ($premiumUpgrade['type'] == 'theme') {
                            if (!is_array($theme_upgrades)) {
                                $theme_upgrades = array();
                            }
                            $theme_upgrades[$crrSlug] = $premiumUpgrade;
                        }
                    }
                }
                $ignored_themes = json_decode($website->ignored_themes, true);
                if (is_array($ignored_themes)) {
                    $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes);
                }
                $ignored_themes = json_decode($userExtension->ignored_themes, true);
                if (is_array($ignored_themes)) {
                    $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes);
                }
                if ($globalView) {
                    ?>
                <div class="mainwp-row">
                    <span class="mainwp-left-col"><a href="<?php 
                    echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
                    ?>
"><?php 
                    echo stripslashes($website->name);
                    ?>
</a><input type="hidden" id="wp_upgraded_theme_<?php 
                    echo $website->id;
                    ?>
" value="<?php 
                    if (count($theme_upgrades) > 0) {
                        echo '0';
                    } else {
                        echo '1';
                    }
                    ?>
"/></span>
                    <span class="mainwp-mid-col" id="wp_upgrade_theme_<?php 
                    echo $website->id;
                    ?>
">
                        <?php 
                    if (count($theme_upgrades) > 0) {
                        ?>
                            <a href="#" id="mainwp_theme_upgrades_<?php 
                        echo $website->id;
                        ?>
_show" onClick="return rightnow_show('theme_upgrades_<?php 
                        echo $website->id;
                        ?>
', true);"><?php 
                        echo count($theme_upgrades);
                        ?>
 <?php 
                        _e('Upgrade', 'mainwp');
                        echo count($theme_upgrades) > 1 ? 's' : '';
                        ?>
</a>
                        <?php 
                    } else {
                        if ($website->sync_errors != '') {
                            echo __('Site Error - No update Information available', 'mainwp');
                        } else {
                            echo __("Hooray, No Updates Available!", 'mainwp');
                        }
                    }
                    ?>
                    </span>
                    <span class="mainwp-right-col">
                        <div id="wp_upgradebuttons_theme_<?php 
                    echo $website->id;
                    ?>
"> 
                        <?php 
                    if (mainwp_current_user_can("dashboard", "update_themes")) {
                        ?>
                        <?php 
                        if (count($theme_upgrades) > 0) {
                            ?>
 
                            <a href="#" class="mainwp-upgrade-button button" onClick="return rightnow_upgrade_theme_all(<?php 
                            echo $website->id;
                            ?>
)"><?php 
                            echo _n('Upgrade', 'Upgrade All', count($theme_upgrades), 'mainwp');
                            ?>
</a> &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 urlencode($themesInfo[$slug]['name']);
                    ?>
" premium="<?php 
                    echo $themesInfo[$slug]['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 
                    _e('Upgrade', 'mainwp');
                    echo $cnt > 1 ? 's' : '';
                    ?>
                            </a>
                        </span>
                        <span class="mainwp-right-col">
                            <?php 
                    if (mainwp_current_user_can("dashboard", "ignore_unignore_updates")) {
                        ?>
                            <a href="#" class="button" onClick="return rightnow_themes_ignore_all('<?php 
                        echo $theme_name;
                        ?>
', '<?php 
                        echo urlencode($themesInfo[$slug]['name']);
                        ?>
')"><?php 
                        _e('Ignore Globally', 'mainwp');
                        ?>
</a>
                            <?php 
                    }
                    ?>
                            <?php 
                    if (mainwp_current_user_can("dashboard", "update_themes")) {
                        ?>
                            &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 
                @MainWPDB::data_seek($websites, 0);
                while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                    if ($website->is_ignoreThemeUpdates) {
                        continue;
                    }
                    $theme_upgrades = json_decode($website->theme_upgrades, true);
                    $decodedPremiumUpgrades = json_decode(MainWPDB::Instance()->getWebsiteOption($website, 'premium_upgrades'), true);
                    if (is_array($decodedPremiumUpgrades)) {
                        foreach ($decodedPremiumUpgrades as $crrSlug => $premiumUpgrade) {
                            $premiumUpgrade['premium'] = true;
                            if ($premiumUpgrade['type'] == 'theme') {
                                if (!is_array($theme_upgrades)) {
                                    $theme_upgrades = array();
                                }
                                $theme_upgrades[$crrSlug] = $premiumUpgrade;
                            }
                        }
                    }
                    $ignored_themes = json_decode($website->ignored_themes, true);
                    if (is_array($ignored_themes)) {
                        $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes);
                    }
                    if (!isset($theme_upgrades[$slug])) {
                        continue;
                    }
                    $theme_upgrade = $theme_upgrades[$slug];
                    ?>
                            <div class="mainwp-row" site_id="<?php 
                    echo $website->id;
                    ?>
" site_name="<?php 
                    echo rawurlencode($website->name);
                    ?>
" updated="0">
                                <span class="mainwp-left-col">
                                    <?php 
                    if ($globalView) {
                        ?>
                                    &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 
        //Sync errors!
        if ($total_sync_errors > 0) {
            ?>
        <div class="clear">
            <div class="mainwp-row">
                <span class="mainwp-left-col"><span class="mainwp-rightnow-number"><?php 
            echo $total_sync_errors;
            ?>
</span> Error<?php 
            if ($total_sync_errors > 1) {
                ?>
s<?php 
            }
            ?>
</span>
                <span class="mainwp-mid-col">&nbsp;</span>
                <span class="mainwp-right-col"><a href="#" id="mainwp_errors_show" onClick="return rightnow_show('errors');"><i class="fa fa-eye-slash"></i> <?php 
            _e('Show', 'mainwp');
            ?>
</a></span>
            </div>
            <div id="wp_errors" style="display: none">
                <?php 
            @MainWPDB::data_seek($websites, 0);
            while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                if ($website->sync_errors == '') {
                    continue;
                }
                ?>
                <div class="mainwp-row">
                    <span class="mainwp-left-col"><a href="<?php 
                echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
                ?>
"><?php 
                echo stripslashes($website->name);
                ?>
</a></span>
                    <span class="mainwp-mid-col"><?php 
                echo $website->sync_errors;
                ?>
</span>
                    <span class="mainwp-right-col"><a href="#" class="mainwp_rightnow_site_reconnect" siteid="<?php 
                echo $website->id;
                ?>
"><?php 
                _e('Reconnect', 'mainwp');
                ?>
</a> | <a href="<?php 
                echo $website->url;
                ?>
" target="_blank"><?php 
                _e('Open', 'mainwp');
                ?>
</a></span>
                </div>
                <?php 
            }
            ?>
            </div>
        </div>
        <?php 
        }
        ?>

    <?php 
        //Good - some are up to date!
        if ($total_uptodate > 0) {
            ?>
        <div class="clear">
            <div class="mainwp-row">
                <span class="mainwp-left-col"><span class="mainwp-rightnow-number"><?php 
            echo $total_uptodate;
            ?>
</span> <?php 
            _e('Up to date', 'mainwp');
            ?>
</span>
                <span class="mainwp-mid-col">&nbsp;</span>
                <span class="mainwp-right-col"><a href="#" id="mainwp_uptodate_show" onClick="return rightnow_show('uptodate');"><i class="fa fa-eye-slash"></i> <?php 
            _e('Show', 'mainwp');
            ?>
</a></span>
            </div>
            <div id="wp_uptodate" style="display: none">
                <?php 
            @MainWPDB::data_seek($websites, 0);
            while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                if ($website->uptodate != 1) {
                    continue;
                }
                ?>
                <div class="mainwp-row">
                    <span class="mainwp-left-col"><a href="<?php 
                echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
                ?>
"><?php 
                echo stripslashes($website->name);
                ?>
</a></span>
                    <span class="mainwp-mid-col">&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 
        @MainWPDB::data_seek($websites, 0);
        $site_ids = array();
        while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
            $site_ids[] = $website->id;
        }
        do_action('mainwp_rightnow_widget_bottom', $site_ids, $globalView);
        ?>
        <div class="clear">
            <div class="mainwp-row">
                <span class="mainwp-left-col"><span class="mainwp-rightnow-number">
                    <img class="down-img" style="margin-bottom: -3px;" title="<?php 
        echo $total_sync_errors > 0 ? 'Site Disconnected' : ($total_conflict > 0 ? 'Plugin or Theme Conflict Found' : ($total_offline > 0 ? 'Site is Offline' : 'Site is Online'));
        ?>
" alt="<?php 
        echo $total_sync_errors > 0 ? 'Sync errors' : ($total_conflict > 0 ? 'Conflict Found' : ($total_offline > 0 ? 'Site Down' : 'Site Up'));
        ?>
" src="<?php 
        echo plugins_url('images/' . ($total_sync_errors > 0 ? 'disconnected' : ($total_conflict > 0 ? 'conflict' : ($total_offline > 0 ? 'down' : 'up'))) . '.png', dirname(__FILE__));
        ?>
" /></span> <span style="font-size: 18px !important;"><?php 
        _e('Status', 'mainwp');
        ?>
</span></span>
                <span class="mainwp-mid-col">&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++) {
            @MainWPDB::data_seek($websites, 0);
            while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                $pluginConflicts = json_decode($website->pluginConflicts, true);
                $themeConflicts = json_decode($website->themeConflicts, true);
                $ignoredPluginConflicts = json_decode($website->ignored_pluginConflicts, true);
                if (!is_array($ignoredPluginConflicts)) {
                    $ignoredPluginConflicts = array();
                }
                $ignoredThemeConflicts = json_decode($website->ignored_themeConflicts, true);
                if (!is_array($ignoredThemeConflicts)) {
                    $ignoredThemeConflicts = array();
                }
                $hasSyncErrors = $website->sync_errors != '';
                $isConflict = false;
                if (!$hasSyncErrors) {
                    if (count($pluginConflicts) > 0) {
                        foreach ($pluginConflicts as $pluginConflict) {
                            if (!in_array($pluginConflict, $ignoredPluginConflicts) && !in_array($pluginConflict, $globalIgnoredPluginConflicts)) {
                                $isConflict = true;
                            }
                        }
                    }
                    if (!$isConflict && count($themeConflicts) > 0) {
                        foreach ($themeConflicts as $themeConflict) {
                            if (!in_array($themeConflict, $ignoredThemeConflicts) && !in_array($themeConflict, $globalIgnoredThemeConflicts)) {
                                $isConflict = true;
                            }
                        }
                    }
                }
                $isDown = !$hasSyncErrors && !$isConflict && $website->offline_check_result == -1;
                $isUp = !$hasSyncErrors && !$isConflict && !$isDown;
                if ($j == $SYNCERRORS && !$hasSyncErrors) {
                    continue;
                }
                if ($j == $CONFLICTS && !$isConflict) {
                    continue;
                }
                if ($j == $DOWN && !$isDown) {
                    continue;
                }
                if ($j == $UP && !$isUp) {
                    continue;
                }
                ?>
                    <div class="mainwp-row">
                        <span class="mainwp-left-col"><a href="<?php 
                echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
                ?>
"><?php 
                echo stripslashes($website->name);
                ?>
</a></span>
                        <span class="mainwp-mid-col">&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;"><a href="#" class="mainwp_rightnow_site_reconnect" siteid="<?php 
                    echo $website->id;
                    ?>
"><?php 
                    _e('Reconnect', 'mainwp');
                    ?>
</a><br /></div> <img class="down-img" title="Site Disconnected" alt="Sync Errors" src="<?php 
                    echo plugins_url('images/disconnected.png', dirname(__FILE__));
                    ?>
" />
                                    <?php 
                } else {
                    if ($isConflict) {
                        ?>
                                    <img class="down-img" title="Plugin or Theme Conflict Found" alt="Conflict Found" src="<?php 
                        echo plugins_url('images/conflict.png', dirname(__FILE__));
                        ?>
" />
                                    <?php 
                    } else {
                        if ($isDown) {
                            ?>
                                    <img class="down-img" title="Site is Offline" alt="Site Down" src="<?php 
                            echo plugins_url('images/down.png', dirname(__FILE__));
                            ?>
" />
                                    <?php 
                        } else {
                            ?>
                                    <img class="down-img" title="Site is Online" alt="Site Up" src="<?php 
                            echo plugins_url('images/up.png', dirname(__FILE__));
                            ?>
" />
                                    <?php 
                        }
                    }
                }
                ?>
                        </span>
                    </div>
                    <?php 
            }
        }
        ?>
            </div>
        </div>   
    
    <div class="clear"></div>

    <div id="rightnow-upgrade-status-box" title="Upgrade" style="display: none; text-align: center">
        <div id="rightnow-upgrade-status-progress"></div>
        <span id="rightnow-upgrade-status-current">0</span> / <span id="rightnow-upgrade-status-total"></span> <?php 
        _e('upgraded', 'mainwp');
        ?>
        <div style="height: 160px; overflow: auto; margin-top: 20px; margin-bottom: 10px; text-align: left">
            <table style="width: 100%" id="rightnow-upgrade-list">
            </table>
        </div>
        <input id="rightnow-upgrade-status-close" type="button" name="Close" value="<?php 
        _e('Close', 'mainwp');
        ?>
" class="button" />
    </div>

    <div id="rightnow-backup-box" title="Full backup required" style="display: none; text-align: center">
        <div style="height: 190px; overflow: auto; margin-top: 20px; margin-bottom: 10px; text-align: left" id="rightnow-backup-content">
        </div>
        <input id="rightnow-backup-all" type="button" name="Backup All" value="<?php 
        _e('Backup All', 'mainwp');
        ?>
" class="button-primary" />
        <input id="rightnow-backup-ignore" type="button" name="Ignore" value="<?php 
        _e('Ignore', 'mainwp');
        ?>
" class="button" />
    </div>

    <div id="rightnow-backupnow-box" title="Full backup" style="display: none; text-align: center">
        <div style="height: 190px; overflow: auto; margin-top: 20px; margin-bottom: 10px; text-align: left" id="rightnow-backupnow-content">
        </div>
        <input id="rightnow-backupnow-close" type="button" name="Ignore" value="<?php 
        _e('Cancel', 'mainwp');
        ?>
" class="button" />
    </div>

    <?php 
        @MainWPDB::free_result($websites);
    }
Exemplo n.º 21
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');
    }
 function column_backup($item)
 {
     $backupnow_lnk = apply_filters('mainwp-managesites-getbackuplink', '', $item['id']);
     if (!empty($backupnow_lnk)) {
         return $backupnow_lnk;
     }
     $dir = MainWP_Utility::getMainWPSpecificDir($item['id']);
     $lastbackup = 0;
     if (file_exists($dir) && ($dh = opendir($dir))) {
         while (($file = readdir($dh)) !== false) {
             if ($file != '.' && $file != '..') {
                 $theFile = $dir . $file;
                 if (MainWP_Utility::isArchive($file) && !MainWP_Utility::isSQLArchive($file)) {
                     if (filemtime($theFile) > $lastbackup) {
                         $lastbackup = filemtime($theFile);
                     }
                 }
             }
         }
         closedir($dh);
     }
     $output = '';
     if ($lastbackup > 0) {
         $output = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($lastbackup)) . '<br />';
     } else {
         $output = '<span class="mainwp-red">Never</span><br/>';
     }
     if (mainwp_current_user_can('dashboard', 'execute_backups')) {
         $output .= sprintf('<a href="admin.php?page=managesites&backupid=%s">' . '<i class="fa fa-hdd-o"></i> ' . __('Backup Now', 'mainwp') . '</a>', $item['id']);
     }
     return $output;
 }
Exemplo n.º 23
0
 /**
  * @param string $pluginFile Extension plugin file to verify
  * @param string $key The child-key
  * @param int $groupid The id of the group you wish to retrieve
  * @param bool $for_manager
  *
  * @return array|bool An array of arrays, the inner-array contains the id/name/array of site ids for the supplied groupid/all groups. False when something goes wrong.
  */
 public static function hookGetGroups($pluginFile, $key, $groupid, $for_manager = false)
 {
     if (!self::hookVerify($pluginFile, $key)) {
         return false;
     }
     if ($for_manager && (!defined('MWP_TEAMCONTROL_PLUGIN_SLUG') || !mainwp_current_user_can('extension', dirname(MWP_TEAMCONTROL_PLUGIN_SLUG)))) {
         return false;
     }
     if (isset($groupid)) {
         $group = MainWP_DB::Instance()->getGroupById($groupid);
         if (!MainWP_Utility::can_edit_group($group)) {
             return false;
         }
         $websites = MainWP_DB::Instance()->getWebsitesByGroupId($group->id);
         $websitesOut = array();
         foreach ($websites as $website) {
             $websitesOut[] = $website->id;
         }
         return array(array('id' => $groupid, 'name' => $group->name, 'websites' => $websitesOut));
     }
     $groups = MainWP_DB::Instance()->getGroupsAndCount(null, $for_manager);
     $output = array();
     foreach ($groups as $group) {
         $websites = MainWP_DB::Instance()->getWebsitesByGroupId($group->id);
         $websitesOut = array();
         foreach ($websites as $website) {
             if (in_array($website->id, $websitesOut)) {
                 continue;
             }
             $websitesOut[] = $website->id;
         }
         $output[] = array('id' => $group->id, 'name' => $group->name, 'websites' => $websitesOut);
     }
     return $output;
 }
Exemplo n.º 24
0
    public static function render()
    {
        $currentExtensions = self::$extensionsLoaded ? self::$extensions : get_option('mainwp_extensions');
        if (count($currentExtensions) == 0) {
            ?>
            <span class="mainwp-no-extensions">
                <div class="mainwp_info-box-yellow"><?php 
            _e('You have no installed extensions.', 'mainwp');
            ?>
</div><br/>
                <div style="text-align: center"><a href="https://extensions.mainwp.com/" target="_blank" class="button button-hero button-primary"><?php 
            _e('Add an Extension Today', 'mainwp');
            ?>
</a></div><br/>
                <h3 style="color: #7fb100;"><?php 
            _e('What are Extensions?', 'mainwp');
            ?>
</h3>
                <p><?php 
            _e('MainWP Extensions are specific features or tools created for the purpose of expanding the basic functionality of the MainWP plugin.', 'mainwp');
            ?>
</p>
                <h3 style="color: #7fb100;"><?php 
            _e('Why have Extensions?', 'mainwp');
            ?>
</h3>
                <p><?php 
            _e('The core of MainWP has been designed to provide the functions most needed by our users and minimize code bloat. Extensions offer custom functions and features so that each user can tailor their MainWP to their specific needs.', 'mainwp');
            ?>
</p>
            </span>
            <?php 
        } else {
            $showGrid = get_option('mainwp_extension_widget_view', 'grid') == 'grid';
            $showList = !$showGrid;
            ?>
          <br />
          <div id="mainwp-extensions-widget-grid" <?php 
            echo !$showGrid ? "style='display:none;'" : '';
            ?>
>
            <?php 
            foreach ($currentExtensions as $extension) {
                if (!mainwp_current_user_can("extension", dirname($extension['slug']))) {
                    continue;
                }
                if (isset($extension['direct_page']) && !empty($extension['direct_page'])) {
                    $ext_page = $extension['direct_page'];
                } else {
                    $ext_page = $extension['page'];
                }
                $active = MainWPExtensions::isExtensionEnabled($extension['plugin']);
                ?>
        	    	<span class="mainwp-widget-extensions">
                    <?php 
                if (isset($extension['iconURI']) && $extension['iconURI'] != '') {
                    ?>
<a href="<?php 
                    echo $active ? admin_url('admin.php?page=' . $ext_page) : '';
                    ?>
" style="<?php 
                    echo $active ? '' : 'pointer-events: none;';
                    ?>
"><img title="<?php 
                    echo $extension['name'];
                    ?>
" src="<?php 
                    echo MainWPUtility::removeHttpPrefix($extension['iconURI']);
                    ?>
" class="mainwp-widget-icon <?php 
                    echo $active ? '' : 'mainwp-extension-icon-desaturated';
                    ?>
" /></a><?php 
                } else {
                    ?>
<a href="<?php 
                    echo $active ? admin_url('admin.php?page=' . $ext_page) : '';
                    ?>
" style="<?php 
                    echo $active ? '' : 'pointer-events: none;';
                    ?>
"><img title="MainWP Placeholder" src="<?php 
                    echo plugins_url('images/extensions/placeholder.png', dirname(__FILE__));
                    ?>
" class="mainwp-widget-icon <?php 
                    echo $active ? '' : 'mainwp-extension-icon-desaturated';
                    ?>
" /></a><?php 
                }
                ?>
                    <h4><a href="<?php 
                echo $active ? admin_url('admin.php?page=' . $ext_page) : '';
                ?>
" style="<?php 
                echo $active ? '' : 'pointer-events: none;';
                ?>
"><?php 
                echo $extension['name'];
                ?>
</a></h4>
                    </span>
                    <?php 
            }
            ?>
           </div><div style="clear: both"></div>

          <table id="mainwp-extensions-widget-list" cellspacing="0" cellpadding="1" <?php 
            echo !$showList ? "style='display:none;'" : '';
            ?>
>
            <tbody>
                <?php 
            foreach ($currentExtensions as $extension) {
                if (!mainwp_current_user_can("extension", dirname($extension['slug']))) {
                    continue;
                }
                if (isset($extension['direct_page']) && !empty($extension['direct_page'])) {
                    $ext_page = $extension['direct_page'];
                } else {
                    $ext_page = $extension['page'];
                }
                $active = MainWPExtensions::isExtensionEnabled($extension['plugin']);
                ?>
                     <tr class="mainwp-widget-extensions-list mainwp-extensions-childHolder" extension_slug="<?php 
                echo $extension['slug'];
                ?>
">
                       <?php 
                if (isset($extension['iconURI']) && $extension['iconURI'] != '') {
                    ?>
                             <td><a href="<?php 
                    echo $active ? admin_url('admin.php?page=' . $ext_page) : '';
                    ?>
" style="<?php 
                    echo $active ? '' : 'pointer-events: none;';
                    ?>
"><img title="<?php 
                    echo $extension['name'];
                    ?>
" src="<?php 
                    echo MainWPUtility::removeHttpPrefix($extension['iconURI']);
                    ?>
" class="mainwp-widget-icon-list <?php 
                    echo $active ? '' : 'mainwp-extension-icon-desaturated';
                    ?>
" /></a></td><td class="mainwp-extension-widget-title-list"><a href="<?php 
                    echo $active ? admin_url('admin.php?page=' . $ext_page) : '';
                    ?>
" style="<?php 
                    echo $active ? '' : 'pointer-events: none;';
                    ?>
"><?php 
                    echo $extension['name'];
                    ?>
</a></td><td class="mainwp-extension-widget-version"><?php 
                    echo $extension['version'];
                    ?>
</td>
                             <td class="mainwp-api-status-check" align="right" style="padding-right: 10px;">
                              <?php 
                    if (isset($extension['apiManager']) && $extension['apiManager'] && !empty($extension['api_key'])) {
                        ?>
                                        <span style="color: #7fb100;"><i class="fa fa-unlock"></i> <?php 
                        _e('Activated', 'mainwp');
                        ?>
</span>
                                   <?php 
                    } else {
                        ?>
                                        <span style="color: #a00;"><i class="fa fa-lock"></i> <?php 
                        _e('Deactivated', 'mainwp');
                        ?>
</span>
                                          <?php 
                    }
                    ?>
                                    </td>
                                    <?php 
                } else {
                    ?>
                           <td><a href="<?php 
                    echo $active ? admin_url('admin.php?page=' . $ext_page) : '';
                    ?>
" style="<?php 
                    echo $active ? '' : 'pointer-events: none;';
                    ?>
"><img title="MainWP Placeholder" src="<?php 
                    echo plugins_url('images/extensions/placeholder.png', dirname(__FILE__));
                    ?>
" class="mainwp-widget-icon-list <?php 
                    echo $active ? '' : 'mainwp-extension-icon-desaturated';
                    ?>
" /></a></td><td class="mainwp-extension-widget-title-list"><a href="<?php 
                    echo $active ? admin_url('admin.php?page=' . $ext_page) : '';
                    ?>
" style="<?php 
                    echo $active ? '' : 'pointer-events: none;';
                    ?>
"><?php 
                    echo $extension['name'];
                    ?>
</a></td><td class="mainwp-extension-widget-version"><?php 
                    echo $extension['version'];
                    ?>
</td>
                           <td class="mainwp-api-status-check" align="right" style="padding-right: 10px;">
                              <?php 
                    if (isset($extension['apiManager']) && $extension['apiManager'] && !empty($extension['api_key'])) {
                        ?>
                                        <span style="color: #7fb100;"><i class="fa fa-unlock"></i> <?php 
                        _e('Activated', 'mainwp');
                        ?>
</span>
                              <?php 
                    } else {
                        ?>
                                        <span style="color: #a00;"><i class="fa fa-lock"></i> <?php 
                        _e('Deactivated', 'mainwp');
                        ?>
</span>
                                          <?php 
                    }
                    ?>
                        </td>
                        <?php 
                }
                ?>
                    </tr>
                <?php 
            }
            ?>
            </tbody>
            </table>
            <div style="clear: both; text-align: left; font-size: 12px; padding: .5em; border-top: 1px solid #dfdfdf;"><a href="https://extensions.mainwp.com/" target="_blank" class="button mainwp-upgrade-button"><?php 
            _e('GET MORE EXTENSIONS', 'mainwp');
            ?>
</a><span style="float: right;"><a href="#" class="mainwp-extension-widget-switch-grid" <?php 
            echo !$showList ? "style='display:none;'" : '';
            ?>
><?php 
            _e('Show Grid View', 'mainwp');
            ?>
</a><a href="#" class="mainwp-extension-widget-switch-list" <?php 
            echo !$showGrid ? "style='display:none;'" : '';
            ?>
><?php 
            _e('Show List View', 'mainwp');
            ?>
</a></span></div><?php 
        }
    }
Exemplo n.º 25
0
    function on_show_page()
    {
        if (!mainwp_current_user_can('dashboard', 'access_global_dashboard')) {
            mainwp_do_not_have_permissions(__('global dashboard', 'mainwp'));
            return;
        }
        global $screen_layout_columns;
        ?>
		<div id="mainwp_tab-general" class="wrap">
			<a href="https://mainwp.com" id="mainwplogo" title="MainWP" target="_blank"><img src="<?php 
        echo plugins_url('images/logo.png', dirname(__FILE__));
        ?>
" height="50" alt="MainWP"/></a>

			<h2><i class="fa fa-tachometer"></i> <?php 
        _e('MainWP Dashboard', 'mainwp');
        ?>
</h2>

			<div style="clear: both;"></div>
			<br/><br/>
			<?php 
        if (MainWP_Utility::showUserTip('mainwp-dashboard-tips')) {
            ?>
				<div id="mainwp-tip-zone">
					<div class="mainwp-tips mainwp_info-box-blue">
						<span class="mainwp-tip" id="mainwp-dashboard-tips"><strong><?php 
            _e('MainWP Tip', 'mainwp');
            ?>
: </strong><?php 
            _e('You can move the Widgets around to fit your needs and even adjust the number of columns by selecting "Screen Options" on the top right.', 'mainwp');
            ?>
</span><span><a href="#" class="mainwp-dismiss"><i class="fa fa-times-circle"></i> <?php 
            _e('Dismiss', 'mainwp');
            ?>
							</a></span></div>
				</div>
			<?php 
        }
        ?>

			<?php 
        $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser(false, null, 'wp_sync.dtsSync DESC, wp.url ASC'));
        self::renderDashboardBody($websites, $this->dashBoard, $screen_layout_columns);
        @MainWP_DB::free_result($websites);
        ?>
		</div>
		<?php 
    }
Exemplo n.º 26
0
    public static function render(&$extensions)
    {
        $loader_url = '<i class="fa fa-spinner fa-pulse"></i>';
        if (mainwp_current_user_can('dashboard', 'manage_extensions')) {
            ?>

		<?php 
        }
        ?>
		<div class="postbox">
		<div class="handlediv"><br></div>
		<h3 class="mainwp_box_title">
			<span><?php 
        printf(_n('%d Installed MainWP Extension', '%d Installed MainWP Extensions', count($extensions) == 1 ? 1 : 2, 'mainwp'), count($extensions));
        ?>
</span>
		</h3>


		<div id="mainwp-extensions-wrap">
			<?php 
        if (count($extensions) == 0) {
            ?>
				<div class="inside">
					<div class="mainwp_info-box-blue">
						<h3><?php 
            _e('What are Extensions?', 'mainwp');
            ?>
</h3>
						<?php 
            _e('Extensions are specific features or tools created for the purpose of expanding the basic functionality of MainWP.', 'mainwp');
            ?>
						<h3><?php 
            _e('Why have Extensions?', 'mainwp');
            ?>
</h3>
						<?php 
            _e('The core of MainWP has been designed to provide the functions most needed by our users and minimize code bloat. Extensions offer custom functions and features so that each user can tailor their MainWP to their specific needs.', 'mainwp');
            ?>
						<p>
							<a href="https://extensions.mainwp.com/"><?php 
            _e('Download your first extension now.', 'mainwp');
            ?>
</a>
						</p>
					</div>
				</div>
			<?php 
        } else {
            ?>
				<div style="background: #eee; padding: 1em .6em;">
					<a class="mainwp_action left mainwp_action_down" href="#" id="mainwp-extensions-expand"><?php 
            _e('Expand', 'mainwp');
            ?>
</a><a class="mainwp_action right" href="#" id="mainwp-extensions-collapse"><?php 
            _e('Collapse', 'mainwp');
            ?>
</a>
					<?php 
            if (mainwp_current_user_can('dashboard', 'manage_extensions')) {
                ?>
						<div style="float: right; margin-top: -3px;">
							<a href="#" class="button mainwp-extensions-disable-all"><?php 
                _e('Disable All', 'mainwp');
                ?>
</a>
							<a href="#" class="button-primary mainwp-extensions-enable-all"><?php 
                _e('Enable All', 'mainwp');
                ?>
</a>
							<a href="<?php 
                echo admin_url('plugin-install.php?tab=upload');
                ?>
" class="mainwp-upgrade-button button-primary button"><?php 
                _e('Install New Extension', 'mainwp');
                ?>
</a>
						</div>
						<div style="clear: both;"></div>
					<?php 
            }
            ?>
				</div>
				<div id="mainwp-extensions-list">
					<?php 
            $user_can_manage_extensions = mainwp_current_user_can('dashboard', 'manage_extensions');
            if (isset($extensions) && is_array($extensions)) {
                foreach ($extensions as $extension) {
                    if (!mainwp_current_user_can('extension', dirname($extension['slug']))) {
                        continue;
                    }
                    $active = MainWP_Extensions::isExtensionActivated($extension['plugin']);
                    $enabled = MainWP_Extensions::isExtensionEnabled($extension['plugin']);
                    $queue_status = '';
                    if (isset($extension['apiManager']) && $extension['apiManager']) {
                        $queue_status = 'status="queue"';
                    }
                    ?>
							<div class="mainwp-extensions-childHolder" extension_slug="<?php 
                    echo $extension['slug'];
                    ?>
" <?php 
                    echo $queue_status;
                    ?>
 license-status="<?php 
                    echo $active ? 'activated' : 'deactivated';
                    ?>
">
								<table style="width: 100%">
									<td class="mainwp-extensions-childIcon">
										<?php 
                    if (isset($extension['iconURI']) && $extension['iconURI'] != '') {
                        ?>
											<img title="<?php 
                        echo $extension['name'];
                        ?>
" src="<?php 
                        echo MainWP_Utility::removeHttpPrefix($extension['iconURI']);
                        ?>
" class="mainwp-extensions-img large <?php 
                        echo $enabled ? '' : 'mainwp-extension-icon-desaturated';
                        ?>
" /><?php 
                    } else {
                        ?>
											<img title="MainWP Placeholder" src="<?php 
                        echo plugins_url('images/extensions/placeholder.png', dirname(__FILE__));
                        ?>
" class="mainwp-extensions-img large <?php 
                        echo $enabled ? '' : 'mainwp-extension-icon-desaturated';
                        ?>
" /><?php 
                    }
                    ?>
									</td>
									<td valign="top">
										<table style="width: 100%">
											<tr>
												<td class="mainwp-extensions-childName">
													<?php 
                    if (isset($extension['direct_page']) && !empty($extension['direct_page'])) {
                        ?>
														<a href="<?php 
                        echo admin_url('admin.php?page=' . $extension['direct_page']);
                        ?>
" style="text-decoration: none;">
															<?php 
                        echo $extension['name'];
                        ?>
														</a>
													<?php 
                    } else {
                        if (isset($extension['callback'])) {
                            ?>
														<a href="<?php 
                            echo admin_url('admin.php?page=' . $extension['page']);
                            ?>
" style="text-decoration: none;">
															<?php 
                            echo $extension['name'];
                            ?>
														</a>
													<?php 
                        } else {
                            echo $extension['name'];
                        }
                    }
                    ?>
												</td>
												<td class="mainwp-extensions-childVersion">V. <?php 
                    echo $extension['version'];
                    ?>
</td>
												<td class="mainwp-extensions-childActions">
													<?php 
                    if (isset($extension['apiManager']) && $extension['apiManager']) {
                        ?>
														<?php 
                        if ($active) {
                            ?>
															<a href="javascript:void(0)" class="api-status activated" ><?php 
                            _e('Activated', 'mainwp');
                            ?>
</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
														<?php 
                        } else {
                            ?>
															<a href="javascript:void(0)" class="api-status deactivated" title="Not Activated"><?php 
                            _e('Deactivated', 'mainwp');
                            ?>
</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
														<?php 
                        }
                        ?>
													<?php 
                    }
                    ?>


													<?php 
                    if ($enabled) {
                        ?>
														<button href="#" <?php 
                        echo $user_can_manage_extensions ? 'class="button mainwp-extensions-disable"' : 'disabled="disabled"';
                        ?>
 ><?php 
                        _e('Disable', 'mainwp');
                        ?>
</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
													<?php 
                    } else {
                        ?>
														<button <?php 
                        echo $user_can_manage_extensions ? 'class="button-primary mainwp-extensions-enable"' : 'disabled="disabled"';
                        ?>
 ><?php 
                        _e('Enable', 'mainwp');
                        ?>
</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
													<?php 
                    }
                    ?>

													<?php 
                    if (isset($extension['apiManager']) && $extension['apiManager']) {
                        ?>
														<?php 
                        if ($user_can_manage_extensions) {
                            ?>
															<?php 
                            if ($active) {
                                ?>
																<a href="#" class="mainwp-extensions-api-activation" style="font-size: 28px;"><i class="fa fa-lock"></i></a>
															<?php 
                            } else {
                                ?>
																<a href="#" class="mainwp-extensions-api-activation" style="font-size: 28px;"><i class="fa fa-unlock"></i></a>
															<?php 
                            }
                            ?>
														<?php 
                        } else {
                            ?>
															<?php 
                            if ($active) {
                                ?>
																<span style="font-size: 28px; color: #e5e5e5;"><i class="fa fa-lock"></i></span>
															<?php 
                            } else {
                                ?>
																<span style="font-size: 28px; color: #e5e5e5;"><i class="fa fa-unlock"></i></span>
															<?php 
                            }
                            ?>
														<?php 
                        }
                        ?>
													<?php 
                    } else {
                        ?>
														<span style="font-size: 28px; color: #e5e5e5;"><i class="fa fa-lock"></i></span>
													<?php 
                    }
                    ?>

													<?php 
                    if (isset($extension['direct_page']) && !empty($extension['direct_page'])) {
                        ?>
														<a href="<?php 
                        echo admin_url('admin.php?page=' . $extension['direct_page']);
                        ?>
" style="font-size: 28px;"><i class="fa fa-wrench"></i></a>
													<?php 
                    } else {
                        if (isset($extension['callback'])) {
                            ?>
														<a href="<?php 
                            echo admin_url('admin.php?page=' . $extension['page']);
                            ?>
" style="font-size: 28px;"><i class="fa fa-wrench"></i></a>
													<?php 
                        } else {
                            ?>
														<span style="font-size: 28px; color: #e5e5e5;"><i class="fa fa-wrench"></i></span>
													<?php 
                        }
                    }
                    ?>

													<?php 
                    if (false && $user_can_manage_extensions) {
                        ?>
														<a href="#" class="mainwp-extensions-trash" style="font-size: 28px"><i class="fa fa-trash"></i></a>
													<?php 
                    } else {
                        ?>
														<span style="font-size: 28px; color: #e5e5e5;"><i class="fa fa-trash"></i></span>
													<?php 
                    }
                    ?>
												</td>
											</tr>
											<tr class="mainwp-extensions-extra mainwp-extension-description">
												<td colspan="3">
													<br/><br/><?php 
                    echo preg_replace('/\\<cite\\>.*\\<\\/cite\\>/', '', $extension['description']);
                    ?>
													<br/><br/></td>
											</tr>
											<tr class="mainwp-extensions-links">
												<td colspan="3">
													<?php 
                    printf(__('By %s', 'mainwp'), str_replace(array('http:', 'https:'), '', $extension['author']));
                    ?>
													<?php 
                    echo isset($extension['DocumentationURI']) && !empty($extension['DocumentationURI']) ? ' | <a href="' . str_replace(array('http:', 'https:'), '', $extension['DocumentationURI']) . '" target="_blank" title="' . __('Documentation', 'mainwp') . '">' . __('Documentation', 'mainwp') . '</a>' : '';
                    ?>
													<?php 
                    echo isset($extension['SupportForumURI']) && !empty($extension['SupportForumURI']) ? ' | <a href="' . str_replace(array('http:', 'https:'), '', $extension['SupportForumURI']) . '" target="_blank" title="' . __('Support Forum', 'mainwp') . '">' . __('Support Forum', 'mainwp') . '</a>' : '';
                    ?>
													<?php 
                    if (isset($extension['apiManager']) && $extension['apiManager']) {
                        ?>
														<?php 
                        echo ' | <a href="#" class="mainwp-extensions-api-activation" >' . __('Enter Activation API', 'mainwp') . '</a>';
                        ?>
													<?php 
                    }
                    ?>
												</td>
											</tr>
											<?php 
                    if (isset($extension['apiManager']) && $extension['apiManager']) {
                        ?>
												<tr class="mainwp-extensions-api-row">
													<td colspan="3">
														<div class="api-row-div">
															<span>
																<input type="text" class="input api_key" placeholder="<?php 
                        esc_attr_e('API License Key', 'mainwp');
                        ?>
" value="<?php 
                        echo $extension['api_key'];
                        ?>
"/>
																<input type="text" class="input api_email" placeholder="<?php 
                        esc_attr_e('API License Email', 'mainwp');
                        ?>
" value="<?php 
                        echo $extension['activation_email'];
                        ?>
"/>
																<input type="button" class="button-primary mainwp-extensions-activate" value="<?php 
                        esc_attr_e('Activate', 'mainwp');
                        ?>
">
																<span class="mainwp_loading"><i class="fa fa-spinner fa-pulse"></i></span>
															</span>
															<span style="float:right">
																<?php 
                        _e('Deactivate License Key', 'mainwp');
                        ?>
																<input type="checkbox" class="mainwp-extensions-deactivate-chkbox" <?php 
                        echo $extension['deactivate_checkbox'] == 'on' ? 'checked' : '';
                        ?>
>
																<input type="button" class="button-primary mainwp-extensions-deactivate" value="<?php 
                        _e('Deactivate', 'mainwp');
                        ?>
">
															</span>
														</div>
														<span class="activate-api-status hidden"></span>
													</td>
												</tr>
											<?php 
                    }
                    ?>
										</table>
									</td>
								</table>
							</div>

							<?php 
                }
            }
            ?>

				</div>
				<?php 
        }
        ?>
		</div></div><?php 
        self::mainwpAvailableExtensions($extensions);
    }
Exemplo n.º 27
0
 function upgradePluginTheme()
 {
     try {
         $websiteId = $type = null;
         $slugs = array();
         if (isset($_POST['websiteId'])) {
             $websiteId = $_POST['websiteId'];
         }
         if (isset($_POST['slugs'])) {
             $slugs = $_POST['slugs'];
         }
         if (isset($_POST['type'])) {
             $type = $_POST['type'];
         }
         $error = '';
         if ($type == 'plugin' && !mainwp_current_user_can('dashboard', 'update_plugins')) {
             $error = mainwp_do_not_have_permissions(__('update plugins', 'mainwp'), false);
         } else {
             if ($type == 'theme' && !mainwp_current_user_can('dashboard', 'update_themes')) {
                 $error = mainwp_do_not_have_permissions(__('update themes', 'mainwp'), false);
             }
         }
         if (!empty($error)) {
             die(json_encode(array('error' => $error)));
         }
         if (MainWP_Utility::ctype_digit($websiteId)) {
             $website = MainWP_DB::Instance()->getWebsiteById($websiteId);
             if (MainWP_Utility::can_edit_website($website)) {
                 $information = MainWP_Utility::fetchUrlAuthed($website, 'upgradeplugintheme', array('type' => $type, 'list' => urldecode(implode(',', $slugs))));
                 die(json_encode($information));
             }
         }
     } catch (MainWP_Exception $e) {
         die(json_encode(array('error' => $e->getMessage())));
     }
     die;
 }
Exemplo n.º 28
0
    public static function render()
    {
        $tasks = MainWPDB::Instance()->getBackupTasksForUser();
        if (count($tasks) == 0) {
            echo 'You have no scheduled backup tasks. <a href="admin.php?page=ManageBackupsAddNew">Go create one!</a>';
        } else {
            ?>
		<div class"mainwp-row-top" style="text-align: right; margin-bottom: 1em;">                     
                    <a href="admin.php?page=ManageBackups" class="button" ><?php 
            _e('Manage Backups', 'mainwp');
            ?>
</a>
                    <?php 
            if (mainwp_current_user_can("dashboard", "add_backup_tasks")) {
                ?>
                    &nbsp;&nbsp;<a href="admin.php?page=ManageBackupsAddNew" class="button-primary" ><?php 
                _e('Add New Task', 'mainwp');
                ?>
</a>
                    <?php 
            }
            ?>
		</div>
		<div id="mainwp-backup-tasks-widget">
			<style>
			@keyframes blinker {
				0% { background: #7fb100 ;}
				100% { background: #446200 ;}
			}
			@-webkit-keyframes blinker {
				0% { background: #7fb100 ;}
				100% { background: #446200 ;}
			}

			.mainwp-blink-me {
				animation: blinker 1s linear 0s infinite alternate;
				-webkit-animation: blinker 1s linear 0s infinite alternate;
			}
			</style>
		<?php 
            foreach ($tasks as $task) {
                $sites = array();
                if ($task->groups != '') {
                    $groups = explode(',', $task->groups);
                    foreach ($groups as $groupid) {
                        $group_sites = MainWPDB::Instance()->getWebsitesByGroupId($groupid);
                        foreach ($group_sites as $group_site) {
                            if (in_array($group_site->id, $sites)) {
                                continue;
                            }
                            $sites[] = $group_site->id;
                        }
                    }
                } else {
                    if ($task->sites != '') {
                        $sites = explode(',', $task->sites);
                    }
                }
                ?>
			<div class="mainwp-row mainwp-recent">
				<span class="mainwp-left-col" style="width: 40%">
					<strong><a href="admin.php?page=ManageBackups&id=<?php 
                echo $task->id;
                ?>
"><?php 
                echo $task->name;
                ?>
</a></strong><br /><span style="font-size: 11px">(<?php 
                echo strtoupper($task->schedule);
                ?>
 - <?php 
                echo $task->type == 'db' ? __('Database Backup', 'mainwp') : __('Full Backup', 'mainwp');
                ?>
)</span>
				</span>
				<span class="mainwp-mid-col">
					<?php 
                if ($task->paused == 1) {
                    echo '<span title="Paused"  style="background: #999; padding: .3em 1em; color: white; border-radius: 15px; -moz-border-radius: 15px; -webkit-border-radius: 15px;">' . count($sites) . '</span>';
                } else {
                    if (count($sites) == 0) {
                        echo '<span title="0 Scheduled Websites" style="background: #c80000; padding: .3em 1em; color: white; border-radius: 15px; -moz-border-radius: 15px; -webkit-border-radius: 15px;">0</span>';
                    } else {
                        if ($task->last_run != 0 && $task->completed < $task->last_run) {
                            echo '<span title="Backup in Progress" class="mainwp-blink-me" style="padding: .3em 1em; color: white; border-radius: 15px; -moz-border-radius: 15px; -webkit-border-radius: 15px;">' . count($sites) . '</span>';
                        } else {
                            echo '<span title="Scheduled Websites" style="background: #7fb100; padding: .3em 1em; color: white; border-radius: 15px; -moz-border-radius: 15px; -webkit-border-radius: 15px;">' . count($sites) . '</span>';
                        }
                    }
                }
                ?>
				</span>
				<span class="mainwp-right-col" style="width: 40%; text-align: left;">
					<strong><?php 
                _e('LAST RUN: ', 'mainwp');
                ?>
</strong>&nbsp;<?php 
                echo $task->last_run == 0 ? '-' : MainWPUtility::formatTimestamp(MainWPUtility::getTimestamp($task->last_run));
                ?>
<br />
					<strong><?php 
                _e('NEXT RUN: ', 'mainwp');
                ?>
</strong>&nbsp;<?php 
                echo $task->last_run == 0 ? __('Any minute', 'mainwp') : MainWPUtility::formatTimestamp(($task->schedule == 'daily' ? 60 * 60 * 24 : ($task->schedule == 'weekly' ? 60 * 60 * 24 * 7 : 60 * 60 * 24 * 30)) + MainWPUtility::getTimestamp($task->last_run));
                ?>
				</span>
				<div style="clear: left;"></div>
            </div>
             <?php 
            }
            ?>
        </div>
        <?php 
        }
    }
Exemplo n.º 29
0
    public static function renderBulkAdd()
    {
        if (!mainwp_current_user_can("dashboard", "manage_pages")) {
            mainwp_do_not_have_permissions("manage pages");
            return;
        }
        $src = get_site_url() . '/wp-admin/post-new.php?post_type=bulkpage&hideall=1';
        $src = apply_filters('mainwp_bulkpost_edit_source', $src);
        //Loads the post screen via AJAX, which redirects to the "posting()" to really post the posts to the saved sites
        ?>
        <?php 
        self::renderHeader('BulkAdd');
        ?>
            <iframe scrolling="auto" id="mainwp_iframe" src="<?php 
        echo $src;
        ?>
"></iframe>
        </div>
    </div>
    <?php 
    }
Exemplo n.º 30
0
    public static function renderIgnore()
    {
        $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesForCurrentUser());
        $userExtension = MainWPDB::Instance()->getUserExtension();
        $decodedIgnoredPlugins = json_decode($userExtension->ignored_plugins, true);
        $ignoredPlugins = is_array($decodedIgnoredPlugins) && count($decodedIgnoredPlugins) > 0;
        $cnt = 0;
        while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
            if ($website->is_ignorePluginUpdates) {
                continue;
            }
            $tmpDecodedIgnoredPlugins = json_decode($website->ignored_plugins, true);
            if (!is_array($tmpDecodedIgnoredPlugins) || count($tmpDecodedIgnoredPlugins) == 0) {
                continue;
            }
            $cnt++;
        }
        self::renderHeader('Ignore');
        ?>
        <table id="mainwp-table" class="wp-list-table widefat" cellspacing="0">
        	<caption><?php 
        _e('Globally Ignored Plugins', 'mainwp');
        ?>
</caption>
            <thead>
                <tr>
                    <th scope="col" class="manage-column" style="width: 300px"><?php 
        _e('Plugin', 'mainwp');
        ?>
</th>
                    <th scope="col" class="manage-column" style="width: 650px"><?php 
        _e('Plugin File', 'mainwp');
        ?>
</th>
                    <th scope="col" class="manage-column" style="text-align: right; padding-right: 10px"><?php 
        if (mainwp_current_user_can("dashboard", "ignore_unignore_updates")) {
            if ($ignoredPlugins) {
                ?>
<a href="#" class="button-primary mainwp-unignore-globally-all" onClick="return rightnow_plugins_unignore_globally_all();"><?php 
                _e('Allow All', 'mainwp');
                ?>
</a><?php 
            }
        }
        ?>
</th>
                </tr>
            </thead>
            <tbody id="globally-ignored-plugins-list" class="list:sites">
            <?php 
        if ($ignoredPlugins) {
            foreach ($decodedIgnoredPlugins as $ignoredPlugin => $ignoredPluginName) {
                ?>
                        <tr plugin_slug="<?php 
                echo urlencode($ignoredPlugin);
                ?>
">
                            <td>
                                <strong><a href="<?php 
                echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . urlencode(dirname($ignoredPlugin)) . '&TB_iframe=true&width=640&height=477';
                ?>
" target="_blank" class="thickbox" title="More information about <?php 
                echo $ignoredPluginName;
                ?>
"><?php 
                echo $ignoredPluginName;
                ?>
</a></strong>
                            </td>
                            <td>
                                <?php 
                echo $ignoredPlugin;
                ?>
                            </td>
                            <td style="text-align: right; padding-right: 30px">
                                <?php 
                if (mainwp_current_user_can("dashboard", "ignore_unignore_updates")) {
                    ?>
                                <a href="#" onClick="return rightnow_plugins_unignore_globally('<?php 
                    echo urlencode($ignoredPlugin);
                    ?>
')"><i class="fa fa-check"></i> <?php 
                    _e('Allow', 'mainwp');
                    ?>
</a>
                                <?php 
                }
                ?>
                            </td>
                        </tr>
                <?php 
            }
            ?>
            <?php 
        } else {
            ?>
                        <tr><td colspan="2"><?php 
            _e('No ignored plugins', 'mainwp');
            ?>
</td></tr>
                <?php 
        }
        ?>
            </tbody>
        </table>

        <table id="mainwp-table" class="wp-list-table widefat" cellspacing="0">
        	<caption><?php 
        _e('Per Site Ignored Plugins', 'mainwp');
        ?>
</caption>
            <thead>
                <tr>
                    <th scope="col" class="manage-column" style="width: 300px"><?php 
        _e('Site', 'mainwp');
        ?>
</th>
                    <th scope="col" class="manage-column" style="width: 650px"><?php 
        _e('Plugins', 'mainwp');
        ?>
</th>
                    <th scope="col" class="manage-column" style="text-align: right; padding-right: 10px"><?php 
        if ($cnt > 0) {
            ?>
<a href="#" class="button-primary mainwp-unignore-detail-all" onClick="return rightnow_plugins_unignore_detail_all();"><?php 
            _e('Allow All', 'mainwp');
            ?>
</a><?php 
        }
        ?>
</th>
                </tr>
            </thead>
            <tbody id="ignored-plugins-list" class="list:sites">
            <?php 
        if ($cnt > 0) {
            @MainWPDB::data_seek($websites, 0);
            while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                if ($website->is_ignorePluginUpdates) {
                    continue;
                }
                $decodedIgnoredPlugins = json_decode($website->ignored_plugins, true);
                if (!is_array($decodedIgnoredPlugins) || count($decodedIgnoredPlugins) == 0) {
                    continue;
                }
                $first = true;
                foreach ($decodedIgnoredPlugins as $ignoredPlugin => $ignoredPluginName) {
                    ?>
                    <tr site_id="<?php 
                    echo $website->id;
                    ?>
" plugin_slug="<?php 
                    echo urlencode($ignoredPlugin);
                    ?>
">
                        <td>
                            <span class="websitename" <?php 
                    if (!$first) {
                        echo 'style="display: none;"';
                    } else {
                        $first = false;
                    }
                    ?>
>
                                <a href="<?php 
                    echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
                    ?>
"><?php 
                    echo stripslashes($website->name);
                    ?>
</a>
                            </span>
                        </td>
                        <td>
                            <strong><a href="<?php 
                    echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . urlencode(dirname($ignoredPlugin)) . '&TB_iframe=true&width=640&height=477';
                    ?>
" target="_blank" class="thickbox" title="More information about <?php 
                    echo $ignoredPluginName;
                    ?>
"><?php 
                    echo $ignoredPluginName;
                    ?>
</a></strong> (<?php 
                    echo $ignoredPlugin;
                    ?>
)
                        </td>
                        <td style="text-align: right; padding-right: 30px">
                            <a href="#" onClick="return rightnow_plugins_unignore_detail('<?php 
                    echo urlencode($ignoredPlugin);
                    ?>
', <?php 
                    echo $website->id;
                    ?>
)"><i class="fa fa-check"></i> <?php 
                    _e('Allow', 'mainwp');
                    ?>
</a>
                        </td>
                    </tr>
                        <?php 
                }
            }
            @MainWPDB::free_result($websites);
        } else {
            ?>
                <tr><td colspan="3"><?php 
            _e('No ignored plugins', 'mainwp');
            ?>
</td></tr>
            <?php 
        }
        ?>
            </tbody>
        </table>
            <?php 
        self::renderFooter('Ignore');
    }