function select_sites($post)
    {
        $selected_sites = unserialize(base64_decode(get_post_meta($post->ID, '_selected_sites', true)));
        if ($selected_sites == '') {
            $selected_sites = array();
        }
        if (isset($_REQUEST['select'])) {
            $selected_sites = $_REQUEST['select'] == 'all' ? 'all' : array($_REQUEST['select']);
        }
        $selected_groups = unserialize(base64_decode(get_post_meta($post->ID, '_selected_groups', true)));
        if ($selected_groups == '') {
            $selected_groups = array();
        }
        ?>
<input type="hidden" name="select_sites_nonce" id="select_sites_nonce"
		         value="<?php 
        echo wp_create_nonce('select_sites_' . $post->ID);
        ?>
" /><?php 
        MainWP_UI::select_sites_box_body($selected_sites, $selected_groups, 'checkbox', true, true, true);
    }
Ejemplo n.º 2
0
 public function select_sites_box($title = '', $type = 'checkbox', $show_group = true, $show_select_all = true, $class = '', $style = '', $selected_websites = array(), $selected_groups = array())
 {
     MainWP_UI::select_sites_box($title, $type, $show_group, $show_select_all, $class, $style, $selected_websites, $selected_groups);
 }
Ejemplo n.º 3
0
    public static function renderThemesTable($favoritesCallback = '')
    {
        if (!mainwp_current_user_can("dashboard", "install_themes")) {
            mainwp_do_not_have_permissions(__('install themes', 'mainwp'));
            return;
        }
        ?>
		<a href="#" class="mainwp_action left mainwp_action_down browse-themes" ><?php 
        _e('Search', 'mainwp');
        ?>
</a><a href="#" class="mainwp_action right upload" ><?php 
        _e('Upload', 'mainwp');
        ?>
</a>
		<br class="clear" /><br />

		<div class="mainwp_config_box_left" style="width: calc(100% - 290px);">
			<div class="error below-h2" style="display: none;" id="ajax-error-zone"></div>
			<div class="upload-theme">
				<?php 
        MainWP_Install_Bulk::renderUpload('Themes');
        ?>
			</div>
			<div class="wp-filter">
				<h3 class="mainwp_box_title"><?php 
        _e('Step 1: Select a Theme', 'mainwp');
        ?>
</h3>
				<div class="filter-count">
					<span class="count theme-count"></span>
				</div>

				<ul class="filter-links">
					<li><a href="#" data-sort="featured"><?php 
        _ex('Featured', 'themes');
        ?>
</a></li>
					<li><a href="#" data-sort="popular"><?php 
        _ex('Popular', 'themes');
        ?>
</a></li>
					<li><a href="#" data-sort="new"><?php 
        _ex('Latest', 'themes');
        ?>
</a></li>
				</ul>
				<a class="drawer-toggle" href="#"><?php 
        _e('Feature Filter', 'mainwp');
        ?>
</a>

				<div class="search-form"></div>
				<div class="filter-drawer">
					<div class="buttons">
						<a class="apply-filters button button-secondary" href="#"><?php 
        _e('Apply Filters', 'mainwp');
        ?>
<span></span></a>
						<a class="clear-filters button button-secondary" href="#"><?php 
        _e('Clear', 'mainwp');
        ?>
</a>
					</div>
					<?php 
        $feature_list = get_theme_feature_list();
        foreach ($feature_list as $feature_name => $features) {
            echo '<div class="filter-group">';
            $feature_name = esc_html($feature_name);
            echo '<h4>' . $feature_name . '</h4>';
            echo '<ol class="feature-group">';
            foreach ($features as $feature => $feature_name) {
                $feature = esc_attr($feature);
                echo '<li><input type="checkbox" id="filter-id-' . $feature . '" value="' . $feature . '" /> ';
                echo '<label for="filter-id-' . $feature . '">' . $feature_name . '</label></li>';
            }
            echo '</ol>';
            echo '</div>';
        }
        ?>
					<div class="filtered-by">
						<span><?php 
        _e('Filtering by:', 'mainwp');
        ?>
</span>
						<div class="tags"></div>
						<a href="#"><?php 
        _e('Edit', 'mainwp');
        ?>
</a>
					</div>
				</div>
			</div>
			<div class="theme-browser content-filterable hide-if-upload"></div>
			<div class="theme-install-overlay wp-full-overlay expanded"></div>

			<p class="no-themes"><?php 
        _e('No themes found. Try a different search.');
        ?>
</p>
			<span class="spinner"></span>

			<br class="clear" />
		</div>

		<script id="tmpl-theme" type="text/template">
			<# if ( data.screenshot_url ) { #>
				<div class="theme-screenshot">
					<img src="{{ data.screenshot_url }}" alt="" />
				</div>
				<# } else { #>
					<div class="theme-screenshot blank"></div>
					<# } #>
						<span class="more-details"><?php 
        _ex('Details &amp; Preview', 'theme');
        ?>
</span>
						<div class="theme-author"><?php 
        printf(__('By %s', 'mainwp'), '{{ data.author }}');
        ?>
</div>
						<h3 class="theme-name">{{ data.name }}</h3>

						<!--<div class="theme-actions">-->
						<!--<a class="button button-secondary preview install-theme-preview" href="#"><?php 
        esc_html_e('Preview', 'mainwp');
        ?>
</a>-->
						<!--</div>-->

						<div class="mainwp-theme-lnks" style="">
							<label class="lbl-install-theme" style="font-size: 16px;"><input name="install-theme" type="radio" id="install-theme-{{data.slug}}" title="Install {{data.name}}"><?php 
        esc_html_e('Install this Theme', 'mainwp');
        ?>
</label>
							<?php 
        if (!empty($favoritesCallback)) {
            ?>
								<div class="favorites-add-link"><a style="font-size: 16px;" class="add-favorites" href="#" id="add-favorite-theme-{{data.slug}}"
																   title="{{data.name}} {{data.version}}"><?php 
            _e('Add To Favorites', 'mainwp');
            ?>
</a></div>
								<?php 
        }
        ?>
						</div>

						<# if ( data.installed ) { #>
							<div class="theme-installed"><?php 
        _ex('Already Installed', 'theme');
        ?>
</div>
							<# } #>
		</script>

		<script id="tmpl-theme-preview" type="text/template">
			<div class="wp-full-overlay-sidebar">
				<div class="wp-full-overlay-header">
					<a href="#" class="close-full-overlay"><span class="screen-reader-text"><?php 
        _e('Close', 'mainwp');
        ?>
</span></a>
					<a href="#" class="previous-theme"><span class="screen-reader-text"><?php 
        _ex('Previous', 'Button label for a theme');
        ?>
</span></a>
					<a href="#" class="next-theme"><span class="screen-reader-text"><?php 
        _ex('Next', 'Button label for a theme');
        ?>
</span></a>
					<# if ( data.installed ) { #>
						<a href="#" class="button button-primary theme-install disabled"><?php 
        _ex('Installed', 'theme');
        ?>
</a>
						<# } else { #>
							<a href="{{ data.install_url }}" class="button button-primary theme-install"><?php 
        _e('Install', 'mainwp');
        ?>
</a>
							<# } #>
				</div>
				<div class="wp-full-overlay-sidebar-content">
					<div class="install-theme-info">
						<h3 class="theme-name">{{ data.name }}</h3>
						<span class="theme-by"><?php 
        printf(__('By %s', 'mainwp'), '{{ data.author }}');
        ?>
</span>

						<img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" />

						<div class="theme-details">
							<# if ( data.rating ) { #>
								<div class="star-rating rating-{{ Math.round( data.rating / 10 ) * 10 }}">
									<span class="one"></span><span class="two"></span><span class="three"></span><span class="four"></span><span class="five"></span>
									<small class="ratings">{{ data.num_ratings }}</small>
								</div>
								<# } else { #>
									<div class="star-rating">
										<small class="ratings"><?php 
        _e('This theme has not been rated yet.');
        ?>
</small>
									</div>
									<# } #>
										<div class="theme-version"><?php 
        printf(__('Version: %s', 'mainwp'), '{{ data.version }}');
        ?>
</div>
										<div class="theme-description">{{{ data.description }}}</div>
						</div>
					</div>
				</div>
				<div class="wp-full-overlay-footer">
					<button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php 
        esc_attr_e('Collapse Sidebar', 'mainwp');
        ?>
">
						<span class="collapse-sidebar-arrow"></span>
						<span class="collapse-sidebar-label"><?php 
        _e('Collapse', 'mainwp');
        ?>
</span>
					</button>
				</div>
			</div>
			<div class="wp-full-overlay-main">
				<iframe src="{{ data.preview_url }}" title="<?php 
        esc_attr_e('Preview', 'mainwp');
        ?>
" />
			</div>
		</script>
		<?php 
        MainWP_UI::select_sites_box(__("Step 2: Select Sites", 'mainwp'), 'checkbox', true, true, 'mainwp_select_sites_box_right');
        ?>
		<div class="mainwp_config_box_right">
			<div class="postbox install-theme-settings">
				<h3 class="mainwp_box_title"><i class="fa fa-cog"></i> <?php 
        _e('Step 3: Installation Options', 'mainwp');
        ?>
</h3>
				<div class="inside">
					<input type="checkbox" value="2" checked id="chk_overwrite" /> <label for="chk_overwrite"><?php 
        _e('Overwrite Existing theme, if already installed', 'mainwp');
        ?>
</label>
				</div>
			</div>

			<input type="button" value="<?php 
        _e("Complete Installation", 'mainwp');
        ?>
" class="button-primary button button-hero button-right hide-if-upload" id="mainwp_theme_bulk_install_btn" name="bulk-install">
			<input type="button" value="<?php 
        _e('Complete Installation', 'mainwp');
        ?>
" class="button-primary button button-hero button-right show-if-upload" onClick="mainwp_upload_bulk('themes');">

		</div>
		<div style="clear: both;"></div>

		<?php 
    }
Ejemplo n.º 4
0
    public static function render()
    {
        if (!mainwp_current_user_can('dashboard', 'manage_posts')) {
            mainwp_do_not_have_permissions(__('manage posts', 'mainwp'));
            return;
        }
        global $mainwp_current_user;
        $cachedSearch = MainWP_Cache::getCachedContext('Post');
        //Loads the post screen via AJAX, which redirects to the "posting()" to really post the posts to the saved sites
        self::renderHeader('BulkManage');
        ?>
		<div class="mainwp-search-form">
			<div class="postbox mainwp-postbox">
				<h3 class="mainwp_box_title"><i class="fa fa-binoculars"></i> <?php 
        _e('Step 1: Search Posts', 'mainwp');
        ?>
				</h3>

				<div class="inside">
					<ul class="mainwp_checkboxes">
						<li>
							<input type="checkbox" id="mainwp_post_search_type_publish" <?php 
        echo $cachedSearch == null || $cachedSearch != null && in_array('publish', $cachedSearch['status']) ? 'checked="checked"' : '';
        ?>
 class="mainwp-checkbox2"/>
							<label for="mainwp_post_search_type_publish" class="mainwp-label2"><?php 
        _e('Published', 'mainwp');
        ?>
</label>
						</li>
						<li>
							<input type="checkbox" id="mainwp_post_search_type_pending" <?php 
        echo $cachedSearch != null && in_array('pending', $cachedSearch['status']) ? 'checked="checked"' : '';
        ?>
 class="mainwp-checkbox2"/>
							<label for="mainwp_post_search_type_pending" class="mainwp-label2"><?php 
        _e('Pending', 'mainwp');
        ?>
</label>
						</li>
						<li>
							<input type="checkbox" id="mainwp_post_search_type_private" <?php 
        echo $cachedSearch != null && in_array('private', $cachedSearch['status']) ? 'checked="checked"' : '';
        ?>
 class="mainwp-checkbox2"/>
							<label for="mainwp_post_search_type_private" class="mainwp-label2"><?php 
        _e('Private', 'mainwp');
        ?>
</label>
						</li>
						<li>
							<input type="checkbox" id="mainwp_post_search_type_future" <?php 
        echo $cachedSearch != null && in_array('future', $cachedSearch['status']) ? 'checked="checked"' : '';
        ?>
 class="mainwp-checkbox2"/>
							<label for="mainwp_post_search_type_future" class="mainwp-label2"><?php 
        _e('Future', 'mainwp');
        ?>
</label>
						</li>
						<li>
							<input type="checkbox" id="mainwp_post_search_type_draft" <?php 
        echo $cachedSearch != null && in_array('draft', $cachedSearch['status']) ? 'checked="checked"' : '';
        ?>
 class="mainwp-checkbox2"/>
							<label for="mainwp_post_search_type_draft" class="mainwp-label2"><?php 
        _e('Draft', 'mainwp');
        ?>
</label>
						</li>
						<li>
							<input type="checkbox" id="mainwp_post_search_type_trash" <?php 
        echo $cachedSearch != null && in_array('trash', $cachedSearch['status']) ? 'checked="checked"' : '';
        ?>
 class="mainwp-checkbox2"/>
							<label for="mainwp_post_search_type_trash" class="mainwp-label2"><?php 
        _e('Trash', 'mainwp');
        ?>
</label>
						</li>
					</ul>
					<p>
						<?php 
        _e('Containing Keyword:', 'mainwp');
        ?>
<br/>
						<input type="text" id="mainwp_post_search_by_keyword" class="" size="50" value="<?php 
        if ($cachedSearch != null) {
            echo $cachedSearch['keyword'];
        }
        ?>
"/>
					</p>

					<p>
						<?php 
        _e('Date Range:', 'mainwp');
        ?>
<br/>
						<input type="text" id="mainwp_post_search_by_dtsstart" class="mainwp_datepicker" size="12" value="<?php 
        if ($cachedSearch != null) {
            echo $cachedSearch['dtsstart'];
        }
        ?>
"/> <?php 
        _e('to', 'mainwp');
        ?>
						<input type="text" id="mainwp_post_search_by_dtsstop" class="mainwp_datepicker" size="12" value="<?php 
        if ($cachedSearch != null) {
            echo $cachedSearch['dtsstop'];
        }
        ?>
"/>
					</p>
				</div>
			</div>
			<?php 
        MainWP_UI::select_sites_box(__('Step 2: Select Sites', 'mainwp'), 'checkbox', true, true, 'mainwp_select_sites_box_left');
        ?>
			<div style="clear: both;"></div>

			<input type="button" name="mainwp_show_posts" id="mainwp_show_posts" class="button-primary button button-hero button-right" value="<?php 
        _e('Show Posts', 'mainwp');
        ?>
"/>
			<?php 
        if (isset($_REQUEST['siteid']) && isset($_REQUEST['postid'])) {
            echo '<script>jQuery(document).ready(function() { mainwp_show_post(' . $_REQUEST['siteid'] . ', ' . $_REQUEST['postid'] . ', undefined)});</script>';
        } else {
            if (isset($_REQUEST['siteid']) && isset($_REQUEST['userid'])) {
                echo '<script>jQuery(document).ready(function() { mainwp_show_post(' . $_REQUEST['siteid'] . ', undefined, ' . $_REQUEST['userid'] . ')});</script>';
            }
        }
        ?>
			<br/><br/>
			<span id="mainwp_posts_loading" class="mainwp-grabbing-info-note"> <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_posts_error"></div>
		<div id="mainwp_posts_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="publish"><?php 
        _e('Publish', 'mainwp');
        ?>
</option>
					<option value="unpublish"><?php 
        _e('Unpublish', 'mainwp');
        ?>
</option>
					<option value="trash"><?php 
        _e('Move to Trash', 'mainwp');
        ?>
</option>
					<option value="restore"><?php 
        _e('Restore', 'mainwp');
        ?>
</option>
					<option value="delete"><?php 
        _e('Delete Permanently', 'mainwp');
        ?>
</option>
				</select>
				<input type="button" name="" id="mainwp_bulk_post_action_apply" class="button" value="<?php 
        _e('Apply', 'mainwp');
        ?>
"/>
			</div>
			<div class="alignright" id="mainwp_posts_total_results">
				<?php 
        _e('Total Results:', 'mainwp');
        ?>
				<span id="mainwp_posts_total"><?php 
        echo $cachedSearch != null ? $cachedSearch['count'] : '0';
        ?>
</span>
			</div>
			<div class="clear"></div>
			<div id="mainwp_posts_content">
				<table class="wp-list-table widefat fixed posts tablesorter" id="mainwp_posts_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="title" class="manage-column column-title sortable desc" style="">
							<a href="#" onclick="return false;"><span><?php 
        _e('Title', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
						</th>
						<th scope="col" id="author" class="manage-column column-author sortable desc" style="">
							<a href="#" onclick="return false;"><span><?php 
        _e('Author', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
						</th>
						<th scope="col" id="categories" class="manage-column column-categories sortable desc" style="">
							<a href="#" onclick="return false;"><span><?php 
        _e('Categories', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
						</th>
						<th scope="col" id="tags" class="manage-column column-tags sortable desc" style="">
							<a href="#" onclick="return false;"><span><?php 
        _e('Tags', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
						</th>
						<th scope="col" id="comments" class="manage-column column-comments num sortable desc" style="">
							<a href="#" onclick="return false;">
                                <span><span class="vers"><img alt="Comments"
			                                src="<?php 
        echo admin_url('images/comment-grey-bubble.png');
        ?>
"></span></span>
								<span class="sorting-indicator"></span>
							</a>
						</th>
						<th scope="col" id="date" class="manage-column column-date sortable asc" style="">
							<a href="#" onclick="return false;"><span><?php 
        _e('Date', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
						</th>
						<th scope="col" id="status" class="manage-column column-status sortable asc" style="width: 120px;">
							<a href="#" onclick="return false;"><span><?php 
        _e('Status', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
						</th>
						<th scope="col" id="categories" class="manage-column column-categories 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="title" class="manage-column column-title sortable desc" style="">
							<a href="#" onclick="return false;"><span><?php 
        _e('Title', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
						</th>
						<th scope="col" id="author" class="manage-column column-author sortable desc" style="">
							<a href="#" onclick="return false;"><span><?php 
        _e('Author', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
						</th>
						<th scope="col" id="categories" class="manage-column column-categories sortable desc" style="">
							<a href="#" onclick="return false;"><span><?php 
        _e('Categories', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
						</th>
						<th scope="col" id="tags" class="manage-column column-tags sortable desc" style="">
							<a href="#" onclick="return false;"><span><?php 
        _e('Tags', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
						</th>
						<th scope="col" id="comments" class="manage-column column-comments num sortable desc" style="">
							<a href="#" onclick="return false;">
                                <span><span class="vers"><img alt="Comments"
			                                src="<?php 
        echo admin_url('images/comment-grey-bubble.png');
        ?>
"></span></span>
								<span class="sorting-indicator"></span>
							</a>
						</th>
						<th scope="col" id="date" class="manage-column column-date sortable asc" style="">
							<a href="#" onclick="return false;"><span><?php 
        _e('Date', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
						</th>
						<th scope="col" id="status" class="manage-column column-status sortable asc" style="width: 120px;">
							<a href="#" onclick="return false;"><span><?php 
        _e('Status', 'mainwp');
        ?>
</span><span class="sorting-indicator"></span></a>
						</th>
						<th scope="col" id="categories" class="manage-column column-categories 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-posts-list" class="list:posts">
					<?php 
        MainWP_Cache::echoBody('Post');
        ?>
					</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('Posts per page', 'mainwp');
        ?>
</span>
					</form>
				</div>
				<div class="clear"></div>
			</div>
		</div>
		<?php 
        if ($cachedSearch != null) {
            echo '<script>mainwp_posts_table_reinit();</script>';
        }
        self::renderFooter('BulkManage');
    }
Ejemplo n.º 5
0
    public static function renderPluginsTable($favoritesCallback = '')
    {
        global $tab;
        if (!mainwp_current_user_can("dashboard", "install_plugins")) {
            mainwp_do_not_have_permissions(__('install plugins', 'mainwp'));
            return;
        }
        ?>
		<a href="#" id="MainWPInstallBulkNavSearch" class="mainwp_action left <?php 
        echo $tab !== 'upload' ? 'mainwp_action_down' : '';
        ?>
" ><?php 
        _e('Search', 'mainwp');
        ?>
</a><a href="#" id="MainWPInstallBulkNavUpload" class="mainwp_action <?php 
        echo $tab === 'upload' ? 'mainwp_action_down' : '';
        ?>
 right upload" ><?php 
        _e('Upload', 'mainwp');
        ?>
</a>
		<br class="clear" /><br />

		<div class="mainwp_config_box_left" style="width: calc(100% - 290px);">
			<div class="error below-h2" style="display: none;" id="ajax-error-zone"></div>
			<div class="mainwp-upload-plugin">
				<?php 
        MainWP_Install_Bulk::renderUpload('Plugins');
        ?>
			</div>
			<div class="mainwp-browse-plugins hide-if-upload">
				<?php 
        self::$pluginsTable->views();
        ?>
				<form id="plugin-filter" method="post">
					<?php 
        self::$pluginsTable->display();
        ?>
				</form>
			</div>
			<div style="clear: both;"></div>
		</div>

		<script type="text/javascript">
			//mainwp_install_set_install_links();
		</script>

		<?php 
        MainWP_UI::select_sites_box(__("Step 2: Select Sites", 'mainwp'), 'checkbox', true, true, 'mainwp_select_sites_box_right');
        ?>

		<div class="mainwp_config_box_right">
			<div class="postbox">
				<h3 class="mainwp_box_title"><i class="fa fa-cog"></i> <?php 
        _e('Step 3: Installation Options', 'mainwp');
        ?>
</h3>
				<div class="inside">
					<input type="checkbox" value="1" checked id="chk_activate_plugin" /> <label for="chk_activate_plugin"><?php 
        _e('Activate Plugin After Installation', 'mainwp');
        ?>
</label><br/>
					<input type="checkbox" value="2" checked id="chk_overwrite" /> <label for="chk_overwrite"><?php 
        _e('Overwrite Existing Plugin, if already installed', 'mainwp');
        ?>
</label>
				</div>
			</div>
			<input type="button" value="<?php 
        _e("Complete Installation", 'mainwp');
        ?>
" class="button-primary button button-hero button-right hide-if-upload" id="mainwp_plugin_bulk_install_btn" name="bulk-install">
			<input type="button" value="<?php 
        _e('Complete Installation', 'mainwp');
        ?>
" class="button-primary button button-hero button-right show-if-upload" onClick="mainwp_upload_bulk('plugins');">
		</div>
		<div style="clear: both;"></div>

		<?php 
        if (!empty($favoritesCallback)) {
            ?>
			<script type="text/javascript">
				jQuery(document).ready(function () {
					<?php 
            echo $favoritesCallback . '()';
            ?>
				});
			</script>
			<?php 
        }
    }
Ejemplo n.º 6
0
    public static function renderBulkAdd()
    {
        if (isset($_POST['user_chk_bulkupload']) && $_POST['user_chk_bulkupload']) {
            self::renderBulkUpload();
            return;
        }
        ?>
		<?php 
        self::renderHeader('Add');
        ?>
		<?php 
        if (isset($errors) && count($errors) > 0) {
            ?>
			<div class="error below-h2">
				<?php 
            foreach ($errors as $error) {
                ?>
					<p><strong>ERROR</strong>: <?php 
                echo $error;
                ?>
</p>
				<?php 
            }
            ?>
			</div>
		<?php 
        }
        ?>
		<div class="error below-h2" style="display: none;" id="ajax-error-zone"></div>
		<!--            <div id="ajax-response"></div>-->
		<div id="MainWP_Bulk_AddUserLoading" class="updated">
            <div><i class="fa fa-spinner fa-pulse"></i> <?php 
        _e('Adding the user', 'mainwp');
        ?>
</div>
        </div>
		<div id="MainWP_Bulk_AddUser">

			<form action="" method="post" name="createuser" id="createuser" class="add:users: validate" enctype="multipart/form-data">
				<div class="mainwp_config_box_right">
					<?php 
        MainWP_UI::select_sites_box(__('Select Sites', 'mainwp'));
        ?>
				</div>
				<div class="mainwp_config_box_left" style="width: calc(100% - 290px);">
					<div class="postbox">
                		<h3 class="mainwp_box_title"><span><i class="fa fa-user-plus"></i> <?php 
        _e('Add a Single User', 'mainwp');
        ?>
</span></h3>

                    	<div class="inside">
							<table class="form-table">
								<tr class="form-field form-required">
									<th scope="row"><label for="user_login"><?php 
        _e('Username', 'mainwp');
        ?>
											<span class="description"><?php 
        _e('(required)', 'mainwp');
        ?>
</span></label>
									</th>
									<td>
										<input class="" name="user_login" type="text" id="user_login" value="<?php 
        if (isset($_POST['user_login'])) {
            echo $_POST['user_login'];
        }
        ?>
" aria-required="true"/></td>
								</tr>
								<tr class="form-field form-required">
									<th scope="row"><label for="email"><?php 
        _e('E-mail', 'mainwp');
        ?>
 <span
												class="description"><?php 
        _e('(required)', 'mainwp');
        ?>
</span></label>
									</th>
									<td>
										<input class="" name="email" type="text" id="email" value="<?php 
        if (isset($_POST['email'])) {
            echo $_POST['email'];
        }
        ?>
"/></td>
								</tr>
								<tr class="form-field">
									<th scope="row">
										<label for="first_name"><?php 
        _e('First Name', 'mainwp');
        ?>
 </label></th>
									<td>
										<input class="" name="first_name" type="text" id="first_name" value="<?php 
        if (isset($_POST['first_name'])) {
            echo $_POST['first_name'];
        }
        ?>
"/></td>
								</tr>
								<tr class="form-field">
									<th scope="row">
										<label for="last_name"><?php 
        _e('Last Name', 'mainwp');
        ?>
 </label></th>
									<td>
										<input class="" name="last_name" type="text" id="last_name" value="<?php 
        if (isset($_POST['last_name'])) {
            echo $_POST['last_name'];
        }
        ?>
"/></td>
								</tr>
								<tr class="form-field">
									<th scope="row"><label for="url"><?php 
        _e('Website', 'mainwp');
        ?>
</label></th>
									<td>
										<input class="" name="url" type="text" id="url" class="code" value="<?php 
        if (isset($_POST['url'])) {
            echo $_POST['url'];
        }
        ?>
"/></td>
								</tr>
								<?php 
        global $wp_version;
        if (version_compare('4.3-alpha', $wp_version, '>=')) {
            ?>
									<tr class="form-field form-required">
										<th scope="row"><label for="pass1"><?php 
            _e('Password', 'mainwp');
            ?>
 <span
													class="description"><?php 
            _e('(twice, required)', 'mainwp');
            ?>
</span></label>
										</th>
										<td>
											<input class="" name="pass1" type="password" id="pass1" autocomplete="off"/>
											<br/>
											<input class="" name="pass2" type="password" id="pass2" autocomplete="off"/>
											<br/>

											<div id="pass-strength-result" style="display: block"><?php 
            _e('Strength Indicator', 'mainwp');
            ?>
</div>
											<br><br>
										</td>
									</tr>

								<?php 
        } else {
            ?>
									<tr class="form-field form-required user-pass1-wrap">
										<th scope="row">
											<label for="pass1">
												<?php 
            _e('New Password', 'mainwp');
            ?>
												<span class="description hide-if-js"><?php 
            _e('(required)', 'mainwp');
            ?>
</span>
											</label>
										</th>
										<td>
											<input class="hidden" value=" "/><!-- #24364 workaround -->
											<div class="wp-pwd123">
												<?php 
            $initial_password = wp_generate_password(24);
            ?>
												<span class="password-input-wrapper">
                                        <input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php 
            echo esc_attr($initial_password);
            ?>
" aria-describedby="pass-strength-result"/>
                                    </span>
												<button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php 
            esc_attr_e('Hide password', 'mainwp');
            ?>
">
													<span class="dashicons dashicons-hidden"></span>
													<span class="text"><?php 
            _e('Hide', 'mainwp');
            ?>
</span>
												</button>
												<!--                   				<button type="button" class="button button-secondary wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="--><?php 
            //esc_attr_e( 'Cancel password change' );
            ?>
<!--">-->
												<!--                   					<span class="text">--><?php 
            //_e( 'Cancel' );
            ?>
<!--</span>-->
												<!--                   				</button>-->
												<div style="display:none" id="pass-strength-result" aria-live="polite"></div>
											</div>
										</td>
									</tr>
									<tr class="form-field form-required user-pass2-wrap hide-if-js">
										<td scope="row"><label for="pass2"><?php 
            _e('Repeat Password', 'mainwp');
            ?>
												<span class="description"><?php 
            _e('(required)', 'mainwp');
            ?>
</span></label>
										</td>
										<td>
											<input name="pass2" type="password" id="pass2" value="<?php 
            echo esc_attr($initial_password);
            ?>
" autocomplete="off"/>
										</td>
									</tr>
								<?php 
        }
        ?>
								<tr>
									<td colspan="2">
										<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>
									</td>
								</tr>
								<tr>
									<th scope="row">
										<label for="send_password"><?php 
        _e('Send Password?', 'mainwp');
        ?>
</label>
									</th>
									<td><label for="send_password"><input type="checkbox" name="send_password"
												id="send_password" <?php 
        if (isset($_POST['send_password'])) {
            echo 'checked';
        }
        ?>
 /> <?php 
        _e('Send this password to the new user by email.', 'mainwp');
        ?>
										</label></td>
								</tr>
								<tr class="form-field">
									<th scope="row"><label for="role"><?php 
        _e('Role', 'mainwp');
        ?>
</label></th>
									<td>
										<select name="role" id="role">
											<option value='subscriber' <?php 
        if (isset($_POST['role']) && $_POST['role'] == 'subscriber') {
            echo 'selected';
        }
        ?>
><?php 
        _e('Subscriber', 'mainwp');
        ?>
											</option>
											<option value='administrator' <?php 
        if (isset($_POST['role']) && $_POST['role'] == 'administrator') {
            echo 'selected';
        }
        ?>
><?php 
        _e('Administrator', 'mainwp');
        ?>
											</option>
											<option value='editor' <?php 
        if (isset($_POST['role']) && $_POST['role'] == 'editor') {
            echo 'selected';
        }
        ?>
><?php 
        _e('Editor', 'mainwp');
        ?>
											</option>
											<option value='author' <?php 
        if (isset($_POST['role']) && $_POST['role'] == 'author') {
            echo 'selected';
        }
        ?>
><?php 
        _e('Author', 'mainwp');
        ?>
											</option>
											<option value='contributor' <?php 
        if (isset($_POST['role']) && $_POST['role'] == 'contributor') {
            echo 'selected';
        }
        ?>
><?php 
        _e('Contributor', 'mainwp');
        ?>
											</option>
										</select>
									</td>
								</tr>
							</table>
						</div>
					</div>
					<div class="postbox">
                        <h3 class="mainwp_box_title"><span><i class="fa fa-user-plus"></i> <?php 
        _e('Bulk Upload', 'mainwp');
        ?>
</span></h3>

						<div class="inside">
							<table>
								<tr>
									<th scope="row"></th>
									<td>
										<input type="file" name="import_user_file_bulkupload"
											id="import_user_file_bulkupload" accept="text/comma-separated-values"
											class="regular-text" disabled="disabled"/>
                                       <span
	                                       class="description"><?php 
        _e('File must be in CSV format.', 'mainwp');
        ?>
	                                       <a href="https://mainwp.com/csv/sample_users.csv" target="_blank"><?php 
        _e('Click here to download sample CSV file.', 'mainwp');
        ?>
</a></span>

										<div>
											<p>
												<input type="checkbox" name="user_chk_bulkupload"
													id="user_chk_bulkupload" value="1"/>
												<span class="description"><?php 
        _e('Upload file', 'mainwp');
        ?>
</span>
											</p>

											<p>
												<input type="checkbox" name="import_user_chk_header_first" disabled="disabled" checked="checked"
													id="import_user_chk_header_first" value="1"/>
												<span class="description"><?php 
        _e('CSV file contains a header.', 'mainwp');
        ?>
</span>
											</p>
										</div>
									</td>
								</tr>

							</table>
						</div>
					</div>
				</div>

				<div class="clear"></div>
				<p class="submit"><input type="button" name="createuser" id="bulk_add_createuser" class="button-primary button button-hero"
						value="<?php 
        _e('Add New User', 'mainwp');
        ?>
 "/></p>
			</form>
		</div>
		<?php 
        self::renderFooter('Add');
    }
    public static function renderNewEdit($task)
    {
        $selected_websites = array();
        $selected_groups = array();
        if ($task != null) {
            if ($task->sites != '') {
                $selected_websites = explode(',', $task->sites);
            }
            if ($task->groups != '') {
                $selected_groups = explode(',', $task->groups);
            }
        }
        $remote_destinations = apply_filters('mainwp_backups_remote_get_destinations', null, $task != null ? array('task' => $task->id) : array());
        $hasRemoteDestinations = $remote_destinations == null ? $remote_destinations : count($remote_destinations);
        ?>
		<div class="mainwp_managbackups_taskoptions">
			<?php 
        //to add CSS Styling to the select sites box use the one below (this adds the css class mainwp_select_sites_box_right to the box)
        //MainWP_UI::select_sites_box(__("Select Sites"), 'checkbox', true, true, 'mainwp_select_sites_box_right', '', $selected_websites, $selected_groups);
        ?>

			<?php 
        MainWP_UI::select_sites_box(__('Select Sites', 'mainwp'), 'checkbox', true, true, 'mainwp_select_sites_box_right', 'float: right !important; clear: both;', $selected_websites, $selected_groups, true);
        ?>
			<div class="mainwp_config_box_left" style="width: calc(100% - 290px);">

				<div class="postbox">
					<h3 class="mainwp_box_title">
						<span><i class="fa fa-history"></i> <?php 
        _e('Schedule Backup', 'mainwp');
        ?>
</span></h3>

					<div class="inside">
						<table class="form-table" style="width: 100%">
							<tr class="form-field form-required">
								<th scope="row"><?php 
        _e('Task Name:', 'mainwp');
        ?>
</th>
								<td>
									<input type="text" id="mainwp_managebackups_add_name" class="" name="mainwp_managebackups_add_name" value="<?php 
        echo isset($task) ? $task->name : '';
        ?>
"/><span class="mainwp-form_hint">e.g. Site1 Daily, Site1 Full Weekly, ...</span>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
        _e('Task Schedule:', 'mainwp');
        ?>
</th>
								<td>
									<a class="mainwp_action left backuptaskschedule <?php 
        echo !isset($task) || $task->schedule == 'daily' ? 'mainwp_action_down' : '';
        ?>
" href="#" id="mainwp_managebackups_schedule_daily"><?php 
        _e('DAILY', 'mainwp');
        ?>
</a><a class="mainwp_action mid backuptaskschedule <?php 
        echo isset($task) && $task->schedule == 'weekly' ? 'mainwp_action_down' : '';
        ?>
" href="#" id="mainwp_managebackups_schedule_weekly"><?php 
        _e('WEEKLY', 'mainwp');
        ?>
</a><a class="mainwp_action right backuptaskschedule <?php 
        echo isset($task) && $task->schedule == 'monthly' ? 'mainwp_action_down' : '';
        ?>
" href="#" id="mainwp_managebackups_schedule_monthly"><?php 
        _e('MONTHLY', 'mainwp');
        ?>
</a>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
        _e('Backup File Name:', 'mainwp');
        ?>
</th>
								<td>
									<input type="text" name="backup_filename" id="backup_filename" class="" value="<?php 
        echo isset($task) ? $task->filename : '';
        ?>
"/><span class="mainwp-form_hint" style="display: inline; max-width: 500px;">Allowed Structure Tags: <strong>%url%</strong>, <strong>%date%</strong>, <strong>%time%</strong>, <strong>%type%</strong></span>
								</td>
							</tr>
							<tr>
								<td colspan="2">
									<hr/>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
        _e('Backup Type:', 'mainwp');
        ?>
</th>
								<td>
									<a class="mainwp_action left <?php 
        echo !isset($task) || $task->type != 'db' ? 'mainwp_action_down' : '';
        ?>
" href="#" id="backup_type_full"><?php 
        _e('FULL BACKUP', 'mainwp');
        ?>
</a><a class="mainwp_action right <?php 
        echo isset($task) && $task->type == 'db' ? 'mainwp_action_down' : '';
        ?>
" href="#" id="backup_type_db"><?php 
        _e('DATABASE BACKUP', 'mainwp');
        ?>
</a>
								</td>
							</tr>
							<tr class="mainwp_backup_exclude_files_content" <?php 
        echo isset($task) && $task->type == 'db' ? 'style="display: none;"' : '';
        ?>
>
								<td colspan="2">
									<hr/>
								</td>
							</tr>
							<tr class="mainwp-exclude-suggested">
								<th scope="row" style="vertical-align: top"><?php 
        _e('Suggested Exclude', 'mainwp');
        ?>
:</th>
								<td>
									<p style="background: #7fb100; color: #ffffff; padding: .5em;"><?php 
        _e('Every WordPress website is different but the sections below generally do not need to be backed up and since many of them are large in size they can even cause issues with your backup including server timeouts.', 'mainwp');
        ?>
</p>
								</td>
							</tr>
							<tr class="mainwp-exclude-backup-locations">
								<td colspan="2"><h4>
										<i class="fa fa-cloud-upload"></i> <?php 
        _e('Known Backup Locations', 'mainwp');
        ?>
									</h4></td>
							</tr>
							<tr class="mainwp-exclude-backup-locations">
								<td>
									<label for="mainwp-known-backup-locations"><?php 
        _e('Exclude', 'mainwp');
        ?>
</label><input type="checkbox" id="mainwp-known-backup-locations" <?php 
        echo !isset($task) || $task->excludebackup == 1 ? 'checked' : '';
        ?>
>
								</td>
								<td class="mainwp-td-des">
									<a href="#" id="mainwp-show-kbl-folders"><?php 
        _e('+ Show Excluded Folders', 'mainwp');
        ?>
</a><a href="#" id="mainwp-hide-kbl-folders"><?php 
        _e('- Hide Excluded Folders', 'mainwp');
        ?>
</a><br/>
									<textarea id="mainwp-kbl-content" disabled></textarea>
									<br/><?php 
        _e('This adds known backup locations of popular WordPress backup plugins to the exclude list.  Old backups can take up a lot of space and can cause your current MainWP backup to timeout.', 'mainwp');
        ?>
								</td>
							</tr>
							<tr class="mainwp-exclude-separator">
								<td colspan="2" style="padding: 0 !important;">
									<hr/>
								</td>
							</tr>
							<tr class="mainwp-exclude-cache-locations">
								<td colspan="2"><h4>
										<i class="fa fa-cubes"></i> <?php 
        _e('Known Cache Locations', 'mainwp');
        ?>
									</h4></td>
							</tr>
							<tr class="mainwp-exclude-cache-locations">
								<td>
									<label for="mainwp-known-cache-locations"><?php 
        _e('Exclude', 'mainwp');
        ?>
</label><input type="checkbox" id="mainwp-known-cache-locations" <?php 
        echo !isset($task) || $task->excludecache == 1 ? 'checked' : '';
        ?>
>
								</td>
								<td class="mainwp-td-des">
									<a href="#" id="mainwp-show-kcl-folders"><?php 
        _e('+ Show Excluded Folders', 'mainwp');
        ?>
</a><a href="#" id="mainwp-hide-kcl-folders"><?php 
        _e('- Hide Excluded Folders', 'mainwp');
        ?>
</a><br/>
									<textarea id="mainwp-kcl-content" disabled></textarea>
									<br/><?php 
        _e('This adds known cache locations of popular WordPress cache plugins to the exclude list.  A cache can be massive with thousands of files and can cause your current MainWP backup to timeout.  Your cache will be rebuilt by your caching plugin when the backup is restored.', 'mainwp');
        ?>
								</td>
							</tr>
							<tr class="mainwp-exclude-separator">
								<td colspan="2" style="padding: 0 !important;">
									<hr/>
								</td>
							</tr>
							<tr class="mainwp-exclude-nonwp-folders">
								<td colspan="2"><h4>
										<i class="fa fa-folder"></i> <?php 
        _e('Non-WordPress Folders', 'mainwp');
        ?>
									</h4></td>
							</tr>
							<tr class="mainwp-exclude-nonwp-folders">
								<td>
									<label for="mainwp-non-wordpress-folders"><?php 
        _e('Exclude', 'mainwp');
        ?>
</label><input type="checkbox" id="mainwp-non-wordpress-folders" <?php 
        echo !isset($task) || $task->excludenonwp == 1 ? 'checked' : '';
        ?>
>
								</td>
								<td class="mainwp-td-des">
									<a href="#" id="mainwp-show-nwl-folders"><?php 
        _e('+ Show Excluded Folders', 'mainwp');
        ?>
</a><a href="#" id="mainwp-hide-nwl-folders"><?php 
        _e('- Hide Excluded Folders', 'mainwp');
        ?>
</a><br/>
									<textarea id="mainwp-nwl-content" disabled></textarea>
									<br/><?php 
        _e('This adds folders that are not part of the WordPress core (wp-admin, wp-content and wp-include) to the exclude list. Non-WordPress folders can contain a large amount of data or may be a sub-domain or add-on domain that should be backed up individually and not with this backup.', 'mainwp');
        ?>
								</td>
							</tr>
							<tr class="mainwp-exclude-separator">
								<td colspan="2" style="padding: 0 !important;">
									<hr/>
								</td>
							</tr>
							<tr class="mainwp-exclude-zips">
								<td colspan="2"><h4>
										<i class="fa fa-file-archive-o"></i> <?php 
        _e('ZIP Archives', 'mainwp');
        ?>
									</h4></td>
							</tr>
							<tr class="mainwp-exclude-zips">
								<td>
									<label for="mainwp-zip-archives"><?php 
        _e('Exclude', 'mainwp');
        ?>
</label><input type="checkbox" id="mainwp-zip-archives" <?php 
        echo !isset($task) || $task->excludezip == 1 ? 'checked' : '';
        ?>
>
								</td>
								<td class="mainwp-td-des"><?php 
        _e('Zip files can be large and are often not needed for a WordPress backup. Be sure to deselect this option if you do have zip files you need backed up.', 'mainwp');
        ?>
</td>
							</tr>
							<tr class="mainwp-exclude-separator">
								<td colspan="2" style="padding: 0 !important;">
									<hr/>
								</td>
							</tr>
							<tr class="mainwp_backup_exclude_files_content" <?php 
        echo isset($task) && $task->type == 'db' ? 'style="display: none;"' : '';
        ?>
>
								<th scope="row" style="vertical-align: top"><h4 class="mainwp-custom-excludes">
										<i class="fa fa-minus-circle"></i> <?php 
        _e('Custom Excludes', 'mainwp');
        ?>
									</h4></th>
								<td>
									<p style="background: #7fb100; color: #ffffff; padding: .5em;"><?php 
        _e('Exclude any additional files that you do not need backed up for this site. Click a folder name to drill down into the directory.', 'mainwp');
        ?>
</p>
									<br/>
									<?php 
        printf(__('Click directories to navigate. Click the red sign ( <img style="margin-bottom: -3px;" src="%s"> ) to exclude a folder.', 'mainwp'), plugins_url('images/exclude.png', dirname(__FILE__)));
        ?>
									<br/><br/>
									<table class="mainwp_excluded_folders_cont">
										<tr>
											<td style="width: 280px">
												<div id="backup_exclude_folders" class="mainwp_excluded_folders"></div>
											</td>
											<td>
												<?php 
        _e('Excluded files & directories:', 'mainwp');
        ?>
<br/>
                                <textarea id="excluded_folders_list"><?php 
        $excluded = isset($task) ? $task->exclude : '';
        if ($excluded != '') {
            $excluded = explode(',', $excluded);
            echo implode("/\n", $excluded) . "/\n";
        }
        ?>
</textarea>
											</td>
										</tr>
									</table>
									<span class="description"><strong><?php 
        _e('ATTENTION:', 'mainwp');
        ?>
</strong> <?php 
        _e('Do not exclude any folders if you are using this backup to clone or migrate the wordpress installation.', 'mainwp');
        ?>
</span>
								</td>
							</tr>
							<tr>
								<td colspan="2">
									<hr/>
								</td>
							</tr>
							<?php 
        if ($hasRemoteDestinations !== null) {
            ?>
								<tr>
									<th scope="row"><?php 
            _e('Store Backup In:', 'mainwp');
            ?>
</th>
									<td>
										<a class="mainwp_action left <?php 
            echo !$hasRemoteDestinations ? 'mainwp_action_down' : '';
            ?>
" href="#" id="backup_location_local"><?php 
            _e('LOCAL SERVER ONLY', 'mainwp');
            ?>
</a><a class="mainwp_action right <?php 
            echo $hasRemoteDestinations ? 'mainwp_action_down' : '';
            ?>
" href="#" id="backup_location_remote"><?php 
            _e('REMOTE DESTINATION', 'mainwp');
            ?>
</a>
									</td>
								</tr>
								<tr class="mainwp_backup_destinations" <?php 
            echo !$hasRemoteDestinations ? 'style="display: none;"' : '';
            ?>
>
									<th scope="row"><?php 
            _e('Backup Subfolder:', 'mainwp');
            ?>
</th>
									<td>
										<input type="text" id="mainwp_managebackups_add_subfolder" name="backup_subfolder"
											value="<?php 
            echo isset($task) ? $task->subfolder : 'MainWP Backups/%url%/%type%/%date%';
            ?>
"/><span class="mainwp-form_hint" style="display: inline; max-width: 500px;">Allowed Structure Tags: <strong>%sitename%</strong>, <strong>%url%</strong>, <strong>%date%</strong>, <strong>%task%</strong>, <strong>%type%</strong></span>
									</td>
								</tr>
								<?php 
        }
        ?>
							<?php 
        do_action('mainwp_backups_remote_settings', array('task' => $task));
        ?>
							<tr>
								<td colspan="2">
									<hr/>
								</td>
							</tr>
							<?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';
                    }
                }
            }
        }
        $archiveFormat = isset($task) ? $task->archiveFormat : 'site';
        $useGlobal = $archiveFormat == 'global';
        $useSite = $archiveFormat == '' || $archiveFormat == 'site';
        ?>
							<tr>
								<th scope="row"><?php 
        _e('Archive Format', '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="site" <?php 
        if ($useSite) {
            ?>
selected<?php 
        }
        ?>
>Site specific setting</option>
		                                <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_site" class="archive_info" <?php 
        if (!$useSite) {
            ?>
style="display: none;"<?php 
        }
        ?>
>Depends on the settings of the child site</span>
                                <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 = isset($task) ? $task->maximumFileDescriptorsOverride == 1 : false;
        $maximumFileDescriptorsAuto = isset($task) ? $task->maximumFileDescriptorsAuto == 1 : false;
        $maximumFileDescriptors = isset($task) ? $task->maximumFileDescriptors : 150;
        ?>
							<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');
        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">Load files in memory before zipping <?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 (!isset($task) || $task->loadFilesBeforeZip == false || $task->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 (isset($task) && $task->loadFilesBeforeZip == 2) {
            ?>
checked="true"<?php 
        }
        ?>
/> Yes<br/>
									<input type="radio" name="mainwp_options_loadFilesBeforeZip" id="mainwp_options_loadFilesBeforeZip_no" value="0" <?php 
        if (isset($task) && $task->loadFilesBeforeZip == 0) {
            ?>
checked="true"<?php 
        }
        ?>
/> No<br/>
								</td>
							</tr>
						</table>
					</div>
				</div>
			</div>
			<div class="clear"></div>

		</div>
		<?php 
        if ($task != null) {
            ?>
			<input type="hidden" id="backup_task_id" value="<?php 
            echo $task->id;
            ?>
"/>
			<script>mainwp_managebackups_updateExcludefolders();</script>
			<?php 
        }
    }
    public static function render()
    {
        $show_form = true;
        if (isset($_POST['updateadminpassword'])) {
            check_admin_referer('mainwp_updateadminpassword', 'security');
            $errors = array();
            if (isset($_POST['select_by'])) {
                $selected_sites = array();
                if (isset($_POST['selected_sites']) && is_array($_POST['selected_sites'])) {
                    foreach ($_POST['selected_sites'] as $selected) {
                        $selected_sites[] = $selected;
                    }
                }
                $selected_groups = array();
                if (isset($_POST['selected_groups']) && is_array($_POST['selected_groups'])) {
                    foreach ($_POST['selected_groups'] as $selected) {
                        $selected_groups[] = $selected;
                    }
                }
                if ($_POST['select_by'] == 'group' && count($selected_groups) == 0 || $_POST['select_by'] == 'site' && count($selected_sites) == 0) {
                    $errors[] = __('Please select the sites or groups where you want to change the admin password.', 'mainwp');
                }
            } else {
                $errors[] = __('Please select whether you want to change the admin password for specific sites or groups.', 'mainwp');
            }
            if (!isset($_POST['pass1']) || $_POST['pass1'] == '' || !isset($_POST['pass2']) || $_POST['pass2'] == '') {
                $errors[] = __('Please enter the password twice.', 'mainwp');
            } else {
                if ($_POST['pass1'] != $_POST['pass2']) {
                    $errors[] = __('Please enter the same password in the two password fields.', 'mainwp');
                }
            }
            if (count($errors) == 0) {
                $show_form = false;
                $new_password = array('user_pass' => $_POST['pass1']);
                $dbwebsites = array();
                if ($_POST['select_by'] == 'site') {
                    //Get all selected websites
                    foreach ($selected_sites as $k) {
                        if (MainWP_Utility::ctype_digit($k)) {
                            $website = MainWP_DB::Instance()->getWebsiteById($k);
                            $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                        }
                    }
                } else {
                    //Get all websites from the selected groups
                    foreach ($selected_groups as $k) {
                        if (MainWP_Utility::ctype_digit($k)) {
                            $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($k));
                            while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                                if ($website->sync_errors != '') {
                                    continue;
                                }
                                $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                            }
                            @MainWP_DB::free_result($websites);
                        }
                    }
                }
                if (count($dbwebsites) > 0) {
                    $post_data = array('new_password' => base64_encode(serialize($new_password)));
                    $output = new stdClass();
                    $output->ok = array();
                    $output->errors = array();
                    MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'newadminpassword', $post_data, array(MainWP_Bulk_Add::getClassName(), 'PostingBulk_handler'), $output);
                }
            }
        }
        if (!$show_form) {
            //Added to..
            ?>
			<div class="wrap">
                <h2 id="add-new-user"><i class="fa fa-key"></i> Update Admin Passwords</h2>

				<div id="message" class="updated">
					<?php 
            foreach ($dbwebsites as $website) {
                ?>
						<p>
							<a href="<?php 
                echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
                ?>
"><?php 
                echo stripslashes($website->name);
                ?>
</a>: <?php 
                echo isset($output->ok[$website->id]) && $output->ok[$website->id] == 1 ? __('Admin password updated.', 'mainwp') : __('ERROR: ', 'mainwp') . $output->errors[$website->id];
                ?>
						</p>
					<?php 
            }
            ?>
				</div>
				<br/>
				<a href="<?php 
            echo get_admin_url();
            ?>
admin.php?page=UpdateAdminPasswords" class="add-new-h2" target="_top"><?php 
            _e('Update admin passwords', '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 
        } else {
            wp_enqueue_script('user-profile');
            // header in User page
            MainWP_User::renderHeader('UpdateAdminPasswords');
            ?>
			<form action="" method="post" name="createuser" id="createuser" class="add:users: validate">

				<input type="hidden" name="security" value="<?php 
            echo wp_create_nonce('mainwp_updateadminpassword');
            ?>
"/>

				<div class="mainwp_config_box_right">
					<?php 
            MainWP_UI::select_sites_box(__('Select Sites to Update', 'mainwp'));
            ?>
				</div>

				<div class="mainwp_config_box_left postbox mainwp-postbox">
					<h3 class="mainwp_box_title">
						<i class="fa fa-key"></i> <?php 
            _e('Bulk Update Administrator Passwords', 'mainwp');
            ?>
</h3>

					<div class="inside">
						<table class="form-table">
							<?php 
            global $wp_version;
            if (version_compare('4.3-alpha', $wp_version, '>=')) {
                ?>
								<tr class="form-field form-required">
									<th scope="row"><label for="pass1"><?php 
                _e('Enter New Password ', 'mainwp');
                ?>
											<br/><span class="description"><?php 
                _e('(twice, required)', 'mainwp');
                ?>
</span></label>
									</th>
									<td>
										<input name="user_login" type="hidden" id="user_login" value="admin">
										<input class="" name="pass1" type="password" id="pass1" autocomplete="off"/>
										<br/>
										<input class="" name="pass2" type="password" id="pass2" autocomplete="off"/>
										<br/>

										<div id="pass-strength-result" style="display: block;"><?php 
                _e('Strength indicator', 'mainwp');
                ?>
</div>
										<p class="description indicator-hint" style="clear:both;"><?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>
									</td>
								</tr>
							<?php 
            } else {
                ?>
								<tr class="form-field form-required user-pass1-wrap">
									<th scope="row">
										<label for="pass1">
											<?php 
                _e('New Password', 'mainwp');
                ?>
											<span class="description hide-if-js"><?php 
                _e('(required)');
                ?>
</span>
										</label>
									</th>
									<td>
										<input class="hidden" value=" "/><!-- #24364 workaround -->
										<!--                   			<button type="button" class="button button-secondary wp-generate-pw hide-if-no-js">--><?php 
                //_e( 'Show password' );
                ?>
<!--</button>-->
										<div class="wp-pwd123">
											<?php 
                $initial_password = wp_generate_password(24);
                ?>
											<span class="password-input-wrapper">
												<input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php 
                echo esc_attr($initial_password);
                ?>
" aria-describedby="pass-strength-result"/>
											</span>
											<button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php 
                esc_attr_e('Hide password');
                ?>
">
												<span class="dashicons dashicons-hidden"></span>
												<span class="text"><?php 
                _e('Hide');
                ?>
</span>
											</button>
											<!--                   				<button type="button" class="button button-secondary wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="--><?php 
                //esc_attr_e( 'Cancel password change' );
                ?>
<!--">-->
											<!--                   					<span class="text">--><?php 
                //_e( 'Cancel' );
                ?>
<!--</span>-->
											<!--                                </button>-->
											<div style="display:none" id="pass-strength-result" aria-live="polite"></div>
										</div>
									</td>
								</tr>
								<tr class="form-field form-required user-pass2-wrap hide-if-js">
									<td scope="row"><label for="pass2"><?php 
                _e('Repeat Password');
                ?>
											<span class="description"><?php 
                _e('(required)');
                ?>
</span></label></td>
									<td>
										<input name="pass2" type="password" id="pass2" value="<?php 
                echo esc_attr($initial_password);
                ?>
" autocomplete="off"/>
									</td>
								</tr>
							<?php 
            }
            ?>
							<tr>
								<td colspan="2">
									<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>
								</td>
							</tr>
							<tr>
								<td></td>
								<td colspan="2">
									<input type="submit" name="updateadminpassword" id="bulk_updateadminpassword" class="button-primary button button-hero" value="<?php 
            _e('Update Now', 'mainwp');
            ?>
"/>
								</td>
							</tr>
						</table>
					</div>
				</div>

			</form>
			<?php 
            MainWP_User::renderFooter('UpdateAdminPasswords');
        }
    }