Example #1
0
    public function settings_output()
    {
        if (false == ($render = apply_filters('updraftplus_settings_page_render', true))) {
            do_action('updraftplus_settings_page_render_abort', $render);
            return;
        }
        do_action('updraftplus_settings_page_init');
        global $updraftplus;
        /*
        we use request here because the initial restore is triggered by a POSTed form. we then may need to obtain credentials 
        for the WP_Filesystem. to do this WP outputs a form, but we don't pass our parameters via that. So the values are 
        passed back in as GET parameters.
        */
        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'updraft_restore' && isset($_REQUEST['backup_timestamp']) || 'updraft_restore_continue' == $_REQUEST['action'] && !empty($_REQUEST['restoreid']))) {
            $is_continuation = 'updraft_restore_continue' == $_REQUEST['action'] ? true : false;
            if ($is_continuation) {
                $restore_in_progress = get_site_option('updraft_restore_in_progress');
                if ($restore_in_progress != $_REQUEST['restoreid']) {
                    $abort_restore_already = true;
                    $updraftplus->log(__('Sufficient information about the in-progress restoration operation could not be found.', 'updraftplus') . ' (restoreid_mismatch)', 'error', 'restoreid_mismatch');
                } else {
                    $restore_jobdata = $updraftplus->jobdata_getarray($restore_in_progress);
                    if (is_array($restore_jobdata) && isset($restore_jobdata['job_type']) && 'restore' == $restore_jobdata['job_type'] && isset($restore_jobdata['second_loop_entities']) && !empty($restore_jobdata['second_loop_entities']) && isset($restore_jobdata['job_time_ms']) && isset($restore_jobdata['backup_timestamp'])) {
                        $backup_timestamp = $restore_jobdata['backup_timestamp'];
                        $continuation_data = $restore_jobdata;
                    } else {
                        $abort_restore_already = true;
                        $updraftplus->log(__('Sufficient information about the in-progress restoration operation could not be found.', 'updraftplus') . ' (restoreid_nojobdata)', 'error', 'restoreid_nojobdata');
                    }
                }
            } else {
                $backup_timestamp = $_REQUEST['backup_timestamp'];
                $continuation_data = null;
            }
            if (empty($abort_restore_already)) {
                $backup_success = $this->restore_backup($backup_timestamp, $continuation_data);
            } else {
                $backup_success = false;
            }
            if (empty($updraftplus->errors) && $backup_success === true) {
                // TODO: Deal with the case of some of the work having been deferred
                // If we restored the database, then that will have out-of-date information which may confuse the user - so automatically re-scan for them.
                $updraftplus->rebuild_backup_history();
                echo '<p><strong>';
                $updraftplus->log_e('Restore successful!');
                echo '</strong></p>';
                $updraftplus->log("Restore successful");
                $s_val = 1;
                if (!empty($this->entities_to_restore) && is_array($this->entities_to_restore)) {
                    foreach ($this->entities_to_restore as $k => $v) {
                        if ('db' != $v) {
                            $s_val = 2;
                        }
                    }
                }
                $pval = $updraftplus->have_addons ? 1 : 0;
                echo '<strong>' . __('Actions', 'updraftplus') . ':</strong> <a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&updraft_restore_success=' . $s_val . '&pval=' . $pval . '">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
                return;
            } elseif (is_wp_error($backup_success)) {
                echo '<p>';
                $updraftplus->log_e('Restore failed...');
                echo '</p>';
                $updraftplus->log_wp_error($backup_success);
                $updraftplus->log("Restore failed");
                $updraftplus->list_errors();
                echo '<strong>' . __('Actions', 'updraftplus') . ':</strong> <a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
                return;
            } elseif (false === $backup_success) {
                # This means, "not yet - but stay on the page because we may be able to do it later, e.g. if the user types in the requested information"
                echo '<p>';
                $updraftplus->log_e('Restore failed...');
                echo '</p>';
                $updraftplus->log("Restore failed");
                $updraftplus->list_errors();
                echo '<strong>' . __('Actions', 'updraftplus') . ':</strong> <a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
                return;
            }
        }
        if (isset($_REQUEST['action']) && 'updraft_delete_old_dirs' == $_REQUEST['action']) {
            $nonce = empty($_REQUEST['_wpnonce']) ? "" : $_REQUEST['_wpnonce'];
            if (!wp_verify_nonce($nonce, 'updraftplus-credentialtest-nonce')) {
                die('Security check');
            }
            $this->delete_old_dirs_go();
            return;
        }
        if (!empty($_REQUEST['action']) && 'updraftplus_broadcastaction' == $_REQUEST['action'] && !empty($_REQUEST['subaction'])) {
            $nonce = empty($_REQUEST['nonce']) ? "" : $_REQUEST['nonce'];
            if (!wp_verify_nonce($nonce, 'updraftplus-credentialtest-nonce')) {
                die('Security check');
            }
            do_action($_REQUEST['subaction']);
            return;
        }
        if (isset($_GET['error'])) {
            // This is used by Microsoft OneDrive authorisation failures (May 15). I am not sure what may have been using the 'error' GET parameter otherwise - but it is harmless.
            if (!empty($_GET['error_description'])) {
                $this->show_admin_warning(htmlspecialchars($_GET['error_description']) . ' (' . htmlspecialchars($_GET['error']) . ')', 'error');
            } else {
                $this->show_admin_warning(htmlspecialchars($_GET['error']), 'error');
            }
        }
        if (isset($_GET['message'])) {
            $this->show_admin_warning(htmlspecialchars($_GET['message']));
        }
        if (isset($_GET['action']) && $_GET['action'] == 'updraft_create_backup_dir' && isset($_GET['nonce']) && wp_verify_nonce($_GET['nonce'], 'create_backup_dir')) {
            $created = $this->create_backup_dir();
            if (is_wp_error($created)) {
                echo '<p>' . __('Backup directory could not be created', 'updraftplus') . '...<br/>';
                echo '<ul class="disc">';
                foreach ($created->get_error_messages() as $key => $msg) {
                    echo '<li>' . htmlspecialchars($msg) . '</li>';
                }
                echo '</ul></p>';
            } elseif ($created !== false) {
                echo '<p>' . __('Backup directory successfully created.', 'updraftplus') . '</p><br/>';
            }
            echo '<b>' . __('Actions', 'updraftplus') . ':</b> <a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
            return;
        }
        echo '<div id="updraft_backup_started" class="updated updraft-hidden" style="display:none;"></div>';
        if (isset($_POST['action']) && 'updraft_backup_debug_all' == $_POST['action']) {
            $updraftplus->boot_backup(true, true);
        } elseif (isset($_POST['action']) && 'updraft_backup_debug_db' == $_POST['action']) {
            $updraftplus->boot_backup(false, true, false, true);
        } elseif (isset($_POST['action']) && 'updraft_wipesettings' == $_POST['action']) {
            $settings = $updraftplus->get_settings_keys();
            foreach ($settings as $s) {
                UpdraftPlus_Options::delete_updraft_option($s);
            }
            // These aren't in get_settings_keys() because they are always in the options table, regardless of context
            global $wpdb;
            $wpdb->query("DELETE FROM {$wpdb->options} WHERE ( option_name LIKE 'updraftplus_unlocked_%' OR option_name LIKE 'updraftplus_locked_%' OR option_name LIKE 'updraftplus_last_lock_time_%' OR option_name LIKE 'updraftplus_semaphore_%' OR option_name LIKE 'updraft_jobdata_%' OR option_name LIKE 'updraft_last_scheduled_%' )");
            $site_options = array('updraft_oneshotnonce');
            foreach ($site_options as $s) {
                delete_site_option($s);
            }
            $this->show_admin_warning(__("Your settings have been wiped.", 'updraftplus'));
        }
        // This opens a div
        $this->settings_header();
        ?>

			<div id="updraft-hidethis">
			<p>
			<strong><?php 
        _e('Warning:', 'updraftplus');
        ?>
 <?php 
        _e("If you can still read these words after the page finishes loading, then there is a JavaScript or jQuery problem in the site.", 'updraftplus');
        ?>
</strong>

			<?php 
        if (false !== strpos(basename(UPDRAFTPLUS_URL), ' ')) {
            ?>
				<strong><?php 
            _e('The UpdraftPlus directory in wp-content/plugins has white-space in it; WordPress does not like this. You should rename the directory to wp-content/plugins/updraftplus to fix this problem.', 'updraftplus');
            ?>
</strong>
			<?php 
        } else {
            ?>
				<a href="https://updraftplus.com/do-you-have-a-javascript-or-jquery-error/"><?php 
            _e('Go here for more information.', 'updraftplus');
            ?>
</a>
			<?php 
        }
        ?>
			</p>
			</div>

			<?php 
        $include_deleteform_div = true;
        // Opens a div, which needs closing later
        if (isset($_GET['updraft_restore_success'])) {
            $success_advert = isset($_GET['pval']) && 0 == $_GET['pval'] && !$updraftplus->have_addons ? '<p>' . __('For even more features and personal support, check out ', 'updraftplus') . '<strong><a href="https://updraftplus.com/shop/updraftplus-premium/" target="_blank">UpdraftPlus Premium</a>.</strong></p>' : "";
            echo "<div class=\"updated backup-restored\"><span><strong>" . __('Your backup has been restored.', 'updraftplus') . '</strong></span><br>';
            // Unnecessary - will be advised of this below
            // 				if (2 == $_GET['updraft_restore_success']) echo ' '.__('Your old (themes, uploads, plugins, whatever) directories have been retained with "-old" appended to their name. Remove them when you are satisfied that the backup worked properly.');
            echo $success_advert;
            $include_deleteform_div = false;
        }
        // 			$this->print_restore_in_progress_box_if_needed();
        if ($this->scan_old_dirs(true)) {
            $this->print_delete_old_dirs_form(true, $include_deleteform_div);
        }
        // Close the div opened by the earlier section
        if (isset($_GET['updraft_restore_success'])) {
            echo '</div>';
        }
        $ws_advert = $updraftplus->wordshell_random_advert(1);
        if ($ws_advert && empty($success_advert) && empty($this->no_settings_warning)) {
            echo '<div class="updated ws_advert" style="clear:left;">' . $ws_advert . '</div>';
        }
        if (!$updraftplus->memory_check(64)) {
            ?>
				<div class="updated memory-limit"><?php 
            _e("Your PHP memory limit (set by your web hosting company) is very low. UpdraftPlus attempted to raise it but was unsuccessful. This plugin may struggle with a memory limit of less than 64 Mb  - especially if you have very large files uploaded (though on the other hand, many sites will be successful with a 32Mb limit - your experience may vary).", 'updraftplus');
            ?>
 <?php 
            _e('Current limit is:', 'updraftplus');
            ?>
 <?php 
            echo $updraftplus->memory_check_current();
            ?>
 MB</div>
			<?php 
        }
        if (!empty($updraftplus->errors)) {
            echo '<div class="error updraft_list_errors">';
            $updraftplus->list_errors();
            echo '</div>';
        }
        $backup_history = UpdraftPlus_Options::get_updraft_option('updraft_backup_history');
        if (empty($backup_history)) {
            $updraftplus->rebuild_backup_history();
            $backup_history = UpdraftPlus_Options::get_updraft_option('updraft_backup_history');
        }
        $backup_history = is_array($backup_history) ? $backup_history : array();
        ?>

		<h2 class="nav-tab-wrapper">
		<?php 
        $tabflag = 1;
        if (isset($_REQUEST['tab'])) {
            switch ($_REQUEST['tab']) {
                case 'status':
                    $tabflag = 1;
                    break;
                case 'backups':
                    $tabflag = 2;
                    break;
                case 'settings':
                    $tabflag = 3;
                    break;
                case 'expert':
                    $tabflag = 4;
                    break;
                case 'addons':
                    $tabflag = 5;
                    break;
                default:
                    $tabflag = 1;
            }
        }
        ?>
		<a class="nav-tab <?php 
        if (1 == $tabflag) {
            echo 'nav-tab-active';
        }
        ?>
" id="updraft-navtab-status" href="#updraft-navtab-status-content" ><?php 
        _e('Current Status', 'updraftplus');
        ?>
             </span></a>
		<a class="nav-tab <?php 
        if (2 == $tabflag) {
            echo 'nav-tab-active';
        }
        ?>
" id="updraft-navtab-backups" href="#updraft-navtab-backups-contents" ><?php 
        echo __('Existing Backups', 'updraftplus') . ' (' . count($backup_history) . ')';
        ?>
           </span></a>
		<a class="nav-tab <?php 
        if (3 == $tabflag) {
            echo 'nav-tab-active';
        }
        ?>
" id="updraft-navtab-settings" href="#updraft-navtab-settings-content"><?php 
        _e('Settings', 'updraftplus');
        ?>
                </span></a>
		<a class="nav-tab<?php 
        if (4 == $tabflag) {
            echo ' nav-tab-active';
        }
        ?>
" id="updraft-navtab-expert" href="#updraft-navtab-expert-content"><?php 
        _e('Advanced Tools', 'updraftplus');
        ?>
              </span></a>
		<a class="nav-tab<?php 
        if (5 == $tabflag) {
            echo ' nav-tab-active';
        }
        ?>
" id="updraft-navtab-addons" href="#updraft-navtab-addons-content"><?php 
        _e('Premium / Extensions', 'updraftplus');
        ?>
                </span></a>
 		<?php 
        //do_action('updraftplus_settings_afternavtabs');
        ?>
 
		</h2>

		<?php 
        $updraft_dir = $updraftplus->backups_dir_location();
        $backup_disabled = $updraftplus->really_is_writable($updraft_dir) ? '' : 'disabled="disabled"';
        ?>
		
		<div id="updraft-poplog" >
			<pre id="updraft-poplog-content"></pre>
		</div>
		
		<div id="updraft-navtab-status-content" class="<?php 
        if (1 != $tabflag) {
            echo 'updraft-hidden';
        }
        ?>
" style="<?php 
        if (1 != $tabflag) {
            echo 'display:none;';
        }
        ?>
">

			<div id="updraft-insert-admin-warning"></div>

			<table class="form-table" style="float:left; clear:both;">
				<noscript>
				<tr>
					<th><?php 
        _e('JavaScript warning', 'updraftplus');
        ?>
:</th>
					<td style="color:red"><?php 
        _e('This admin interface uses JavaScript heavily. You either need to activate it within your browser, or to use a JavaScript-capable browser.', 'updraftplus');
        ?>
</td>
				</tr>
				</noscript>

				<tr>
					<th></th>
					<td>

					<?php 
        if ($backup_disabled) {
            $unwritable_mess = htmlspecialchars(__("The 'Backup Now' button is disabled as your backup directory is not writable (go to the 'Settings' tab and find the relevant option).", 'updraftplus'));
            $this->show_admin_warning($unwritable_mess, "error");
        }
        ?>
					<button id="updraft-backupnow-button" type="button" <?php 
        echo $backup_disabled;
        ?>
 class="updraft-bigbutton button-primary" <?php 
        if ($backup_disabled) {
            echo 'title="' . esc_attr(__('This button is disabled because your backup directory is not writable (see the settings).', 'updraftplus')) . '" ';
        }
        ?>
 onclick="updraft_backup_dialog_open();"><?php 
        _e('Backup Now', 'updraftplus');
        ?>
</button>

					<button type="button" class="updraft-bigbutton button-primary" onclick="updraft_openrestorepanel();">
						<?php 
        _e('Restore', 'updraftplus');
        ?>
					</button>

					<button type="button" class="updraft-bigbutton button-primary" onclick="updraft_migrate_dialog_open();"><?php 
        _e('Clone/Migrate', 'updraftplus');
        ?>
</button>

					</td>
				</tr>

				<?php 
        $last_backup_html = $this->last_backup_html();
        $current_time = get_date_from_gmt(gmdate('Y-m-d H:i:s'), 'D, F j, Y H:i');
        ?>

				<script>var lastbackup_laststatus = '<?php 
        echo esc_js($last_backup_html);
        ?>
';</script>

				<tr>
					<th><span title="<?php 
        esc_attr_e("All the times shown in this section are using WordPress's configured time zone, which you can set in Settings -> General", 'updraftplus');
        ?>
"><?php 
        _e('Next scheduled backups', 'updraftplus');
        ?>
:<br>
					<span style="font-weight:normal;"><em><?php 
        _e('Now', 'updraftplus');
        ?>
: <?php 
        echo $current_time;
        ?>
</span></span></em></th>
					<td>
						<table id="next-backup-table-inner" class="next-backup">
							<?php 
        $this->next_scheduled_backups_output();
        ?>
						</table>
					</td>
				</tr>
				
				<tr>
					<th><?php 
        _e('Last backup job run:', 'updraftplus');
        ?>
</th>
					<td id="updraft_last_backup"><?php 
        echo $last_backup_html;
        ?>
</td>
				</tr>
			</table>

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

			<?php 
        $this->render_active_jobs_and_log_table();
        ?>

			<div id="updraft-migrate-modal" title="<?php 
        _e('Migrate Site', 'updraftplus');
        ?>
" style="display:none;">
				<?php 
        if (class_exists('UpdraftPlus_Addons_Migrator')) {
            do_action('updraftplus_migrate_modal_output');
        } else {
            echo '<p id="updraft_migrate_modal_main">' . __('Do you want to migrate or clone/duplicate a site?', 'updraftplus') . '</p><p>' . __('Then, try out our "Migrator" add-on. After using it once, you\'ll have saved the purchase price compared to the time needed to copy a site by hand.', 'updraftplus') . '</p><p><a href="https://updraftplus.com/shop/migrator/">' . __('Get it here.', 'updraftplus') . '</a></p>';
        }
        ?>
			</div>

			<div id="updraft-iframe-modal">
				<div id="updraft-iframe-modal-innards">
				</div>
			</div>

			<div id="updraft-backupnow-modal" title="UpdraftPlus - <?php 
        _e('Perform a one-time backup', 'updraftplus');
        ?>
">
<!--				<p>
					<?php 
        _e("To proceed, press 'Backup Now'. Then, watch the 'Last Log Message' field for activity.", 'updraftplus');
        ?>
				</p>-->

			<?php 
        echo $this->backupnow_modal_contents();
        ?>
			</div>

			<?php 
        if (is_multisite() && !file_exists(UPDRAFTPLUS_DIR . '/addons/multisite.php')) {
            ?>
				<h2>UpdraftPlus <?php 
            _e('Multisite', 'updraftplus');
            ?>
</h2>
				<table>
				<tr>
				<td>
				<p class="multisite-advert-width"><?php 
            echo __('Do you need WordPress Multisite support?', 'updraftplus') . ' <a href="https://updraftplus.com/shop/updraftplus-premium/">' . __('Please check out UpdraftPlus Premium, or the stand-alone Multisite add-on.', 'updraftplus');
            ?>
</a>.</p>
				</td>
				</tr>
				</table>
			<?php 
        }
        ?>
			
		</div>
		
		
		
		<div id="updraft-navtab-backups-content" <?php 
        if (2 != $tabflag) {
            echo 'class="updraft-hidden"';
        }
        ?>
 style="<?php 
        if (2 != $tabflag) {
            echo 'display:none;';
        }
        ?>
">
			<?php 
        $is_opera = false !== strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') || false !== strpos($_SERVER['HTTP_USER_AGENT'], 'OPR/');
        $tmp_opts = array('include_opera_warning' => $is_opera);
        $this->settings_downloading_and_restoring($backup_history, false, $tmp_opts);
        $this->settings_delete_and_restore_modals();
        ?>
		</div>

		<div id="updraft-navtab-settings-content" <?php 
        if (3 != $tabflag) {
            echo 'class="updraft-hidden"';
        }
        ?>
 style="<?php 
        if (3 != $tabflag) {
            echo 'display:none;';
        }
        ?>
">
			<h2 class="updraft_settings_sectionheading"><?php 
        _e('Backup Contents And Schedule', 'updraftplus');
        ?>
</h2>
			<?php 
        UpdraftPlus_Options::options_form_begin();
        ?>
				<?php 
        $this->settings_formcontents();
        ?>
			</form>
		</div>

		<div id="updraft-navtab-expert-content"<?php 
        if (4 != $tabflag) {
            echo ' class="updraft-hidden"';
        }
        ?>
 style="<?php 
        if (4 != $tabflag) {
            echo 'display:none;';
        }
        ?>
">
			<?php 
        $this->settings_expertsettings($backup_disabled);
        ?>
		</div>

		<div id="updraft-navtab-addons-content"<?php 
        if (5 != $tabflag) {
            echo ' class="updraft-hidden"';
        }
        ?>
 style="<?php 
        if (5 != $tabflag) {
            echo 'display:none;';
        }
        ?>
">

		<?php 
        $tick = UPDRAFTPLUS_URL . '/images/updraft_tick.png';
        $cross = UPDRAFTPLUS_URL . '/images/updraft_cross.png';
        $freev = UPDRAFTPLUS_URL . '/images/updraft_freev.png';
        $premv = UPDRAFTPLUS_URL . '/images/updraft_premv.png';
        ob_start();
        ?>
			<div>
				<h2>UpdraftPlus Premium</h2>
				<p>
					<span class="premium-upgrade-prompt"><?php 
        _e('You are currently using the free version of UpdraftPlus from wordpress.org.', 'updraftplus');
        ?>
 <a href="https://updraftplus.com/support/installing-updraftplus-premium-your-add-on/"><br><?php 
        echo __('If you have made a purchase from UpdraftPlus.Com, then follow this link to the instructions to install your purchase.', 'updraftplus') . ' ' . __('The first step is to de-install the free version.', 'updraftplus');
        ?>
</a></span>
					<ul class="updraft_premium_description_list">
						<li><a href="https://updraftplus.com/shop/updraftplus-premium/"><strong><?php 
        _e('Get UpdraftPlus Premium', 'updraftplus');
        ?>
</strong></a></li>
						<li><a href="https://updraftplus.com/updraftplus-full-feature-list/"><?php 
        _e('Full feature list', 'updraftplus');
        ?>
</a></li>
						<li><a href="https://updraftplus.com/faq-category/general-and-pre-sales-questions/"><?php 
        _e('Pre-sales FAQs', 'updraftplus');
        ?>
</a></li>
						<li class="last"><a href="https://updraftplus.com/ask-a-pre-sales-question/"><?php 
        _e('Ask a pre-sales question', 'updraftplus');
        ?>
</a> - <a href="https://updraftplus.com/support/"><?php 
        _e('Support', 'updraftplus');
        ?>
</a></li>
					</ul> 
				</p>
			</div>
			<div>
				<table class="updraft_feat_table">
					<tr>
						<th class="updraft_feat_th" style="text-align:left;"></th>
						<th class="updraft_feat_th"><img src="<?php 
        echo $freev;
        ?>
" height="120"></th>
						<th class="updraft_feat_th" style='background-color:#DF6926;'><a href="https://updraftplus.com/shop/updraftplus-premium/"><img src="<?php 
        echo $premv;
        ?>
"  height="120"></a></th>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Get it from', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell" style="vertical-align:top; line-height: 120%; margin-top:6px; padding-top:6px;">WordPress.Org</td>
						<td class="updraft_tick_cell" style="padding: 6px; line-height: 120%;">
							UpdraftPlus.Com<br>
							<a href="https://updraftplus.com/shop/updraftplus-premium/"><strong><?php 
        _e('Buy It Now!', 'updraftplus');
        ?>
</strong></a><br>
							</td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Backup WordPress files and database', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        echo sprintf(__('Translated into over %s languages', 'updraftplus'), 16);
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Restore from backup', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Backup to remote storage', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Dropbox, Google Drive, FTP, S3, Rackspace, Email', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('WebDAV, Copy.Com, SFTP/SCP, encrypted FTP', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Microsoft OneDrive, Microsoft Azure, Google Cloud Storage', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Free 1GB for UpdraftPlus Vault', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Backup extra files and databases', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Migrate / clone (i.e. copy) websites', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Basic email reporting', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Advanced reporting features', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Automatic backup when updating WP/plugins/themes', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Send backups to multiple remote destinations', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Database encryption', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Restore backups from other plugins', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('No advertising links on UpdraftPlus settings page', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Scheduled backups', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Fix backup time', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Network/Multisite support', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Lock settings access', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Personal support', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
				</table>
				</div>
			<?php 
        echo apply_filters('updraftplus_addonstab_content', ob_get_clean());
        // Close addons tab
        echo '</div>';
        // settings_header() opens a div
        echo '</div>';
    }
Example #2
0
    public function settings_output()
    {
        if (false == ($render = apply_filters('updraftplus_settings_page_render', true))) {
            do_action('updraftplus_settings_page_render_abort', $render);
            return;
        }
        do_action('updraftplus_settings_page_init');
        global $updraftplus;
        /*
        we use request here because the initial restore is triggered by a POSTed form. we then may need to obtain credentials 
        for the WP_Filesystem. to do this WP outputs a form, but we don't pass our parameters via that. So the values are 
        passed back in as GET parameters.
        */
        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'updraft_restore' && isset($_REQUEST['backup_timestamp'])) {
            $backup_success = $this->restore_backup($_REQUEST['backup_timestamp']);
            if (empty($updraftplus->errors) && $backup_success === true) {
                // If we restored the database, then that will have out-of-date information which may confuse the user - so automatically re-scan for them.
                $this->rebuild_backup_history();
                echo '<p><strong>';
                $updraftplus->log_e('Restore successful!');
                echo '</strong></p>';
                $updraftplus->log("Restore successful");
                $s_val = 1;
                if (!empty($this->entities_to_restore) && is_array($this->entities_to_restore)) {
                    foreach ($this->entities_to_restore as $k => $v) {
                        if ('db' != $v) {
                            $s_val = 2;
                        }
                    }
                }
                $pval = $updraftplus->have_addons ? 1 : 0;
                echo '<strong>' . __('Actions', 'updraftplus') . ':</strong> <a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&updraft_restore_success=' . $s_val . '&pval=' . $pval . '">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
                return;
            } elseif (is_wp_error($backup_success)) {
                echo '<p>';
                $updraftplus->log_e('Restore failed...');
                echo '</p>';
                $updraftplus->log_wp_error($backup_success);
                $updraftplus->log("Restore failed");
                $updraftplus->list_errors();
                echo '<strong>' . __('Actions', 'updraftplus') . ':</strong> <a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
                return;
            } elseif (false === $backup_success) {
                # This means, "not yet - but stay on the page because we may be able to do it later, e.g. if the user types in the requested information"
                return;
            }
        }
        if (isset($_REQUEST['action']) && 'updraft_delete_old_dirs' == $_REQUEST['action']) {
            $nonce = empty($_REQUEST['_wpnonce']) ? "" : $_REQUEST['_wpnonce'];
            if (!wp_verify_nonce($nonce, 'updraftplus-credentialtest-nonce')) {
                die('Security check');
            }
            $this->delete_old_dirs_go();
            return;
        }
        if (!empty($_REQUEST['action']) && 'updraftplus_broadcastaction' == $_REQUEST['action'] && !empty($_REQUEST['subaction'])) {
            $nonce = empty($_REQUEST['nonce']) ? "" : $_REQUEST['nonce'];
            if (!wp_verify_nonce($nonce, 'updraftplus-credentialtest-nonce')) {
                die('Security check');
            }
            do_action($_REQUEST['subaction']);
            return;
        }
        if (isset($_GET['error'])) {
            $this->show_admin_warning(htmlspecialchars($_GET['error']), 'error');
        }
        if (isset($_GET['message'])) {
            $this->show_admin_warning(htmlspecialchars($_GET['message']));
        }
        if (isset($_GET['action']) && $_GET['action'] == 'updraft_create_backup_dir' && isset($_GET['nonce']) && wp_verify_nonce($_GET['nonce'], 'create_backup_dir')) {
            $created = $this->create_backup_dir();
            if (is_wp_error($created)) {
                echo '<p>' . __('Backup directory could not be created', 'updraftplus') . '...<br/>';
                echo '<ul style="list-style: disc inside;">';
                foreach ($created->get_error_messages() as $key => $msg) {
                    echo '<li>' . htmlspecialchars($msg) . '</li>';
                }
                echo '</ul></p>';
            } elseif ($created !== false) {
                echo '<p>' . __('Backup directory successfully created.', 'updraftplus') . '</p><br/>';
            }
            echo '<b>' . __('Actions', 'updraftplus') . ':</b> <a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
            return;
        }
        echo '<div id="updraft_backup_started" class="updated" style="display:none; max-width: 800px; font-size:140%; line-height: 140%; padding:14px; clear:left;"></div>';
        if (isset($_POST['action']) && 'updraft_backup_debug_all' == $_POST['action']) {
            $updraftplus->boot_backup(true, true);
        } elseif (isset($_POST['action']) && 'updraft_backup_debug_db' == $_POST['action']) {
            $updraftplus->boot_backup(false, true, false, true);
        } elseif (isset($_POST['action']) && 'updraft_wipesettings' == $_POST['action']) {
            $settings = $this->get_settings_keys();
            foreach ($settings as $s) {
                UpdraftPlus_Options::delete_updraft_option($s);
            }
            # These aren't in get_settings_keys() because they are always in the options table, regardless of context
            global $wpdb;
            $wpdb->query("DELETE FROM {$wpdb->options} WHERE ( option_name LIKE 'updraftplus_unlocked_%' OR option_name LIKE 'updraftplus_locked_%' OR option_name LIKE 'updraftplus_last_lock_time_%' OR option_name LIKE 'updraftplus_semaphore_%')");
            $site_options = array('updraft_oneshotnonce');
            foreach ($site_options as $s) {
                delete_site_option($s);
            }
            $this->show_admin_warning(__("Your settings have been wiped.", 'updraftplus'));
        }
        $this->settings_header();
        ?>

			<div id="updraft-hidethis">
			<p><strong><?php 
        _e('Warning:', 'updraftplus');
        ?>
 <?php 
        _e("If you can still read these words after the page finishes loading, then there is a JavaScript or jQuery problem in the site.", 'updraftplus');
        ?>
 <a href="http://updraftplus.com/do-you-have-a-javascript-or-jquery-error/"><?php 
        _e('Go here for more information.', 'updraftplus');
        ?>
</a></strong></p>
			</div>

			<?php 
        $include_deleteform_div = true;
        // Opens a div, which needs closing later
        if (isset($_GET['updraft_restore_success'])) {
            $success_advert = isset($_GET['pval']) && 0 == $_GET['pval'] && !$updraftplus->have_addons ? '<p>' . __('For even more features and personal support, check out ', 'updraftplus') . '<strong><a href="http://updraftplus.com/shop/updraftplus-premium/" target="_blank">UpdraftPlus Premium</a>.</strong></p>' : "";
            echo "<div class=\"updated\" style=\"padding:8px;\"><span style=\"font-size:120%;\"><strong>" . __('Your backup has been restored.', 'updraftplus') . '</strong></span><br>';
            // Unnecessary - will be advised of this below
            // 				if (2 == $_GET['updraft_restore_success']) echo ' '.__('Your old (themes, uploads, plugins, whatever) directories have been retained with "-old" appended to their name. Remove them when you are satisfied that the backup worked properly.');
            echo $success_advert;
            $include_deleteform_div = false;
        }
        if ($this->scan_old_dirs(true)) {
            $this->print_delete_old_dirs_form(true, $include_deleteform_div);
        }
        // Close the div opened by the earlier section
        if (isset($_GET['updraft_restore_success'])) {
            echo '</div>';
        }
        $ws_advert = $updraftplus->wordshell_random_advert(1);
        if ($ws_advert && empty($success_advert) && empty($this->no_settings_warning)) {
            echo '<div class="updated" style="max-width: 800px; font-size:140%; line-height: 140%; padding:14px; clear:left;">' . $ws_advert . '</div>';
        }
        if (!$updraftplus->memory_check(64)) {
            ?>
				<div class="updated" style="padding:8px;"><?php 
            _e("Your PHP memory limit (set by your web hosting company) is very low. UpdraftPlus attempted to raise it but was unsuccessful. This plugin may struggle with a memory limit of less than 64 Mb  - especially if you have very large files uploaded (though on the other hand, many sites will be successful with a 32Mb limit - your experience may vary).", 'updraftplus');
            ?>
 <?php 
            _e('Current limit is:', 'updraftplus');
            ?>
 <?php 
            echo $updraftplus->memory_check_current();
            ?>
 Mb</div>
			<?php 
        }
        if (!empty($updraftplus->errors)) {
            echo '<div class="error" style="padding:8px;">';
            $updraftplus->list_errors();
            echo '</div>';
        }
        $backup_history = UpdraftPlus_Options::get_updraft_option('updraft_backup_history');
        if (empty($backup_history)) {
            $this->rebuild_backup_history();
            $backup_history = UpdraftPlus_Options::get_updraft_option('updraft_backup_history');
        }
        $backup_history = is_array($backup_history) ? $backup_history : array();
        ?>

		<h2 class="nav-tab-wrapper" style="margin: 14px 0px;">
		<?php 
        $tabflag = 1;
        if (isset($_REQUEST['tab']) && 'addons' == $_REQUEST['tab']) {
            $tabflag = 5;
        }
        if (isset($_REQUEST['tab']) && 'expert' == $_REQUEST['tab']) {
            $tabflag = 4;
        }
        ?>
		<a class="nav-tab <?php 
        if (1 == $tabflag) {
            echo 'nav-tab-active';
        }
        ?>
" href="#updraft-navtab-status-content" id="updraft-navtab-status"><?php 
        _e('Current Status', 'updraftplus');
        ?>
</a>
		<a class="nav-tab" href="#updraft-navtab-backups-contents" id="updraft-navtab-backups"><?php 
        echo __('Existing Backups', 'updraftplus') . ' (' . count($backup_history) . ')';
        ?>
</a>
		<a class="nav-tab" id="updraft-navtab-settings" href="#updraft-navtab-settings-content"><?php 
        _e('Settings', 'updraftplus');
        ?>
</a>
		<a class="nav-tab<?php 
        if (4 == $tabflag) {
            echo ' nav-tab-active';
        }
        ?>
" id="updraft-navtab-expert" href="#updraft-navtab-expert-content"><?php 
        _e('Debugging / Expert Tools', 'updraftplus');
        ?>
</a>
		<a class="nav-tab<?php 
        if (5 == $tabflag) {
            echo ' nav-tab-active';
        }
        ?>
" id="updraft-navtab-addons" href="#updraft-navtab-addons-content"><?php 
        _e('Add-ons', 'updraftplus');
        ?>
</a>
 		<?php 
        //do_action('updraftplus_settings_afternavtabs');
        ?>
 
		</h2>

		<?php 
        $updraft_dir = $updraftplus->backups_dir_location();
        $backup_disabled = $updraftplus->really_is_writable($updraft_dir) ? '' : 'disabled="disabled"';
        ?>
		
		<div id="updraft-poplog" >
			<pre id="updraft-poplog-content" style="white-space: pre-wrap;"></pre>
		</div>
		
		<div id="updraft-navtab-status-content" <?php 
        if (1 != $tabflag) {
            echo 'style="display:none;"';
        }
        ?>
>

			<div id="updraft-insert-admin-warning"></div>

			<table class="form-table" style="float:left; clear: both;">
				<noscript>
				<tr>
					<th><?php 
        _e('JavaScript warning', 'updraftplus');
        ?>
:</th>
					<td style="color:red"><?php 
        _e('This admin interface uses JavaScript heavily. You either need to activate it within your browser, or to use a JavaScript-capable browser.', 'updraftplus');
        ?>
</td>
				</tr>
				</noscript>

				<tr>
					<th><?php 
        _e('Actions', 'updraftplus');
        ?>
:</th>
					<td>

					<?php 
        if ($backup_disabled) {
            $unwritable_mess = htmlspecialchars(__("The 'Backup Now' button is disabled as your backup directory is not writable (go to the 'Settings' tab and find the relevant option).", 'updraftplus'));
            $this->show_admin_warning($unwritable_mess, "error");
        }
        ?>

					<button type="button" <?php 
        echo $backup_disabled;
        ?>
 class="button-primary updraft-bigbutton" <?php 
        if ($backup_disabled) {
            echo 'title="' . esc_attr(__('This button is disabled because your backup directory is not writable (see the settings).', 'updraftplus')) . '" ';
        }
        ?>
 onclick="jQuery('#backupnow_label').val(''); jQuery('#updraft-backupnow-modal').dialog('open');"><?php 
        _e('Backup Now', 'updraftplus');
        ?>
</button>

					<button type="button" class="button-primary updraft-bigbutton" onclick="updraft_openrestorepanel();">
						<?php 
        _e('Restore', 'updraftplus');
        ?>
					</button>

					<button type="button" class="button-primary updraft-bigbutton" onclick="jQuery('#updraft-migrate-modal').dialog('open');"><?php 
        _e('Clone/Migrate', 'updraftplus');
        ?>
</button>

					</td>
				</tr>

				<?php 
        // UNIX timestamp
        $next_scheduled_backup = wp_next_scheduled('updraft_backup');
        if ($next_scheduled_backup) {
            // Convert to GMT
            $next_scheduled_backup_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup);
            // Convert to blog time zone
            $next_scheduled_backup = get_date_from_gmt($next_scheduled_backup_gmt, 'D, F j, Y H:i');
        } else {
            $next_scheduled_backup = __('Nothing currently scheduled', 'updraftplus');
            $files_not_scheduled = true;
        }
        $next_scheduled_backup_database = wp_next_scheduled('updraft_backup_database');
        if (UpdraftPlus_Options::get_updraft_option('updraft_interval_database', UpdraftPlus_Options::get_updraft_option('updraft_interval')) == UpdraftPlus_Options::get_updraft_option('updraft_interval')) {
            if (isset($files_not_scheduled)) {
                $next_scheduled_backup_database = $next_scheduled_backup;
                $database_not_scheduled = true;
            } else {
                $next_scheduled_backup_database = __("At the same time as the files backup", 'updraftplus');
            }
        } else {
            if ($next_scheduled_backup_database) {
                // Convert to GMT
                $next_scheduled_backup_database_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup_database);
                // Convert to blog time zone
                $next_scheduled_backup_database = get_date_from_gmt($next_scheduled_backup_database_gmt, 'D, F j, Y H:i');
            } else {
                $next_scheduled_backup_database = __('Nothing currently scheduled', 'updraftplus');
                $database_not_scheduled = true;
            }
        }
        $current_time = get_date_from_gmt(gmdate('Y-m-d H:i:s'), 'D, F j, Y H:i');
        $last_backup_html = $this->last_backup_html();
        ?>

				<script>var lastbackup_laststatus = '<?php 
        echo esc_js($last_backup_html);
        ?>
';</script>

				<tr>
					<th><span title="<?php 
        _e('All the times shown in this section are using WordPress\'s configured time zone, which you can set in Settings -> General', 'updraftplus');
        ?>
"><?php 
        _e('Next scheduled backups', 'updraftplus');
        ?>
:</span></th>
					<td>
						<table style="border: 0px; padding: 0px; margin: 0 10px 0 0;">
						<tr>
						<?php 
        if (isset($files_not_scheduled) && isset($database_not_scheduled)) {
            ?>
									<td colspan="2" style="vertical-align:top; margin: 0px; padding: 0px;"><?php 
            _e('Nothing currently scheduled', 'updraftplus');
            ?>
</td>
								<?php 
        } else {
            ?>
								<td style="width: 124px; vertical-align:top; margin: 0px; padding: 0px;"><?php 
            _e('Files', 'updraftplus');
            ?>
:</td><td style="color:blue; margin: 0px; padding: 0px;"><?php 
            echo $next_scheduled_backup;
            ?>
</td>
								</tr><tr>
								<td style="width: 124px; vertical-align:top; margin: 0px; padding: 0px;"><?php 
            _e('Database', 'updraftplus');
            ?>
: </td><td style="color:blue; margin: 0px; padding: 0px;"><?php 
            echo $next_scheduled_backup_database;
            ?>
</td>
								</tr><tr>
								<td style="width: 124px; vertical-align:top; margin: 0px; padding: 0px;"><?php 
            _e('Time now', 'updraftplus');
            ?>
: </td><td style="color:blue; margin: 0px; padding: 0px;"><?php 
            echo $current_time;
            ?>
</td>
							<?php 
        }
        ?>
						</table>
					</td>
				</tr>
				<tr>
					<th><?php 
        _e('Last backup job run:', 'updraftplus');
        ?>
</th>
					<td id="updraft_last_backup"><?php 
        echo $last_backup_html;
        ?>
</td>
				</tr>
			</table>

			<br style="clear:both" />

			<?php 
        $this->render_active_jobs_and_log_table();
        ?>

<div id="updraft-migrate-modal" title="<?php 
        _e('Migrate Site', 'updraftplus');
        ?>
">

<?php 
        if (class_exists('UpdraftPlus_Addons_Migrator')) {
            echo '<p>' . str_replace('"', "&quot;", __('Migration of data from another site happens through the "Restore" button. A "migration" is ultimately the same as a restoration - but using backup archives that you import from another site. UpdraftPlus modifies the restoration operation appropriately, to fit the backup data to the new site.', 'updraftplus')) . ' ' . sprintf(__('<a href="%s">Read this article to see step-by-step how it\'s done.</a>', 'updraftplus'), 'http://updraftplus.com/faqs/how-do-i-migrate-to-a-new-site-location/');
        } else {
            echo '<p>' . __('Do you want to migrate or clone/duplicate a site?', 'updraftplus') . '</p><p>' . __('Then, try out our "Migrator" add-on. After using it once, you\'ll have saved the purchase price compared to the time needed to copy a site by hand.', 'updraftplus') . '</p><p><a href="http://updraftplus.com/shop/migrator/">' . __('Get it here.', 'updraftplus') . '</a>';
        }
        ?>
</p>
</div>

<div id="updraft-iframe-modal">
	<div id="updraft-iframe-modal-innards">
	</div>
</div>

<div id="updraft-backupnow-modal" title="UpdraftPlus - <?php 
        _e('Perform a one-time backup', 'updraftplus');
        ?>
">
	<p><?php 
        _e("To proceed, press 'Backup Now'. Then, watch the 'Last Log Message' field for activity.", 'updraftplus');
        ?>
</p>

	<p>
		<input type="checkbox" id="backupnow_nodb"> <label for="backupnow_nodb"><?php 
        _e("Don't include the database in the backup", 'updraftplus');
        ?>
</label><br>
		<input type="checkbox" id="backupnow_nofiles"> <label for="backupnow_nofiles"><?php 
        _e("Don't include any files in the backup", 'updraftplus');
        ?>
</label><br>
		<input type="checkbox" id="backupnow_nocloud"> <label for="backupnow_nocloud"><?php 
        _e("Don't send this backup to remote storage", 'updraftplus');
        ?>
</label>
	</p>

	<?php 
        do_action('updraft_backupnow_modal_afteroptions');
        ?>

	<p><?php 
        _e('Does nothing happen when you attempt backups?', 'updraftplus');
        ?>
 <a href="http://updraftplus.com/faqs/my-scheduled-backups-and-pressing-backup-now-does-nothing-however-pressing-debug-backup-does-produce-a-backup/"><?php 
        _e('Go here for help.', 'updraftplus');
        ?>
</a></p>
</div>

			<?php 
        if (is_multisite() && !file_exists(UPDRAFTPLUS_DIR . '/addons/multisite.php')) {
            ?>
				<h2>UpdraftPlus <?php 
            _e('Multisite', 'updraftplus');
            ?>
</h2>
				<table>
				<tr>
				<td>
				<p style="max-width:800px;"><?php 
            echo __('Do you need WordPress Multisite support?', 'updraftplus') . ' <a href="http://updraftplus.com/">' . __('Please check out UpdraftPlus Premium, or the stand-alone Multisite add-on.', 'updraftplus');
            ?>
</a>.</p>
				</td>
				</tr>
				</table>
			<?php 
        }
        ?>

		</div>

		<div id="updraft-navtab-backups-content" style="display:none;">
			<?php 
        $this->settings_downloadingandrestoring($backup_history);
        ?>
		</div>

		<div id="updraft-navtab-settings-content" style="display:none;">
			<h2 style="margin-top: 6px;"><?php 
        _e('Configure Backup Contents And Schedule', 'updraftplus');
        ?>
</h2>
			<?php 
        UpdraftPlus_Options::options_form_begin();
        ?>
				<?php 
        $this->settings_formcontents($last_backup_html);
        ?>
			</form>
		</div>

		<div id="updraft-navtab-expert-content"<?php 
        if (4 != $tabflag) {
            echo ' style="display:none;"';
        }
        ?>
>
			<?php 
        $this->settings_expertsettings($backup_disabled);
        ?>
		</div>

		<div id="updraft-navtab-addons-content"<?php 
        if (5 != $tabflag) {
            echo ' style="display:none;"';
        }
        ?>
>

		<?php 
        $tick = UPDRAFTPLUS_URL . '/images/updraft_tick.png';
        $cross = UPDRAFTPLUS_URL . '/images/updraft_cross.png';
        $freev = UPDRAFTPLUS_URL . '/images/updraft_freev.png';
        $premv = UPDRAFTPLUS_URL . '/images/updraft_premv.png';
        ob_start();
        ?>
			<div>
				<h2>UpdraftPlus Premium</h2>
				<p>
					<span style="font-size: 115%;"><?php 
        _e('You are currently using the free version of UpdraftPlus from wordpress.org.', 'updraftplus');
        ?>
 <a href="https://updraftplus.com/support/installing-updraftplus-premium-your-add-on/"><br><?php 
        echo __('If you have made a purchase from UpdraftPlus.Com, then follow this link to the instructions to install your purchase.', 'updraftplus') . ' ' . __('The first step is to de-install the free version.', 'updraftplus');
        ?>
</a></span>
					<ul class="updraft_premium_description_list">
						<li><a href="https://updraftplus.com/shop/updraftplus-premium/"><strong><?php 
        _e('Get UpdraftPlus Premium', 'updraftplus');
        ?>
</strong></a></li>
						<li><a href="https://updraftplus.com/updraftplus-full-feature-list/"><?php 
        _e('Full feature list', 'updraftplus');
        ?>
</a></li>
						<li><a href="http://updraftplus.com/faq-category/general-and-pre-sales-questions/"><?php 
        _e('Pre-sales FAQs', 'updraftplus');
        ?>
</a></li>
						<li class="last"><a href="http://updraftplus.com/ask-a-pre-sales-question/"><?php 
        _e('Ask a pre-sales question', 'updraftplus');
        ?>
</a> - <a href="https://updraftplus.com/support/"><?php 
        _e('Support', 'updraftplus');
        ?>
</a></li>
					</ul> 
				</p>
			</div>
			<div>
				<div style="margin-top:30px;">
				<table class="updraft_feat_table">
					<tr>
						<th class="updraft_feat_th" style="text-align:left;"></th>
						<th class="updraft_feat_th"><img src="<?php 
        echo $freev;
        ?>
" height="120"></th>
						<th class="updraft_feat_th" style='background-color:#DF6926;'><a href="https://updraftplus.com/shop/updraftplus-premium/"><img src="<?php 
        echo $premv;
        ?>
"  height="120"></a></th>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Get it from', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell" style="vertical-align:top; line-height: 120%; margin-top:6px; padding-top:6px;">WordPress.Org</td>
						<td class="updraft_tick_cell" style="padding: 6px; line-height: 120%;">
							UpdraftPlus.Com<br>
							<a href="https://updraftplus.com/shop/updraftplus-premium/"><strong><?php 
        _e('Buy It Now!', 'updraftplus');
        ?>
</strong></a><br>
							</td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Backup WordPress files and database', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        echo sprintf(__('Translated into over %s languages', 'updraftplus'), 16);
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Restore from backup', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Backup to remote storage', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Dropbox, Google Drive, FTP, S3, Rackspace, Email', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('WebDAV, Copy.Com, SFTP/SCP, encrypted FTP', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Backup extra files and databases', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Migrate / clone (i.e. copy) websites', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Basic email reporting', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Advanced reporting features', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Automatic backup when updating WP/plugins/themes', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Send backups to multiple remote destinations', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Database encryption', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Restore backups from other plugins', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('No advertising links', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Scheduled backups', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Fix backup time', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Network/Multisite support', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Lock settings access', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
					<tr>
						<td class="updraft_feature_cell"><?php 
        _e('Personal support', 'updraftplus');
        ?>
</td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $cross;
        ?>
"></td>
						<td class="updraft_tick_cell"><img src="<?php 
        echo $tick;
        ?>
"></td>
					</tr>
				</table>
				</div>
			</div>
			<?php 
        echo apply_filters('updraftplus_addonstab_content', ob_get_clean());
        echo '</div>';
    }
Example #3
0
    public function options_printpage()
    {
        if (!UpdraftPlus_Options::user_can_manage()) {
            wp_die(__('You do not have sufficient permissions to access this page.'));
        }
        $options = $this->options->get_option(UDADDONS2_SLUG . '_options');
        $user_and_pass_at_top = empty($options['email']) ? true : false;
        $title = htmlspecialchars($this->title);
        $mother = $this->mother;
        echo <<<ENDHERE
\t<div class="wrap">
\t\t
ENDHERE;
        $enter_credentials_begin = UpdraftPlus_Options::options_form_begin('', false);
        if (is_multisite()) {
            $enter_credentials_begin .= '<input type="hidden" name="action" value="update">';
        }
        $interested = htmlspecialchars(__('Interested in knowing about your UpdraftPlus.Com password security? Read about it here.', 'updraftplus'));
        $connect = htmlspecialchars(__('Connect', 'updraftplus'));
        $enter_credentials_end = <<<ENDHERE
\t\t\t<p style="margin-left: 258px;">
\t\t\t\t<input id="ud_connectsubmit" type="submit" class="button-primary" value="{$connect}" />
\t\t\t</p>
\t\t\t<p style="margin-left: 258px; font-size: 70%"><em><a href="http://updraftplus.com/faqs/tell-me-about-my-updraftplus-com-account/">{$interested}</a></em></p>
\t\t</form>
ENDHERE;
        global $updraftplus_addons2;
        // 		$this->connected = (!empty($options['email']) && !empty($options['password'])) ? $updraftplus_addons2->connection_status() : false;
        $this->connected = !empty($options['email']) ? $updraftplus_addons2->connection_status() : false;
        if (true !== $this->connected) {
            if (is_wp_error($this->connected)) {
                $connection_errors = array();
                foreach ($this->connected->get_error_messages() as $key => $msg) {
                    $connection_errors[] = $msg;
                }
            } else {
                if (!empty($options['email']) && !empty($options['password'])) {
                    $connection_errors = array(__('An unknown error occurred when trying to connect to UpdraftPlus.Com', 'updraftplus'));
                }
            }
            $this->connected = false;
        }
        if ($this->connected) {
            echo '<p style="clear: both; float: left;">' . __('You are presently <strong>connected</strong> to an UpdraftPlus.Com account.', 'updraftplus');
            echo ' <a href="#" onclick="jQuery(\'#ud_connectsubmit\').click();">' . __('If you bought new add-ons, then follow this link to refresh your connection', 'updraftplus') . '</a>.';
            if (!empty($options['password'])) {
                echo ' ' . __("Note that after you have claimed your add-ons, you can remove your password (but not the email address) from the settings below, without affecting this site's access to updates.", 'updraftplus');
            }
        } else {
            // 			$oval = is_object($this->plug_updatechecker) ? get_site_option($this->plug_updatechecker->optionName, null) : null;
            // 			// Detect the case where the password has been removed
            // 			if (is_object($oval) && !empty($oval->lastCheck) && time()-$oval->lastCheck < 86400*8) {
            // 			} else {
            echo "<p>" . __('You are presently <strong>not connected</strong> to an UpdraftPlus.Com account.', 'updraftplus');
            // 			}
        }
        echo '</p>';
        if (isset($connection_errors)) {
            echo '<div class="error"><p><strong>' . __('Errors occurred when trying to connect to UpdraftPlus.Com:', 'updraftplus') . '</strong></p><ul>';
            foreach ($connection_errors as $err) {
                echo '<li style="list-style:disc inside;">' . $err . '</li>';
            }
            echo '</ul></div>';
        }
        global $updraftplus_addons2;
        $sid = $updraftplus_addons2->siteid();
        $home_url = home_url();
        // Enumerate possible unclaimed/re-claimable purchases, and what should be active on this site
        $unclaimed_available = array();
        $assigned = array();
        $have_all = false;
        if ($this->connected && isset($updraftplus_addons2->user_addons) && is_array($updraftplus_addons2->user_addons)) {
            foreach ($updraftplus_addons2->user_addons as $akey => $addon) {
                // Keys: site, sitedescription, key, status
                if (isset($addon['status']) && 'active' == $addon['status'] && isset($addon['site']) && ('unclaimed' == $addon['site'] || 'unlimited' == $addon['site'])) {
                    $key = $addon['key'];
                    $unclaimed_available[$key] = array('eid' => $akey, 'status' => 'available');
                } elseif (isset($addon['status']) && 'active' == $addon['status'] && isset($addon['site']) && $addon['site'] == $sid) {
                    $key = $addon['key'];
                    $assigned[$key] = $akey;
                    if ('all' == $key) {
                        $have_all = true;
                    }
                } elseif (isset($addon['sitedescription']) && ($home_url === $addon['sitedescription'] || 0 === strpos($addon['sitedescription'], $home_url . ' - '))) {
                    # Is assigned to a site with the same URL as this one - allow a reclaim
                    $key = $addon['key'];
                    $unclaimed_available[$key] = array('eid' => $akey, 'status' => 'reclaimable');
                }
            }
        }
        if (!$this->connected) {
            $this->show_credentials_form($enter_credentials_begin, $enter_credentials_end);
        }
        $email = isset($options['email']) ? $options['email'] : '';
        $pass = isset($options['password']) ? base64_encode($options['password']) : '';
        $sn = base64_encode(get_bloginfo('name'));
        $su = base64_encode($home_url);
        $ourpageslug = UDADDONS2_PAGESLUG;
        $mother = $this->mother;
        //$href = (is_multisite()) ? 'settings.php' : 'options-general.php';
        $href = UpdraftPlus_Options::admin_page_url();
        if (count($unclaimed_available) > 0) {
            $nonce = wp_create_nonce('udmanager-nonce');
            $pleasewait = htmlspecialchars(__('Please wait whilst we make the claim...', 'updraftplus'));
            $notgranted = esc_js(__('Claim not granted - perhaps you have already used this purchase somewhere else?', 'updraftplus'));
            $notgrantedlogin = esc_js(__('Claim not granted - your account login details were wrong', 'updraftplus'));
            $ukresponse = esc_js(__('An unknown response was received. Response was:', 'updraftplus'));
            echo <<<ENDHERE
\t\t<div id="udm_pleasewait" class="updated" style="border: 1px solid; padding: 10px; margin-top: 10px; margin-bottom: 10px; clear: both; float: left; display:none;"><strong>{$pleasewait}</strong></div>
\t\t<script type="text/javascript">
\t\t\tfunction udm_claim(key) {
\t\t\t\tvar data = {
\t\t\t\t\t\taction: 'udaddons_claimaddon',
\t\t\t\t\t\tnonce: '{$nonce}',
\t\t\t\t\t\tkey: key
\t\t\t\t};
\t\t\t\tjQuery('#udm_pleasewait').fadeIn();
\t\t\t\tjQuery.post(ajaxurl, data, function(response) {
\t\t\t\t\tif ('ERR' == response) {
\t\t\t\t\t\talert("{$notgranted}");
\t\t\t\t\t} else if (response == 'OK') {
\t\t\t\t\t\twindow.location.href = '{$href}?page={$ourpageslug}&udm_refresh=1&udm_clearcred=1&tab=addons';
\t\t\t\t\t} else if (response == 'BADAUTH') {
\t\t\t\t\t\talert("{$notgrantedlogin}");
\t\t\t\t\t} else {
\t\t\t\t\t\talert("{$ukresponse} "+response);
\t\t\t\t\t}
\t\t\t\t\tjQuery('#udm_pleasewait').fadeOut();
\t\t\t\t});
\t\t\t}
\t\t</script>
ENDHERE;
        }
        $this->update_js = '';
        echo '<h3 style="clear:left; margin-top: 10px;">' . __('UpdraftPlus Addons', 'updraftplus') . '</h3><div>';
        $addons = $updraftplus_addons2->get_available_addons();
        $this->plugin_update_url = 'update-core.php';
        # Can we get a direct update URL?
        $updates_available = get_site_transient('update_plugins');
        if (is_object($updates_available) && isset($updates_available->response) && isset($updraftplus_addons2->plug_updatechecker) && isset($updraftplus_addons2->plug_updatechecker->pluginFile) && isset($updates_available->response[$updraftplus_addons2->plug_updatechecker->pluginFile])) {
            $file = $updraftplus_addons2->plug_updatechecker->pluginFile;
            $this->plugin_update_url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&updraftplus_noautobackup=1&plugin=') . $file, 'upgrade-plugin_' . $file);
            $this->update_js = '<script>jQuery(document).ready(function() { jQuery(\'#updraftaddons_updatewarning\').html(\'' . __('An update containing your addons is available for UpdraftPlus - please follow this link to get it.', 'updraftplus') . '\') });</script>';
        }
        $first = '';
        $second = '';
        $third = '';
        if (is_array($addons)) {
            foreach ($addons as $key => $addon) {
                extract($addon);
                if (empty($addon['latestversion'])) {
                    $latestversion = false;
                }
                if (empty($addon['installedversion'])) {
                    $installedversion = false;
                }
                if (empty($addon['installed']) && $installedversion == false) {
                    $installed = false;
                }
                $unclaimed = isset($unclaimed_available[$key]) ? $unclaimed_available[$key] : false;
                $is_assigned = isset($assigned[$key]) ? $assigned[$key] : false;
                $box = $this->addonbox($key, $name, $shopurl, $description, trim($installedversion), trim($latestversion), $installed, $unclaimed, $is_assigned, $have_all);
                if ($is_assigned) {
                    $first .= $box;
                } elseif (!empty($unclaimed)) {
                    $second .= $box;
                } else {
                    $third .= $box;
                }
            }
        } else {
            echo "<em>" . __('An error occurred when trying to retrieve your add-ons.', 'updraftplus') . "</em>";
        }
        echo $first . $second . $third;
        echo <<<ENDHERE
\t\t</div>
ENDHERE;
        echo $this->update_js;
        // TODO: Show their support package, if any - ?
        if (is_array($updraftplus_addons2->user_support)) {
            // Keys:
        }
        echo '<h3>' . __('UpdraftPlus Support', 'updraftplus') . '</h3>
<ul>
<li style="list-style:disc inside;">' . __('Need to get support?', 'updraftplus') . ' <a href="' . $mother . '/support/">' . __('Go here', 'updraftplus') . "</a>.</li>\n</ul>";
        if ($this->connected) {
            echo "<hr>";
            $this->show_credentials_form($enter_credentials_begin, $enter_credentials_end);
        }
        echo '</div>';
    }
Example #4
0
    public function settings_output()
    {
        if (false == ($render = apply_filters('updraftplus_settings_page_render', true))) {
            do_action('updraftplus_settings_page_render_abort', $render);
            return;
        }
        do_action('updraftplus_settings_page_init');
        global $updraftplus;
        /*
        we use request here because the initial restore is triggered by a POSTed form. we then may need to obtain credentials 
        for the WP_Filesystem. to do this WP outputs a form, but we don't pass our parameters via that. So the values are 
        passed back in as GET parameters.
        */
        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'updraft_restore' && isset($_REQUEST['backup_timestamp'])) {
            $backup_success = $this->restore_backup($_REQUEST['backup_timestamp']);
            if (empty($updraftplus->errors) && $backup_success === true) {
                // If we restored the database, then that will have out-of-date information which may confuse the user - so automatically re-scan for them.
                $this->rebuild_backup_history();
                echo '<p><strong>';
                $updraftplus->log_e('Restore successful!');
                echo '</strong></p>';
                $updraftplus->log("Restore successful");
                $s_val = 1;
                if (!empty($this->entities_to_restore) && is_array($this->entities_to_restore)) {
                    foreach ($this->entities_to_restore as $k => $v) {
                        if ('db' != $v) {
                            $s_val = 2;
                        }
                    }
                }
                echo '<strong>' . __('Actions', 'updraftplus') . ':</strong> <a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&updraft_restore_success=' . $s_val . '">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
                return;
            } elseif (is_wp_error($backup_success)) {
                echo '<p>';
                $updraftplus->log_e('Restore failed...');
                echo '</p>';
                $updraftplus->log_wp_error($backup_success);
                $updraftplus->log("Restore failed");
                $updraftplus->list_errors();
                echo '<strong>' . __('Actions', 'updraftplus') . ':</strong> <a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
                return;
            } elseif (false === $backup_success) {
                # This means, "not yet - but stay on the page because we may be able to do it later, e.g. if the user types in the requested information"
                return;
            }
        }
        if (isset($_REQUEST['action']) && 'updraft_delete_old_dirs' == $_REQUEST['action']) {
            $nonce = empty($_REQUEST['_wpnonce']) ? "" : $_REQUEST['_wpnonce'];
            if (!wp_verify_nonce($nonce, 'updraftplus-credentialtest-nonce')) {
                die('Security check');
            }
            $this->delete_old_dirs_go();
            return;
        }
        if (!empty($_REQUEST['action']) && 'updraftplus_broadcastaction' == $_REQUEST['action'] && !empty($_REQUEST['subaction'])) {
            $nonce = empty($_REQUEST['nonce']) ? "" : $_REQUEST['nonce'];
            if (!wp_verify_nonce($nonce, 'updraftplus-credentialtest-nonce')) {
                die('Security check');
            }
            do_action($_REQUEST['subaction']);
            return;
        }
        if (isset($_GET['error'])) {
            $this->show_admin_warning(htmlspecialchars($_GET['error']), 'error');
        }
        if (isset($_GET['message'])) {
            $this->show_admin_warning(htmlspecialchars($_GET['message']));
        }
        if (isset($_GET['action']) && $_GET['action'] == 'updraft_create_backup_dir' && isset($_GET['nonce']) && wp_verify_nonce($_GET['nonce'], 'create_backup_dir')) {
            $created = $this->create_backup_dir();
            if (is_wp_error($created)) {
                echo '<p>' . __('Backup directory could not be created', 'updraftplus') . '...<br/>';
                echo '<ul style="list-style: disc inside;">';
                foreach ($created->get_error_messages() as $key => $msg) {
                    echo '<li>' . htmlspecialchars($msg) . '</li>';
                }
                echo '</ul></p>';
            } elseif ($created !== false) {
                echo '<p>' . __('Backup directory successfully created.', 'updraftplus') . '</p><br/>';
            }
            echo '<b>' . __('Actions', 'updraftplus') . ':</b> <a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
            return;
        }
        echo '<div id="updraft_backup_started" class="updated fade" style="display:none; max-width: 800px; font-size:140%; line-height: 140%; padding:14px; clear:left;"></div>';
        if (isset($_POST['action']) && 'updraft_backup_debug_all' == $_POST['action']) {
            $updraftplus->boot_backup(true, true);
        } elseif (isset($_POST['action']) && 'updraft_backup_debug_db' == $_POST['action']) {
            $updraftplus->boot_backup(false, true, false, true);
        } elseif (isset($_POST['action']) && 'updraft_wipesettings' == $_POST['action']) {
            $settings = $this->get_settings_keys();
            foreach ($settings as $s) {
                UpdraftPlus_Options::delete_updraft_option($s);
            }
            # These aren't in get_settings_keys() because they are always in the options table, regardless of context
            global $wpdb;
            $wpdb->query("DELETE FROM {$wpdb->options} WHERE ( option_name LIKE 'updraftplus_unlocked_%' OR option_name LIKE 'updraftplus_locked_%' OR option_name LIKE 'updraftplus_last_lock_time_%' OR option_name LIKE 'updraftplus_semaphore_%')");
            $site_options = array('updraft_oneshotnonce');
            foreach ($site_options as $s) {
                delete_site_option($s);
            }
            $this->show_admin_warning(__("Your settings have been wiped.", 'updraftplus'));
        }
        $this->settings_header();
        ?>

			<div id="updraft-hidethis">
			<p><strong><?php 
        _e('Warning:', 'updraftplus');
        ?>
 <?php 
        _e("If you can still read these words after the page finishes loading, then there is a JavaScript or jQuery problem in the site.", 'updraftplus');
        ?>
 <a href="http://updraftplus.com/do-you-have-a-javascript-or-jquery-error/"><?php 
        _e('Go here for more information.', 'updraftplus');
        ?>
</a></strong></p>
			</div>

			<?php 
        if (isset($_GET['updraft_restore_success'])) {
            echo "<div class=\"updated fade\" style=\"padding:8px;\"><strong>" . __('Your backup has been restored.', 'updraftplus') . '</strong>';
            if (2 == $_GET['updraft_restore_success']) {
                echo ' ' . __('Your old (themes, uploads, plugins, whatever) directories have been retained with "-old" appended to their name. Remove them when you are satisfied that the backup worked properly.');
            }
            echo "</div>";
        }
        $ws_advert = $updraftplus->wordshell_random_advert(1);
        if ($ws_advert && empty($this->no_settings_warning)) {
            echo '<div class="updated fade" style="max-width: 800px; font-size:140%; line-height: 140%; padding:14px; clear:left;">' . $ws_advert . '</div>';
        }
        if (!$updraftplus->memory_check(64)) {
            ?>
				<div class="updated" style="padding:8px;"><?php 
            _e("Your PHP memory limit (set by your web hosting company) is very low. UpdraftPlus attempted to raise it but was unsuccessful. This plugin may struggle with a memory limit of less than 64 Mb  - especially if you have very large files uploaded (though on the other hand, many sites will be successful with a 32Mb limit - your experience may vary).", 'updraftplus');
            ?>
 <?php 
            _e('Current limit is:', 'updraftplus');
            ?>
 <?php 
            echo $updraftplus->memory_check_current();
            ?>
 Mb</div>
			<?php 
        }
        if ($this->scan_old_dirs(true)) {
            $this->print_delete_old_dirs_form();
        }
        if (!empty($updraftplus->errors)) {
            echo '<div class="error fade" style="padding:8px;">';
            $updraftplus->list_errors();
            echo '</div>';
        }
        $backup_history = UpdraftPlus_Options::get_updraft_option('updraft_backup_history');
        if (empty($backup_history)) {
            $this->rebuild_backup_history();
            $backup_history = UpdraftPlus_Options::get_updraft_option('updraft_backup_history');
        }
        $backup_history = is_array($backup_history) ? $backup_history : array();
        ?>

		<h2 class="nav-tab-wrapper" style="margin: 14px 0px;">
		<?php 
        $tabflag = 1;
        if (isset($_REQUEST['tab']) && 'addons' == $_REQUEST['tab']) {
            $tabflag = 5;
        }
        if (isset($_REQUEST['tab']) && 'expert' == $_REQUEST['tab']) {
            $tabflag = 4;
        }
        ?>
		<a class="nav-tab <?php 
        if (1 == $tabflag) {
            echo 'nav-tab-active';
        }
        ?>
" href="#updraft-navtab-status-content" id="updraft-navtab-status"><?php 
        _e('Current Status', 'updraftplus');
        ?>
</a>
		<a class="nav-tab" href="#updraft-navtab-backups-contents" id="updraft-navtab-backups"><?php 
        echo __('Existing Backups', 'updraftplus') . ' (' . count($backup_history) . ')';
        ?>
</a>
		<a class="nav-tab" id="updraft-navtab-settings" href="#updraft-navtab-settings-content"><?php 
        _e('Settings', 'updraftplus');
        ?>
</a>
		<a class="nav-tab<?php 
        if (4 == $tabflag) {
            echo ' nav-tab-active';
        }
        ?>
" id="updraft-navtab-expert" href="#updraft-navtab-expert-content"><?php 
        _e('Debugging / Expert Tools', 'updraftplus');
        ?>
</a>
		<?php 
        do_action('updraftplus_settings_afternavtabs');
        ?>
		</h2>

		<?php 
        $updraft_dir = $updraftplus->backups_dir_location();
        $backup_disabled = $updraftplus->really_is_writable($updraft_dir) ? '' : 'disabled="disabled"';
        ?>
		
		<div id="updraft-poplog" >
			<pre id="updraft-poplog-content" style="white-space: pre-wrap;"></pre>
		</div>
		
		<div id="updraft-navtab-status-content" <?php 
        if (1 != $tabflag) {
            echo 'style="display:none;"';
        }
        ?>
>

			<div id="updraft-insert-admin-warning"></div>

			<table class="form-table" style="float:left; clear: both;">
				<noscript>
				<tr>
					<th><?php 
        _e('JavaScript warning', 'updraftplus');
        ?>
:</th>
					<td style="color:red"><?php 
        _e('This admin interface uses JavaScript heavily. You either need to activate it within your browser, or to use a JavaScript-capable browser.', 'updraftplus');
        ?>
</td>
				</tr>
				</noscript>

				<tr>
					<th><?php 
        _e('Actions', 'updraftplus');
        ?>
:</th>
					<td>

					<?php 
        if ($backup_disabled) {
            $unwritable_mess = htmlspecialchars(__("The 'Backup Now' button is disabled as your backup directory is not writable (go to the 'Settings' tab and find the relevant option).", 'updraftplus'));
            $this->show_admin_warning($unwritable_mess, "error");
        }
        ?>

					<button type="button" <?php 
        echo $backup_disabled;
        ?>
 class="button-primary updraft-bigbutton" <?php 
        if ($backup_disabled) {
            echo 'title="' . esc_attr(__('This button is disabled because your backup directory is not writable (see the settings).', 'updraftplus')) . '" ';
        }
        ?>
 onclick="jQuery('#backupnow_label').val(''); jQuery('#updraft-backupnow-modal').dialog('open');"><?php 
        _e('Backup Now', 'updraftplus');
        ?>
</button>

					<button type="button" class="button-primary updraft-bigbutton" onclick="updraft_openrestorepanel();">
						<?php 
        _e('Restore', 'updraftplus');
        ?>
					</button>

					<button type="button" class="button-primary updraft-bigbutton" onclick="jQuery('#updraft-migrate-modal').dialog('open');"><?php 
        _e('Clone/Migrate', 'updraftplus');
        ?>
</button>

					</td>
				</tr>

				<?php 
        // UNIX timestamp
        $next_scheduled_backup = wp_next_scheduled('updraft_backup');
        if ($next_scheduled_backup) {
            // Convert to GMT
            $next_scheduled_backup_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup);
            // Convert to blog time zone
            $next_scheduled_backup = get_date_from_gmt($next_scheduled_backup_gmt, 'D, F j, Y H:i');
        } else {
            $next_scheduled_backup = __('Nothing currently scheduled', 'updraftplus');
        }
        $next_scheduled_backup_database = wp_next_scheduled('updraft_backup_database');
        if (UpdraftPlus_Options::get_updraft_option('updraft_interval_database', UpdraftPlus_Options::get_updraft_option('updraft_interval')) == UpdraftPlus_Options::get_updraft_option('updraft_interval')) {
            $next_scheduled_backup_database = 'Nothing currently scheduled' == $next_scheduled_backup ? $next_scheduled_backup : __("At the same time as the files backup", 'updraftplus');
        } else {
            if ($next_scheduled_backup_database) {
                // Convert to GMT
                $next_scheduled_backup_database_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup_database);
                // Convert to blog time zone
                $next_scheduled_backup_database = get_date_from_gmt($next_scheduled_backup_database_gmt, 'D, F j, Y H:i');
            } else {
                $next_scheduled_backup_database = __('Nothing currently scheduled', 'updraftplus');
            }
        }
        $current_time = get_date_from_gmt(gmdate('Y-m-d H:i:s'), 'D, F j, Y H:i');
        $last_backup_html = $this->last_backup_html();
        ?>

				<script>var lastbackup_laststatus = '<?php 
        echo esc_js($last_backup_html);
        ?>
';</script>

				<tr>
					<th><span title="<?php 
        _e('All the times shown in this section are using WordPress\'s configured time zone, which you can set in Settings -> General', 'updraftplus');
        ?>
"><?php 
        _e('Next scheduled backups', 'updraftplus');
        ?>
:</span></th>
					<td>
						<table style="border: 0px; padding: 0px; margin: 0 10px 0 0;">
						<tr>
						<td style="width: 124px; vertical-align:top; margin: 0px; padding: 0px;"><?php 
        _e('Files', 'updraftplus');
        ?>
:</td><td style="color:blue; margin: 0px; padding: 0px;"><?php 
        echo $next_scheduled_backup;
        ?>
</td>
						</tr><tr>
						<td style="width: 124px; vertical-align:top; margin: 0px; padding: 0px;"><?php 
        _e('Database', 'updraftplus');
        ?>
: </td><td style="color:blue; margin: 0px; padding: 0px;"><?php 
        echo $next_scheduled_backup_database;
        ?>
</td>
						</tr><tr>
						<td style="width: 124px; vertical-align:top; margin: 0px; padding: 0px;"><?php 
        _e('Time now', 'updraftplus');
        ?>
: </td><td style="color:blue; margin: 0px; padding: 0px;"><?php 
        echo $current_time;
        ?>
</td>
						</table>
					</td>
				</tr>
				<tr>
					<th><?php 
        _e('Last backup job run:', 'updraftplus');
        ?>
</th>
					<td id="updraft_last_backup"><?php 
        echo $last_backup_html;
        ?>
</td>
				</tr>
			</table>

			<br style="clear:both" />
			<table class="form-table">

				<?php 
        $active_jobs = $this->print_active_jobs();
        ?>
				<tr id="updraft_activejobsrow" style="<?php 
        if (!$active_jobs) {
            echo 'display:none;';
        }
        ?>
">
					<th><?php 
        _e('Backups in progress:', 'updraftplus');
        ?>
</th>
					<td id="updraft_activejobs"><?php 
        echo $active_jobs;
        ?>
</td>
				</tr>

				<tr id="updraft_lastlogmessagerow">
					<th><?php 
        _e('Last log message', 'updraftplus');
        ?>
:</th>
					<td>
						<span id="updraft_lastlogcontainer"><?php 
        echo htmlspecialchars(UpdraftPlus_Options::get_updraft_option('updraft_lastmessage', __('(Nothing yet logged)', 'updraftplus')));
        ?>
</span><br>
						<a href="?page=updraftplus&action=downloadlatestmodlog&wpnonce=<?php 
        echo wp_create_nonce('updraftplus_download');
        ?>
" class="updraft-log-link" onclick="event.preventDefault(); updraft_popuplog('');"><?php 
        _e('Download most recently modified log file', 'updraftplus');
        ?>
</a>
					</td>
				</tr>

				<!--<tr>
					<th><?php 
        echo htmlspecialchars(__('Backups, logs & restoring', 'updraftplus'));
        ?>
:</th>
					<td><a id="updraft_showbackups" href="#" title="<?php 
        _e('Press to see available backups', 'updraftplus');
        ?>
" onclick="updraft_openrestorepanel(0); return false;"><?php 
        echo sprintf(__('%d set(s) available', 'updraftplus'), count($backup_history));
        ?>
</a></td>
				</tr>-->

				<?php 
        # Currently disabled - not sure who we want to show this to
        if (1 == 0 && !defined('UPDRAFTPLUS_NOADS_B')) {
            $feed = $updraftplus->get_updraftplus_rssfeed();
            if (is_a($feed, 'SimplePie')) {
                echo '<tr><th style="vertical-align:top;">' . __('Latest UpdraftPlus.com news:', 'updraftplus') . '</th><td style="vertical-align:top;">';
                echo '<ul style="list-style: disc inside;">';
                foreach ($feed->get_items(0, 5) as $item) {
                    echo '<li>';
                    echo '<a href="' . esc_attr($item->get_permalink()) . '">';
                    echo htmlspecialchars($item->get_title());
                    # D, F j, Y H:i
                    echo "</a> (" . htmlspecialchars($item->get_date('j F Y')) . ")";
                    echo '</li>';
                }
                echo '</ul></td></tr>';
            }
        }
        ?>
			</table>

<div id="updraft-migrate-modal" title="<?php 
        _e('Migrate Site', 'updraftplus');
        ?>
">

<?php 
        if (class_exists('UpdraftPlus_Addons_Migrator')) {
            echo '<p>' . str_replace('"', "&quot;", __('Migration of data from another site happens through the "Restore" button. A "migration" is ultimately the same as a restoration - but using backup archives that you import from another site. UpdraftPlus modifies the restoration operation appropriately, to fit the backup data to the new site.', 'updraftplus')) . ' ' . sprintf(__('<a href="%s">Read this article to see step-by-step how it\'s done.</a>', 'updraftplus'), 'http://updraftplus.com/faqs/how-do-i-migrate-to-a-new-site-location/');
        } else {
            echo '<p>' . __('Do you want to migrate or clone/duplicate a site?', 'updraftplus') . '</p><p>' . __('Then, try out our "Migrator" add-on. After using it once, you\'ll have saved the purchase price compared to the time needed to copy a site by hand.', 'updraftplus') . '</p><p><a href="http://updraftplus.com/shop/migrator/">' . __('Get it here.', 'updraftplus') . '</a>';
        }
        ?>
</p>
</div>

<div id="updraft-iframe-modal">
	<div id="updraft-iframe-modal-innards">
	</div>
</div>

<div id="updraft-backupnow-modal" title="UpdraftPlus - <?php 
        _e('Perform a one-time backup', 'updraftplus');
        ?>
">
	<p><?php 
        _e("To proceed, press 'Backup Now'. Then, watch the 'Last Log Message' field for activity.", 'updraftplus');
        ?>
</p>

	<p>
		<input type="checkbox" id="backupnow_nodb"> <label for="backupnow_nodb"><?php 
        _e("Don't include the database in the backup", 'updraftplus');
        ?>
</label><br>
		<input type="checkbox" id="backupnow_nofiles"> <label for="backupnow_nofiles"><?php 
        _e("Don't include any files in the backup", 'updraftplus');
        ?>
</label><br>
		<input type="checkbox" id="backupnow_nocloud"> <label for="backupnow_nocloud"><?php 
        _e("Don't send this backup to remote storage", 'updraftplus');
        ?>
</label>
	</p>

	<?php 
        do_action('updraft_backupnow_modal_afteroptions');
        ?>

	<p><?php 
        _e('Does nothing happen when you attempt backups?', 'updraftplus');
        ?>
 <a href="http://updraftplus.com/faqs/my-scheduled-backups-and-pressing-backup-now-does-nothing-however-pressing-debug-backup-does-produce-a-backup/"><?php 
        _e('Go here for help.', 'updraftplus');
        ?>
</a></p>
</div>

			<?php 
        if (is_multisite() && !file_exists(UPDRAFTPLUS_DIR . '/addons/multisite.php')) {
            ?>
				<h2>UpdraftPlus <?php 
            _e('Multisite', 'updraftplus');
            ?>
</h2>
				<table>
				<tr>
				<td>
				<p style="max-width:800px;"><?php 
            echo __('Do you need WordPress Multisite support?', 'updraftplus') . ' <a href="http://updraftplus.com/">' . __('Please check out UpdraftPlus Premium, or the stand-alone Multisite add-on.', 'updraftplus');
            ?>
</a>.</p>
				</td>
				</tr>
				</table>
			<?php 
        }
        ?>

		</div>

		<div id="updraft-navtab-backups-content" style="display:none;">
			<?php 
        $this->settings_downloadingandrestoring($backup_history);
        ?>
		</div>

		<div id="updraft-navtab-settings-content" style="display:none;">
			<h2 style="margin-top: 6px;"><?php 
        _e('Configure Backup Contents And Schedule', 'updraftplus');
        ?>
</h2>
			<?php 
        UpdraftPlus_Options::options_form_begin();
        ?>
				<?php 
        $this->settings_formcontents($last_backup_html);
        ?>
			</form>
		</div>

		<div id="updraft-navtab-expert-content"<?php 
        if (4 != $tabflag) {
            echo ' style="display:none;"';
        }
        ?>
>
			<?php 
        $this->settings_expertsettings($backup_disabled);
        ?>
		</div>

		<?php 
        do_action('updraftplus_settings_finish');
    }
Example #5
0
    public function settings_output()
    {
        global $updraftplus;
        wp_enqueue_style('jquery-ui', UPDRAFTPLUS_URL . '/includes/jquery-ui-1.8.22.custom.css');
        /*
        we use request here because the initial restore is triggered by a POSTed form. we then may need to obtain credentials 
        for the WP_Filesystem. to do this WP outputs a form, but we don't pass our parameters via that. So the values are 
        passed back in as GET parameters. REQUEST covers both GET and POST so this logic works.
        */
        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'updraft_restore' && isset($_REQUEST['backup_timestamp'])) {
            $backup_success = $this->restore_backup($_REQUEST['backup_timestamp']);
            if (empty($updraftplus->errors) && $backup_success === true) {
                // If we restored the database, then that will have out-of-date information which may confuse the user - so automatically re-scan for them.
                $this->rebuild_backup_history();
                echo '<p><strong>';
                $updraftplus->log_e('Restore successful!');
                echo '</strong></p>';
                $updraftplus->log("Restore successful");
                echo '<strong>' . __('Actions', 'updraftplus') . ':</strong> <a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&updraft_restore_success=true">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
                return;
            } elseif (is_wp_error($backup_success)) {
                echo '<p>';
                $updraftplus->log_e('Restore failed...');
                echo '</p>';
                $updraftplus->log_wp_error($backup_success);
                $updraftplus->log("Restore failed");
                $updraftplus->list_errors();
                echo '<strong>' . __('Actions', 'updraftplus') . ':</strong> <a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
                return;
            } elseif (false === $backup_success) {
                # This means, "not yet - but stay on the page because we may be able to do it later, e.g. if the user types in the requested information"
                return;
            }
        }
        if (isset($_REQUEST['action']) && 'updraft_delete_old_dirs' == $_REQUEST['action']) {
            $nonce = empty($_REQUEST['_wpnonce']) ? "" : $_REQUEST['_wpnonce'];
            if (!wp_verify_nonce($nonce, 'updraftplus-credentialtest-nonce')) {
                die('Security check');
            }
            $this->delete_old_dirs_go();
            return;
        }
        if (isset($_GET['error'])) {
            $this->show_admin_warning(htmlspecialchars($_GET['error']), 'error');
        }
        if (isset($_GET['message'])) {
            $this->show_admin_warning(htmlspecialchars($_GET['message']));
        }
        if (isset($_GET['action']) && $_GET['action'] == 'updraft_create_backup_dir' && isset($_GET['nonce']) && wp_verify_nonce($_GET['nonce'], 'create_backup_dir')) {
            $created = $this->create_backup_dir();
            if (is_wp_error($created)) {
                echo '<p>' . __('Backup directory could not be created', 'updraftplus') . '...<br/>';
                echo '<ul style="list-style: disc inside;">';
                foreach ($created->get_error_messages() as $key => $msg) {
                    echo '<li>' . htmlspecialchars($msg) . '</li>';
                }
                echo '</ul></p>';
            } elseif ($created !== false) {
                echo '<p>' . __('Backup directory successfully created.', 'updraftplus') . '</p><br/>';
            }
            echo '<b>' . __('Actions', 'updraftplus') . ':</b> <a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
            return;
        }
        do_action('updraftplus_settings_page_init');
        echo '<div id="updraft_backup_started" class="updated fade" style="display:none; max-width: 800px; font-size:140%; line-height: 140%; padding:14px; clear:left;"></div>';
        // updraft_file_ids is not deleted
        if (isset($_POST['action']) && $_POST['action'] == 'updraft_backup_debug_all') {
            $updraftplus->boot_backup(true, true);
        } elseif (isset($_POST['action']) && $_POST['action'] == 'updraft_backup_debug_db') {
            $updraftplus->boot_backup(false, true, false, true);
            //			global $updraftplus_backup;
            // 			if (!is_a($updraftplus_backup, 'UpdraftPlus_Backup')) require_once(UPDRAFTPLUS_DIR.'/backup.php');
            // 			$updraftplus_backup->backup_db();
        } elseif (isset($_POST['action']) && $_POST['action'] == 'updraft_wipesettings') {
            $settings = $this->get_settings_keys();
            foreach ($settings as $s) {
                UpdraftPlus_Options::delete_updraft_option($s);
            }
            $site_options = array('updraft_oneshotnonce');
            foreach ($site_options as $s) {
                delete_site_option($s);
            }
            $this->show_admin_warning(__("Your settings have been wiped.", 'updraftplus'));
        }
        ?>
		<div class="wrap" id="updraft-wrap">
			<h1><?php 
        echo $updraftplus->plugin_title;
        ?>
</h1>

			<?php 
        _e('By UpdraftPlus.Com', 'updraftplus');
        ?>
 ( <a href="http://updraftplus.com">UpdraftPlus.Com</a> | <a href="http://updraftplus.com/news/"><?php 
        _e('News', 'updraftplus');
        ?>
</a> | <?php 
        if (!defined('UPDRAFTPLUS_NOADS_A')) {
            ?>
<a href="http://updraftplus.com/shop/"><?php 
            _e("Premium", 'updraftplus');
            ?>
</a>  | <?php 
        }
        ?>
<a href="http://updraftplus.com/support/"><?php 
        _e("Support", 'updraftplus');
        ?>
</a> | <a href="http://david.dw-perspective.org.uk"><?php 
        _e("Lead developer's homepage", 'updraftplus');
        ?>
</a> | <?php 
        if (1 == 0 && !defined('UPDRAFTPLUS_NOADS_A')) {
            ?>
<a href="http://wordshell.net">WordShell - WordPress command line</a> | <a href="http://david.dw-perspective.org.uk/donate"><?php 
            _e('Donate', 'updraftplus');
            ?>
</a> | <?php 
        }
        ?>
<a href="http://updraftplus.com/support/frequently-asked-questions/">FAQs</a> | <a href="http://profiles.wordpress.org/davidanderson/"><?php 
        _e('More plugins', 'updraftplus');
        ?>
</a> ) <?php 
        _e('Version', 'updraftplus');
        ?>
: <?php 
        echo $updraftplus->version;
        ?>
			<br>

			<div id="updraft-hidethis">
			<p><strong><?php 
        _e('Warning:', 'updraftplus');
        ?>
 <?php 
        _e("If you can still read these words after the page finishes loading, then there is a JavaScript or jQuery problem in the site.", 'updraftplus');
        ?>
 <a href="http://updraftplus.com/do-you-have-a-javascript-or-jquery-error/"><?php 
        _e('Go here for more information.', 'updraftplus');
        ?>
</a></strong></p>
			</p>
			</div>

			<?php 
        if (isset($_GET['updraft_restore_success'])) {
            echo "<div class=\"updated fade\" style=\"padding:8px;\"><strong>" . __('Your backup has been restored.', 'updraftplus') . '</strong> ' . __('If your restore included files, then your old (themes, uploads, plugins, whatever) directories have been retained with "-old" appended to their name. Remove them when you are satisfied that the backup worked properly.') . "</div>";
        }
        $ws_advert = $updraftplus->wordshell_random_advert(1);
        if ($ws_advert) {
            echo '<div class="updated fade" style="max-width: 800px; font-size:140%; line-height: 140%; padding:14px; clear:left;">' . $ws_advert . '</div>';
        }
        if (!$updraftplus->memory_check(64)) {
            ?>
				<div class="updated" style="padding:8px;"><?php 
            _e("Your PHP memory limit (set by your web hosting company) is very low. UpdraftPlus attempted to raise it but was unsuccessful. This plugin may struggle with a memory limit of less than 64 Mb  - especially if you have very large files uploaded (though on the other hand, many sites will be successful with a 32Mb limit - your experience may vary).", 'updraftplus');
            ?>
 <?php 
            _e('Current limit is:', 'updraftplus');
            ?>
 <?php 
            echo $updraftplus->memory_check_current();
            ?>
 Mb</div>
			<?php 
        }
        if ($this->scan_old_dirs()) {
            $this->print_delete_old_dirs_form();
        }
        if (!empty($updraftplus->errors)) {
            echo '<div class="error fade" style="padding:8px;">';
            $updraftplus->list_errors();
            echo '</div>';
        }
        ?>

			<h2 style="clear:left;"><?php 
        _e('Existing Schedule And Backups', 'updraftplus');
        ?>
</h2>

			<table class="form-table" style="float:left; clear: both; width:605px;">
				<noscript>
				<tr>
					<th><?php 
        _e('JavaScript warning', 'updraftplus');
        ?>
:</th>
					<td style="color:red"><?php 
        _e('This admin interface uses JavaScript heavily. You either need to activate it within your browser, or to use a JavaScript-capable browser.', 'updraftplus');
        ?>
</td>
				</tr>
				</noscript>
					<?php 
        $updraft_dir = $updraftplus->backups_dir_location();
        // UNIX timestamp
        $next_scheduled_backup = wp_next_scheduled('updraft_backup');
        if ($next_scheduled_backup) {
            // Convert to GMT
            $next_scheduled_backup_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup);
            // Convert to blog time zone
            $next_scheduled_backup = get_date_from_gmt($next_scheduled_backup_gmt, 'D, F j, Y H:i');
        } else {
            $next_scheduled_backup = __('Nothing currently scheduled', 'updraftplus');
        }
        $next_scheduled_backup_database = wp_next_scheduled('updraft_backup_database');
        if (UpdraftPlus_Options::get_updraft_option('updraft_interval_database', UpdraftPlus_Options::get_updraft_option('updraft_interval')) == UpdraftPlus_Options::get_updraft_option('updraft_interval')) {
            $next_scheduled_backup_database = 'Nothing currently scheduled' == $next_scheduled_backup ? $next_scheduled_backup : __("At the same time as the files backup", 'updraftplus');
        } else {
            if ($next_scheduled_backup_database) {
                // Convert to GMT
                $next_scheduled_backup_database_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup_database);
                // Convert to blog time zone
                $next_scheduled_backup_database = get_date_from_gmt($next_scheduled_backup_database_gmt, 'D, F j, Y H:i');
            } else {
                $next_scheduled_backup_database = __('Nothing currently scheduled', 'updraftplus');
            }
        }
        $current_time = get_date_from_gmt(gmdate('Y-m-d H:i:s'), 'D, F j, Y H:i');
        $backup_disabled = $updraftplus->really_is_writable($updraft_dir) ? '' : 'disabled="disabled"';
        $last_backup_html = $this->last_backup_html();
        ?>

				<script>var lastbackup_laststatus = '<?php 
        echo esc_js($last_backup_html);
        ?>
';</script>

				<tr>
					<th><span title="<?php 
        _e('All the times shown in this section are using WordPress\'s configured time zone, which you can set in Settings -> General', 'updraftplus');
        ?>
"><?php 
        _e('Next scheduled backups', 'updraftplus');
        ?>
:</span></th>
					<td>
						<table style="border: 0px; padding: 0px; margin: 0 10px 0 0;">
						<tr>
						<td style="width: 124px; vertical-align:top; margin: 0px; padding: 0px;"><?php 
        _e('Files', 'updraftplus');
        ?>
:</td><td style="color:blue;  margin: 0px; padding: 0px;"><?php 
        echo $next_scheduled_backup;
        ?>
</td>
						</tr><tr>
						<td style="width: 124px; vertical-align:top; margin: 0px; padding: 0px;"><?php 
        _e('Database', 'updraftplus');
        ?>
: </td><td style="color:blue;  margin: 0px; padding: 0px;"><?php 
        echo $next_scheduled_backup_database;
        ?>
</td>
						</tr><tr>
						<td style="width: 124px; vertical-align:top; margin: 0px; padding: 0px;"><?php 
        _e('Time now', 'updraftplus');
        ?>
: </td><td style="color:blue; margin: 0px; padding: 0px;"><?php 
        echo $current_time;
        ?>
</td>
						</table>
					</td>
				</tr>
				<tr>
					<th><?php 
        _e('Last backup job run:', 'updraftplus');
        ?>
</th>
					<td id="updraft_last_backup"><?php 
        echo $last_backup_html;
        ?>
</td>
				</tr>
			</table>

			<div style="float:left; width:200px; margin-top: <?php 
        echo class_exists('UpdraftPlus_Addons_Migrator') ? "20" : "0";
        ?>
px;">
				<div style="margin-bottom: 10px;">
					<button type="button" <?php 
        echo $backup_disabled;
        ?>
 class="button-primary updraft-bigbutton" style="padding-top:2px;padding-bottom:2px;font-size:22px !important; min-height: 32px; min-width: 180px;" <?php 
        if ($backup_disabled) {
            echo 'title="' . esc_attr(__('This button is disabled because your backup directory is not writable (see the setting futher down the page).', 'updraftplus')) . '" ';
        }
        ?>
 onclick="jQuery('#updraft-backupnow-modal').dialog('open');"><?php 
        _e('Backup Now', 'updraftplus');
        ?>
</button>
				</div>
				<div style="margin-bottom: 10px;">
					<?php 
        $backup_history = UpdraftPlus_Options::get_updraft_option('updraft_backup_history');
        if (empty($backup_history)) {
            $this->rebuild_backup_history();
            $backup_history = UpdraftPlus_Options::get_updraft_option('updraft_backup_history');
        }
        $backup_history = is_array($backup_history) ? $backup_history : array();
        ?>
					<input type="button" class="button-primary updraft-bigbutton" value="<?php 
        _e('Restore', 'updraftplus');
        ?>
" style="padding-top:2px;padding-bottom:2px;font-size:22px !important; min-height: 32px;  min-width: 180px;" onclick="jQuery('.download-backups').slideDown(); updraft_historytimertoggle(1); jQuery('html,body').animate({scrollTop: jQuery('#updraft_lastlogcontainer').offset().top},'slow');">
				</div>
				<div>
					<button type="button" class="button-primary updraft-bigbutton" style="padding-top:2px;padding-bottom:2px;font-size:22px !important; min-height: 32px; min-width: 180px;" onclick="jQuery('#updraft-migrate-modal').dialog('open');"><?php 
        _e('Clone/Migrate', 'updraftplus');
        ?>
</button>
				</div>
			</div>

			<br style="clear:both" />
			<table class="form-table">

				<?php 
        $active_jobs = $this->print_active_jobs();
        ?>
				<tr id="updraft_activejobsrow" style="<?php 
        if (!$active_jobs) {
            echo 'display:none;';
        }
        ?>
">
					<th><?php 
        _e('Backups in progress:', 'updraftplus');
        ?>
</th>
					<td id="updraft_activejobs"><?php 
        echo $active_jobs;
        ?>
</td>
				</tr>

				<tr id="updraft_lastlogmessagerow">
					<th><?php 
        _e('Last log message', 'updraftplus');
        ?>
:</th>
					<td>
						<span id="updraft_lastlogcontainer"><?php 
        echo htmlspecialchars(UpdraftPlus_Options::get_updraft_option('updraft_lastmessage', __('(Nothing yet logged)', 'updraftplus')));
        ?>
</span><br>
						<a href="?page=updraftplus&action=downloadlatestmodlog&wpnonce=<?php 
        echo wp_create_nonce('updraftplus_download');
        ?>
"><?php 
        _e('Download most recently modified log file', 'updraftplus');
        ?>
</a>
					</td>
				</tr>

				<tr>
					<th><?php 
        echo htmlspecialchars(__('Backups, logs & restoring', 'updraftplus'));
        ?>
:</th>
					<td><a id="updraft_showbackups" href="#" title="<?php 
        _e('Press to see available backups', 'updraftplus');
        ?>
" onclick="jQuery('.download-backups').fadeToggle(); updraft_historytimertoggle(0);"><?php 
        echo sprintf(__('%d set(s) available', 'updraftplus'), count($backup_history));
        ?>
</a></td>
				</tr>
				<?php 
        if (defined('UPDRAFTPLUS_EXPERIMENTAL_MISC') && UPDRAFTPLUS_EXPERIMENTAL_MISC == true) {
            ?>
				<tr>
					<th><?php 
            echo __('Latest UpdraftPlus.com news:', 'updraftplus');
            ?>
</th>
					<td>Blah blah blah. Move to right-hand col?</td>
				</tr>
				<?php 
        }
        ?>

			</table>

			<table class="form-table">
				<tr>
					<td style="">&nbsp;</td><td class="download-backups" style="display:none; border: 2px dashed #aaa;">
						<h2><?php 
        echo __('Downloading and restoring', 'updraftplus');
        ?>
</h2>
						<p style="display:none; background-color:pink; padding:8px; margin:4px;border: 1px dotted;" id="ud-whitespace-warning">
						 <?php 
        echo '<strong>' . __('Warning', 'updraftplus') . ':</strong> ' . __('Your WordPress installation has a problem with outputting extra whitespace. This can corrupt backups that you download from here.', 'updraftplus') . ' <a href="http://updraftplus.com/problems-with-extra-white-space/">' . __('Please consult this FAQ for help on what to do about it.', 'updraftplus') . '</a>';
        ?>
						</p>
						<p style="max-width: 740px;"><ul style="list-style: disc inside;">
						<li><strong><?php 
        _e('Downloading', 'updraftplus');
        ?>
:</strong> <?php 
        _e("Pressing a button for Database/Plugins/Themes/Uploads/Others will make UpdraftPlus try to bring the backup file back from the remote storage (if any - e.g. Amazon S3, Dropbox, Google Drive, FTP) to your webserver. Then you will be allowed to download it to your computer. If the fetch from the remote storage stops progressing (wait 30 seconds to make sure), then press again to resume. Remember that you can also visit the cloud storage vendor's website directly.", 'updraftplus');
        ?>
</li>
						<li><strong><?php 
        _e('Restoring:', 'updraftplus');
        ?>
</strong> <?php 
        _e('Press the Restore button next to the chosen backup set.', 'updraftplus');
        ?>
 <?php 
        _e('More tasks:', 'updraftplus');
        ?>
 <a href="#" onclick="jQuery('#updraft-plupload-modal').slideToggle(); return false;"><?php 
        _e('upload backup files', 'updraftplus');
        ?>
</a> | <a href="#" onclick="updraft_updatehistory(1); return false;" title="<?php 
        _e('Press here to look inside your UpdraftPlus directory (in your web hosting space) for any new backup sets that you have uploaded. The location of this directory is set in the expert settings, below.', 'updraftplus');
        ?>
"><?php 
        _e('rescan folder for new backup sets', 'updraftplus');
        ?>
</a></li>
						<?php 
        if (false !== strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') || false !== strpos($_SERVER['HTTP_USER_AGENT'], 'OPR/')) {
            ?>
								<li><strong><?php 
            _e('Opera web browser', 'updraftplus');
            ?>
:</strong> <?php 
            _e('If you are using this, then turn Turbo/Road mode off.', 'updraftplus');
            ?>
</li>
						<?php 
        }
        ?>
						<?php 
        $service = UpdraftPlus_Options::get_updraft_option('updraft_service');
        if ($service === 'googledrive' || is_array($service) && in_array('googledrive', $service)) {
            ?>
<li><strong><?php 
            _e('Google Drive', 'updraftplus');
            ?>
:</strong> <?php 
            _e('Google changed their permissions setup recently (April 2013). To download or restore from Google Drive, you <strong>must</strong> first re-authenticate (using the link in the Google Drive configuration section).', 'updraftplus');
            ?>
</li>
						<?php 
        }
        ?>

						<li title="<?php 
        _e('This is a count of the contents of your Updraft directory', 'updraftplus');
        ?>
"><strong><?php 
        _e('Web-server disk space in use by UpdraftPlus', 'updraftplus');
        ?>
:</strong> <span id="updraft_diskspaceused"><em>(calculating...)</em></span> <a href="#" onclick="updraftplus_diskspace(); return false;"><?php 
        _e('refresh', 'updraftplus');
        ?>
</a></li></ul>

						<div id="updraft-plupload-modal" title="<?php 
        _e('UpdraftPlus - Upload backup files', 'updraftplus');
        ?>
" style="width: 75%; margin: 16px; display:none; margin-left: 100px;">
						<p style="max-width: 610px;"><em><?php 
        _e("Upload files into UpdraftPlus. Use this to import backups made on a different WordPress installation.", 'updraftplus');
        ?>
 <?php 
        echo htmlspecialchars(__('Or, you can place them manually into your UpdraftPlus directory (usually wp-content/updraft), e.g. via FTP, and then use the "rescan" link above.', 'updraftplus'));
        ?>
</em></p>
							<div id="plupload-upload-ui" style="width: 70%;">
								<div id="drag-drop-area">
									<div class="drag-drop-inside">
									<p class="drag-drop-info"><?php 
        _e('Drop backup files here', 'updraftplus');
        ?>
</p>
									<p><?php 
        _ex('or', 'Uploader: Drop backup files here - or - Select Files');
        ?>
</p>
									<p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php 
        esc_attr_e('Select Files');
        ?>
" class="button" /></p>
									</div>
								</div>
								<div id="filelist">
								</div>
							</div>

						</div>

						<div id="ud_downloadstatus"></div>
						<div id="updraft_existing_backups" style="margin-bottom:12px;">
							<?php 
        print $this->existing_backup_table($backup_history);
        ?>
						</div>
					</td>
				</tr>
			</table>

<div id="updraft-message-modal" title="UpdraftPlus">
	<div id="updraft-message-modal-innards" style="font-size:115%; padding: 4px;">
	</div>
</div>

<div id="updraft-delete-modal" title="<?php 
        _e('Delete backup set', 'updraftplus');
        ?>
">
<form id="updraft_delete_form" method="post">
	<p style="margin-top:3px; padding-top:0">
		<?php 
        _e('Are you sure that you wish to delete this backup set?', 'updraftplus');
        ?>
	</p>
	<fieldset>
		<input type="hidden" name="nonce" value="<?php 
        echo wp_create_nonce('updraftplus-credentialtest-nonce');
        ?>
">
		<input type="hidden" name="action" value="updraft_ajax">
		<input type="hidden" name="subaction" value="deleteset">
		<input type="hidden" name="backup_timestamp" value="0" id="updraft_delete_timestamp">
		<input type="hidden" name="backup_nonce" value="0" id="updraft_delete_nonce">
		<div id="updraft-delete-remote-section"><input checked="checked" type="checkbox" name="delete_remote" id="updraft_delete_remote" value="1"> <label for="updraft_delete_remote"><?php 
        _e('Also delete from remote storage', 'updraftplus');
        ?>
</label><br>
		<p id="updraft-delete-waitwarning" style="display:none;"><em><?php 
        _e('Deleting... please allow time for the communications with the remote storage to complete.', 'updraftplus');
        ?>
</em></p>
		</div>
	</fieldset>
</form>
</div>

<div id="updraft-restore-modal" title="UpdraftPlus - <?php 
        _e('Restore backup', 'updraftplus');
        ?>
">
<p><strong><?php 
        _e('Restore backup from', 'updraftplus');
        ?>
:</strong> <span class="updraft_restore_date"></span></p>

<div id="updraft-restore-modal-stage2">

	<p><strong><?php 
        _e('Retrieving (if necessary) and preparing backup files...', 'updraftplus');
        ?>
</strong></p>
	<div id="ud_downloadstatus2"></div>

	<div id="updraft-restore-modal-stage2a"></div>

</div>

<div id="updraft-restore-modal-stage1">
<p><?php 
        _e("Restoring will replace this site's themes, plugins, uploads, database and/or other content directories (according to what is contained in the backup set, and your selection).", 'updraftplus');
        ?>
 <?php 
        _e('Choose the components to restore', 'updraftplus');
        ?>
:</p>
<form id="updraft_restore_form" method="post">
	<fieldset>
		<input type="hidden" name="action" value="updraft_restore">
		<input type="hidden" name="backup_timestamp" value="0" id="updraft_restore_timestamp">
		<?php 
        # The 'off' check is for badly configured setups - http://wordpress.org/support/topic/plugin-wp-super-cache-warning-php-safe-mode-enabled-but-safe-mode-is-off
        if ($updraftplus->detect_safe_mode()) {
            echo "<p><em>" . __('Your web server has PHP\'s so-called safe_mode active.', 'updraftplus') . ' ' . __('This makes time-outs much more likely. You are recommended to turn safe_mode off, or to restore only one entity at a time, <a href="http://updraftplus.com/faqs/i-want-to-restore-but-have-either-cannot-or-have-failed-to-do-so-from-the-wp-admin-console/">or to restore manually</a>.', 'updraftplus') . "</em></p><br/>";
        }
        $backupable_entities = $updraftplus->get_backupable_file_entities(true, true);
        foreach ($backupable_entities as $type => $info) {
            if (!isset($info['restorable']) || $info['restorable'] == true) {
                echo '<div><input id="updraft_restore_' . $type . '" type="checkbox" name="updraft_restore[]" value="' . $type . '"> <label for="updraft_restore_' . $type . '">' . $info['description'] . '</label><br>';
                do_action("updraftplus_restore_form_{$type}");
                echo '</div>';
            } else {
                $sdescrip = isset($info['shortdescription']) ? $info['shortdescription'] : $info['description'];
                echo "<div style=\"margin: 8px 0;\"><em>" . htmlspecialchars(sprintf(__('The following entity cannot be restored automatically: "%s".', 'updraftplus'), $sdescrip)) . " " . __('You will need to restore it manually.', 'updraftplus') . "</em><br>" . '<input id="updraft_restore_' . $type . '" type="hidden" name="updraft_restore[]" value="' . $type . '"></div>';
            }
        }
        ?>
		<div><input id="updraft_restore_db" type="checkbox" name="updraft_restore[]" value="db"> <label for="updraft_restore_db"><?php 
        _e('Database', 'updraftplus');
        ?>
</label><br>


			<div id="updraft_restorer_dboptions" style="display:none; padding:12px; margin: 8px 0 4px; border: dashed 1px;"><h4 style="margin: 0px 0px 6px; padding:0px;"><?php 
        echo sprintf(__('%s restoration options:', 'updraftplus'), __('Database', 'updraftplus'));
        ?>
</h4>

			<?php 
        do_action("updraftplus_restore_form_db");
        if (!class_exists('UpdraftPlus_Addons_Migrator')) {
            echo '<a href="http://updraftplus.com/faqs/tell-me-more-about-the-search-and-replace-site-location-in-the-database-option/">' . __('You can search and replace your database (for migrating a website to a new location/URL) with the Migrator add-on - follow this link for more information', 'updraftplus') . '</a>';
        }
        ?>

			</div>

		</div>
	</fieldset>
</form>
<p><em><a href="http://updraftplus.com/faqs/what-should-i-understand-before-undertaking-a-restoration/" target="_new"><?php 
        _e('Do read this helpful article of useful things to know before restoring.', 'updraftplus');
        ?>
</a></em></p>
</div>

</div>

<div id="updraft-migrate-modal" title="<?php 
        _e('Migrate Site', 'updraftplus');
        ?>
">

<?php 
        if (class_exists('UpdraftPlus_Addons_Migrator')) {
            echo '<p>' . str_replace('"', "&quot;", __('Migration of data from another site happens through the "Restore" button. A "migration" is ultimately the same as a restoration - but using backup archives that you import from another site. UpdraftPlus modifies the restoration operation appropriately, to fit the backup data to the new site.', 'updraftplus')) . ' ' . sprintf(__('<a href="%s">Read this article to see step-by-step how it\'s done.</a>', 'updraftplus'), 'http://updraftplus.com/faqs/how-do-i-migrate-to-a-new-site-location/');
        } else {
            echo '<p>' . __('Do you want to migrate or clone/duplicate a site?', 'updraftplus') . '</p><p>' . __('Then, try out our "Migrator" add-on. After using it once, you\'ll have saved the purchase price compared to the time needed to copy a site by hand.', 'updraftplus') . '</p><p><a href="http://updraftplus.com/shop/migrator/">' . __('Get it here.', 'updraftplus') . '</a>';
        }
        ?>
</p>
</div>

<div id="updraft-iframe-modal">
	<div id="updraft-iframe-modal-innards">
	</div>
</div>

<div id="updraft-backupnow-modal" title="UpdraftPlus - <?php 
        _e('Perform a one-time backup', 'updraftplus');
        ?>
">
	<p><?php 
        _e("To proceed, press 'Backup Now'. Then, watch the 'Last Log Message' field for activity after about 10 seconds. WordPress should start the backup running in the background.", 'updraftplus');
        ?>
</p>

	<p>
		<input type="checkbox" id="backupnow_nodb"> <label for="backupnow_nodb"><?php 
        _e("Don't include the database in the backup", 'updraftplus');
        ?>
</label><br>
		<input type="checkbox" id="backupnow_nofiles"> <label for="backupnow_nofiles"><?php 
        _e("Don't include any files in the backup", 'updraftplus');
        ?>
</label><br>
		<input type="checkbox" id="backupnow_nocloud"> <label for="backupnow_nocloud"><?php 
        _e("Don't send this backup to remote storage", 'updraftplus');
        ?>
</label>
	</p>

	<p><?php 
        _e('Does nothing happen when you attempt backups?', 'updraftplus');
        ?>
 <a href="http://updraftplus.com/faqs/my-scheduled-backups-and-pressing-backup-now-does-nothing-however-pressing-debug-backup-does-produce-a-backup/"><?php 
        _e('Go here for help.', 'updraftplus');
        ?>
</a></p>
</div>

			<?php 
        if (is_multisite() && !file_exists(UPDRAFTPLUS_DIR . '/addons/multisite.php')) {
            ?>
				<h2>UpdraftPlus <?php 
            _e('Multisite', 'updraftplus');
            ?>
</h2>
				<table>
				<tr>
				<td>
				<p style="max-width:800px;"><?php 
            echo __('Do you need WordPress Multisite support?', 'updraftplus') . ' <a href="http://updraftplus.com/">' . __('Please check out UpdraftPlus Premium, or the stand-alone Multisite add-on.', 'updraftplus');
            ?>
</a>.</p>
				</td>
				</tr>
				</table>
			<?php 
        }
        ?>
			<h2 style="margin-top: 6px;"><?php 
        _e('Configure Backup Contents And Schedule', 'updraftplus');
        ?>
</h2>
			<?php 
        UpdraftPlus_Options::options_form_begin();
        ?>
				<?php 
        $this->settings_formcontents($last_backup_html);
        ?>
			</form>
			<div style="padding-top: 40px; display:none;" class="expertmode">
				<hr>
				<h2><?php 
        _e('Debug Information And Expert Options', 'updraftplus');
        ?>
</h2>
				<p>
				<?php 
        echo sprintf(__('Web server:', 'updraftplus'), 'PHP') . ' ' . htmlspecialchars($_SERVER["SERVER_SOFTWARE"]) . ' (' . htmlspecialchars(php_uname()) . ')<br />';
        echo 'ABSPATH: ' . htmlspecialchars(ABSPATH) . '<br/>';
        echo 'WP_CONTENT_DIR: ' . htmlspecialchars(WP_CONTENT_DIR) . '<br/>';
        echo 'WP_PLUGIN_DIR: ' . htmlspecialchars(WP_PLUGIN_DIR) . '<br/>';
        $peak_memory_usage = memory_get_peak_usage(true) / 1024 / 1024;
        $memory_usage = memory_get_usage(true) / 1024 / 1024;
        echo __('Peak memory usage', 'updraftplus') . ': ' . $peak_memory_usage . ' MB<br/>';
        echo __('Current memory usage', 'updraftplus') . ': ' . $memory_usage . ' MB<br/>';
        echo __('PHP memory limit', 'updraftplus') . ': ' . ini_get('memory_limit') . ' <br/>';
        echo sprintf(__('%s version:', 'updraftplus'), 'PHP') . ' ' . phpversion() . ' - ';
        echo '<a href="admin-ajax.php?page=updraftplus&action=updraft_ajax&subaction=phpinfo&nonce=' . wp_create_nonce('updraftplus-credentialtest-nonce') . '" id="updraftplus-phpinfo">' . __('show PHP information (phpinfo)', 'updraftplus') . '</a><br/>';
        echo sprintf(__('%s version:', 'updraftplus'), 'MySQL') . ' ' . (function_exists('mysql_get_server_info') ? mysql_get_server_info() : '?') . '<br>';
        if (version_compare(phpversion(), '5.2.0', '>=') && extension_loaded('zip')) {
            $ziparchive_exists = __('Yes', 'updraftplus');
        } else {
            # First do class_exists, because method_exists still sometimes segfaults due to a rare PHP bug
            $ziparchive_exists = class_exists('ZipArchive') && method_exists('ZipArchive', 'addFile') ? __('Yes', 'updraftplus') : __('No', 'updraftplus');
        }
        echo __('PHP has support for ZipArchive::addFile:', 'updraftplus') . ' ' . $ziparchive_exists . '<br>';
        $binzip = $updraftplus->find_working_bin_zip(false, false);
        echo __('zip executable found:', 'updraftplus') . ' ' . (is_string($binzip) ? __('Yes') . ': ' . $binzip : __('No')) . '<br>';
        $hosting_bytes_free = $updraftplus->get_hosting_disk_quota_free();
        if (is_array($hosting_bytes_free)) {
            $perc = round(100 * $hosting_bytes_free[1] / max($hosting_bytes_free[2], 1), 1);
            echo sprintf(__('Free disk space in account: %s (%s used)', 'updraftplus'), round($hosting_bytes_free[3] / 1048576, 1) . " Mb", "{$perc} %") . "<br>";
        }
        echo '<a href="admin-ajax.php?page=updraftplus&action=updraft_ajax&subaction=backuphistoryraw&nonce=' . wp_create_nonce('updraftplus-credentialtest-nonce') . '" id="updraftplus-rawbackuphistory">' . __('Show raw backup and file list', 'updraftplus') . '</a><br/>';
        echo '<h3>' . __('Total (uncompressed) on-disk data:', 'updraftplus') . '</h3>';
        echo '<p style="clear: left; max-width: 600px;"><em>' . __('N.B. This count is based upon what was, or was not, excluded the last time you saved the options.', 'updraftplus') . '</em></p>';
        foreach ($backupable_entities as $key => $info) {
            $sdescrip = preg_replace('/ \\(.*\\)$/', '', $info['description']);
            if (strlen($sdescrip) > 20 && isset($info['shortdescription'])) {
                $sdescrip = $info['shortdescription'];
            }
            echo '<div style="clear: left;float:left; width:150px;">' . ucfirst($sdescrip) . ':</strong></div><div style="float:left;"><span id="updraft_diskspaceused_' . $key . '"><em></em></span> <a href="#" onclick="updraftplus_diskspace_entity(\'' . $key . '\'); return false;">' . __('count', 'updraftplus') . '</a></div>';
        }
        ?>

				</p>
				<p style="clear: left; padding-top: 20px; max-width: 600px; margin:0;"><?php 
        _e('The buttons below will immediately execute a backup run, independently of WordPress\'s scheduler. If these work whilst your scheduled backups and the "Backup Now" button do absolutely nothing (i.e. not even produce a log file), then it means that your scheduler is broken. You should then disable all your other plugins, and try the "Backup Now" button. If that fails, then contact your web hosting company and ask them if they have disabled wp-cron. If it succeeds, then re-activate your other plugins one-by-one, and find the one that is the problem and report a bug to them.', 'updraftplus');
        ?>
</p>

				<table border="0" style="border: none;">
				<tbody>
				<tr>
				<td>
				<form method="post">
					<input type="hidden" name="action" value="updraft_backup_debug_all" />
					<p><input type="submit" class="button-primary" <?php 
        echo $backup_disabled;
        ?>
 value="<?php 
        _e('Debug Full Backup', 'updraftplus');
        ?>
" onclick="return(confirm('<?php 
        echo htmlspecialchars(__('This will cause an immediate backup. The page will stall loading until it finishes (ie, unscheduled).', 'updraftplus'));
        ?>
'))" /></p>
				</form>
				</td><td>
				<form method="post">
					<input type="hidden" name="action" value="updraft_backup_debug_db" />
					<p><input type="submit" class="button-primary" <?php 
        echo $backup_disabled;
        ?>
 value="<?php 
        _e('Debug Database Backup', 'updraftplus');
        ?>
" onclick="return(confirm('<?php 
        echo htmlspecialchars(__('This will cause an immediate DB backup. The page will stall loading until it finishes (ie, unscheduled). The backup may well run out of time; really this button is only helpful for checking that the backup is able to get through the initial stages, or for small WordPress sites..', 'updraftplus'));
        ?>
'))" /></p>
				</form>
				</td>
				</tr>
				</tbody>
				</table>
				<h3><?php 
        _e('Wipe Settings', 'updraftplus');
        ?>
</h3>
				<p style="max-width: 600px;"><?php 
        _e('This button will delete all UpdraftPlus settings (but not any of your existing backups from your cloud storage). You will then need to enter all your settings again. You can also do this before deactivating/deinstalling UpdraftPlus if you wish.', 'updraftplus');
        ?>
</p>
				<form method="post">
					<input type="hidden" name="action" value="updraft_wipesettings" />
					<p><input type="submit" class="button-primary" value="<?php 
        _e('Wipe All Settings', 'updraftplus');
        ?>
" onclick="return(confirm('<?php 
        echo htmlspecialchars(__('This will delete all your UpdraftPlus settings - are you sure you want to do this?'));
        ?>
'))" /></p>
				</form>
			</div>

			<?php 
    }
Example #6
0
    function settings_output()
    {
        global $updraftplus;
        wp_enqueue_style('jquery-ui', UPDRAFTPLUS_URL . '/includes/jquery-ui-1.8.22.custom.css');
        /*
        we use request here because the initial restore is triggered by a POSTed form. we then may need to obtain credentials 
        for the WP_Filesystem. to do this WP outputs a form, but we don't pass our parameters via that. So the values are 
        passed back in as GET parameters. REQUEST covers both GET and POST so this logic works.
        */
        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'updraft_restore' && isset($_REQUEST['backup_timestamp'])) {
            $backup_success = $this->restore_backup($_REQUEST['backup_timestamp']);
            if (empty($updraftplus->errors) && $backup_success === true) {
                // If we restored the database, then that will have out-of-date information which may confuse the user - so automatically re-scan for them.
                $this->rebuild_backup_history();
                echo '<p><strong>' . __('Restore successful!', 'updraftplus') . '</strong></p>';
                echo '<b>' . __('Actions', 'updraftplus') . ':</b> <a href="options-general.php?page=updraftplus&updraft_restore_success=true">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
                return;
            } elseif (is_wp_error($backup_success)) {
                echo '<p>Restore failed...</p><ul style="list-style: disc inside;">';
                foreach ($updraftplus->errors as $err) {
                    if (is_wp_error($err)) {
                        foreach ($err->get_error_messages() as $msg) {
                            echo '<li>' . htmlspecialchars($msg) . '<li>';
                        }
                    } elseif (is_string($err)) {
                        echo "<li>" . htmlspecialchars($err) . "</li>";
                    } else {
                        print "<li>" . print_r($err, true) . "</li>";
                    }
                }
                echo '</ul><b>Actions:</b> <a href="options-general.php?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
                return;
            } elseif (false === $backup_success) {
                # This means, "not yet - but stay on the page because we may be able to do it later, e.g. if the user types in the requested information"
                return;
            }
            //uncomment the below once i figure out how i want the flow of a restoration to work.
            //echo '<b>'__('Actions','updraftplus').':</b> <a href="options-general.php?page=updraftplus">Return to UpdraftPlus Configuration</a>';
        }
        $deleted_old_dirs = false;
        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'updraft_delete_old_dirs') {
            echo '<h1>UpdraftPlus - ' . __('Remove old directories', 'updraftplus') . '</h1>';
            $nonce = empty($_REQUEST['_wpnonce']) ? "" : $_REQUEST['_wpnonce'];
            if (!wp_verify_nonce($nonce, 'updraft_delete_old_dirs')) {
                die('Security check');
            }
            if ($this->delete_old_dirs()) {
                echo '<p>' . __('Old directories successfully removed.', 'updraftplus') . '</p><br/>';
                $deleted_old_dirs = true;
            } else {
                echo '<p>', __('Old directory removal failed for some reason. You may want to do this manually.', 'updraftplus') . '</p><br/>';
            }
            echo '<b>' . __('Actions', 'updraftplus') . ':</b> <a href="options-general.php?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
            return;
        }
        if (isset($_GET['error'])) {
            $this->show_admin_warning(htmlspecialchars($_GET['error']), 'error');
        }
        if (isset($_GET['message'])) {
            $this->show_admin_warning(htmlspecialchars($_GET['message']));
        }
        if (isset($_GET['action']) && $_GET['action'] == 'updraft_create_backup_dir' && isset($_GET['nonce']) && wp_verify_nonce($_GET['nonce'], 'create_backup_dir')) {
            $created = $this->create_backup_dir();
            if (is_wp_error($created)) {
                echo '<p>' . __('Backup directory could not be created', 'updraftplus') . '...<br/>';
                echo '<ul style="list-style: disc inside;">';
                foreach ($created->get_error_messages() as $key => $msg) {
                    echo '<li>' . htmlspecialchars($msg) . '</li>';
                }
                echo '</ul></p>';
            } elseif ($created !== false) {
                echo '<p>' . __('Backup directory successfully created.', 'updraftplus') . '</p><br/>';
            }
            echo '<b>' . __('Actions', 'updraftplus') . ':</b> <a href="options-general.php?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
            return;
        }
        echo '<div id="updraft_backup_started" class="updated fade" style="display:none; max-width: 800px; font-size:140%; line-height: 140%; padding:14px; clear:left;"></div>';
        // updraft_file_ids is not deleted
        if (isset($_POST['action']) && $_POST['action'] == 'updraft_backup_debug_all') {
            $updraftplus->boot_backup(true, true);
        } elseif (isset($_POST['action']) && $_POST['action'] == 'updraft_backup_debug_db') {
            $updraftplus->backup_db();
        } elseif (isset($_POST['action']) && $_POST['action'] == 'updraft_wipesettings') {
            $settings = array('updraft_interval', 'updraft_interval_database', 'updraft_retain', 'updraft_retain_db', 'updraft_encryptionphrase', 'updraft_service', 'updraft_dropbox_appkey', 'updraft_dropbox_secret', 'updraft_googledrive_clientid', 'updraft_googledrive_secret', 'updraft_googledrive_remotepath', 'updraft_ftp_login', 'updraft_ftp_pass', 'updraft_ftp_remote_path', 'updraft_server_address', 'updraft_dir', 'updraft_email', 'updraft_delete_local', 'updraft_debug_mode', 'updraft_include_plugins', 'updraft_include_themes', 'updraft_include_uploads', 'updraft_include_others', 'updraft_include_wpcore', 'updraft_include_wpcore_exclude', 'updraft_include_more', 'updraft_include_blogs', 'updraft_include_mu-plugins', 'updraft_include_others_exclude', 'updraft_lastmessage', 'updraft_googledrive_clientid', 'updraft_googledrive_token', 'updraft_dropboxtk_request_token', 'updraft_dropboxtk_access_token', 'updraft_dropbox_folder', 'updraft_last_backup', 'updraft_starttime_files', 'updraft_starttime_db', 'updraft_sftp_settings', 'updraft_s3generic_login', 'updraft_s3generic_pass', 'updraft_s3generic_remote_path', 'updraft_s3generic_endpoint', 'updraft_webdav_settings', 'updraft_disable_ping', 'updraft_cloudfiles_user', 'updraft_cloudfiles_apikey', 'updraft_cloudfiles_path', 'updraft_cloudfiles_authurl', 'updraft_ssl_useservercerts', 'updraft_ssl_disableverify', 'updraft_s3_login', 'updraft_s3_pass', 'updraft_s3_remote_path', 'updraft_dreamobjects_login', 'updraft_dreamobjects_pass', 'updraft_dreamobjects_remote_path');
            foreach ($settings as $s) {
                UpdraftPlus_Options::delete_updraft_option($s);
            }
            $this->show_admin_warning(__("Your settings have been wiped.", 'updraftplus'));
        }
        ?>
		<div class="wrap">
			<h1><?php 
        echo $updraftplus->plugin_title;
        ?>
</h1>

			<?php 
        _e('By UpdraftPlus.Com', 'updraftplus');
        ?>
 ( <a href="http://updraftplus.com">UpdraftPlus.Com</a> | <a href="http://updraftplus.com/news/"><?php 
        _e('News', 'updraftplus');
        ?>
</a> | <?php 
        if (!defined('UPDRAFTPLUS_NOADS')) {
            ?>
<a href="http://updraftplus.com/shop/"><?php 
            _e("Premium", 'updraftplus');
            ?>
</a>  | <?php 
        }
        ?>
<a href="http://david.dw-perspective.org.uk"><?php 
        _e("Lead developer's homepage", 'updraftplus');
        ?>
</a> | <?php 
        if (1 == 0 && !defined('UPDRAFTPLUS_NOADS')) {
            ?>
<a href="http://wordshell.net">WordShell - WordPress command line</a> | <a href="http://david.dw-perspective.org.uk/donate"><?php 
            _e('Donate', 'updraftplus');
            ?>
</a> | <?php 
        }
        ?>
<a href="http://updraftplus.com/support/frequently-asked-questions/">FAQs</a> | <a href="http://profiles.wordpress.org/davidanderson/"><?php 
        _e('Other WordPress plugins', 'updraftplus');
        ?>
</a>). <?php 
        _e('Version', 'updraftplus');
        ?>
: <?php 
        echo $updraftplus->version;
        ?>
			<br>
			<?php 
        if (isset($_GET['updraft_restore_success'])) {
            echo "<div class=\"updated fade\" style=\"padding:8px;\"><strong>" . __('Your backup has been restored.', 'updraftplus') . '</strong> ' . __('Your old (themes, uploads, plugins, whatever) directories have been retained with "-old" appended to their name. Remove them when you are satisfied that the backup worked properly.') . "</div>";
        }
        $ws_advert = $updraftplus->wordshell_random_advert(1);
        if ($ws_advert) {
            echo '<div class="updated fade" style="max-width: 800px; font-size:140%; line-height: 140%; padding:14px; clear:left;">' . $ws_advert . '</div>';
        }
        if ($deleted_old_dirs) {
            echo '<div style="color:blue" class=\\"updated fade\\">' . __('Old directories successfully deleted.', 'updraftplus') . '</div>';
        }
        if (!$updraftplus->memory_check(64)) {
            ?>
				<div style="color:orange"><?php 
            _e("Your PHP memory limit (set by your web hosting company) is quite low. UpdraftPlus attempted to raise it but was unsuccessful. This plugin may struggle with a memory limit of less than 64 Mb  - especially if you have very large files uploaded (though on the other hand, many sites will bhe  successful with a 32Mb limit - your experience may vary).", 'updraftplus');
            ?>
 <?php 
            _e('Current limit is:', 'updraftplus');
            ?>
 <?php 
            echo $updraftplus->memory_check_current();
            ?>
 Mb</div>
			<?php 
        }
        if (1 == 0 && !$this->execution_time_check(60)) {
            ?>
				<div style="color:orange"><?php 
            _e("Your PHP max_execution_time is less than 60 seconds. This possibly means you're running in safe_mode. Either disable safe_mode or modify your php.ini to set max_execution_time to a higher number. If you do not, then longer will be needed to complete a backup (but that is all). Present limit is:", 'updraftplus');
            ?>
 <?php 
            echo ini_get('max_execution_time') . ' ' . __('seconds', 'updraftplus');
            ?>
.</div>
			<?php 
        }
        if ($this->scan_old_dirs()) {
            ?>
				<div class="updated fade" style="padding:8px;"><?php 
            _e('You have old directories from a previous backup (technical information: these are suffixed with -old). Use this button to delete them (if you have verified that the restoration worked).', 'updraftplus');
            ?>
				<form method="post" action="<?php 
            echo remove_query_arg(array('updraft_restore_success', 'action'));
            ?>
">
					<?php 
            wp_nonce_field('updraft_delete_old_dirs');
            ?>
					<input type="hidden" name="action" value="updraft_delete_old_dirs" />
					<input type="submit" class="button-primary" value="<?php 
            _e('Delete Old Directories', 'updraftplus');
            ?>
" onclick="return(confirm('<?php 
            echo htmlspecialchars(__('Are you sure you want to delete the old directories? This cannot be undone.', 'updraftplus'));
            ?>
'))" />
				</form>
				</div>
			<?php 
        }
        if (!empty($updraftplus->errors)) {
            echo '<div class="error fade" style="padding:8px;">';
            foreach ($updraftplus->errors as $error) {
                echo '<div style="color:red">' . $error . '</div>';
            }
            echo '</div>';
        }
        ?>

			<h2 style="clear:left;"><?php 
        _e('Existing Schedule And Backups', 'updraftplus');
        ?>
</h2>
			<table class="form-table" style="float:left; clear: both; width:545px;">
				<noscript>
				<tr>
					<th><?php 
        _e('JavaScript warning', 'updraftplus');
        ?>
:</th>
					<td style="color:red"><?php 
        _e('This admin interface uses JavaScript heavily. You either need to activate it within your browser, or to use a JavaScript-capable browser.', 'updraftplus');
        ?>
</td>
				</tr>
				</noscript>
					<?php 
        $updraft_dir = $updraftplus->backups_dir_location();
        // UNIX timestamp
        $next_scheduled_backup = wp_next_scheduled('updraft_backup');
        if ($next_scheduled_backup) {
            // Convert to GMT
            $next_scheduled_backup_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup);
            // Convert to blog time zone
            $next_scheduled_backup = get_date_from_gmt($next_scheduled_backup_gmt, 'D, F j, Y H:i');
        } else {
            $next_scheduled_backup = __('Nothing currently scheduled', 'updraftplus');
        }
        $next_scheduled_backup_database = wp_next_scheduled('updraft_backup_database');
        if (UpdraftPlus_Options::get_updraft_option('updraft_interval_database', UpdraftPlus_Options::get_updraft_option('updraft_interval')) == UpdraftPlus_Options::get_updraft_option('updraft_interval')) {
            $next_scheduled_backup_database = 'Nothing currently scheduled' == $next_scheduled_backup ? $next_scheduled_backup : __("At the same time as the files backup", 'updraftplus');
        } else {
            if ($next_scheduled_backup_database) {
                // Convert to GMT
                $next_scheduled_backup_database_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup_database);
                // Convert to blog time zone
                $next_scheduled_backup_database = get_date_from_gmt($next_scheduled_backup_database_gmt, 'D, F j, Y H:i');
            } else {
                $next_scheduled_backup_database = __('Nothing currently scheduled', 'updraftplus');
            }
        }
        $current_time = get_date_from_gmt(gmdate('Y-m-d H:i:s'), 'D, F j, Y H:i');
        $backup_disabled = $updraftplus->really_is_writable($updraft_dir) ? '' : 'disabled="disabled"';
        $last_backup_html = $this->last_backup_html();
        ?>

				<tr>
					<th><span title="<?php 
        _e('All the times shown in this section are using WordPress\'s configured time zone, which you can set in Settings -> General', 'updraftplus');
        ?>
"><?php 
        _e('Next scheduled backups', 'updraftplus');
        ?>
:</span></th>
					<td>
						<div style="width: 76px; float:left;"><?php 
        _e('Files', 'updraftplus');
        ?>
:</div><div style="color:blue; float:left;"><?php 
        echo $next_scheduled_backup;
        ?>
</div>
						<div style="width: 76px; clear: left; float:left;"><?php 
        _e('Database', 'updraftplus');
        ?>
: </div><div style="color:blue; float:left;"><?php 
        echo $next_scheduled_backup_database;
        ?>
</div>
						<div style="width: 76px; clear: left; float:left;"><?php 
        _e('Time now', 'updraftplus');
        ?>
: </div><div style="color:blue; float:left;"><?php 
        echo $current_time;
        ?>
</div>
					</td>
				</tr>
				<tr>
					<th><?php 
        _e('Last backup job run:', 'updraftplus');
        ?>
</th>
					<td id="updraft_last_backup"><?php 
        echo $last_backup_html;
        ?>
</td>
				</tr>
			</table>
			<div style="float:left; width:200px; margin-top: <?php 
        echo class_exists('UpdraftPlus_Addons_Migrator') ? "20" : "0";
        ?>
px;">
				<div style="margin-bottom: 10px;">
					<button type="button" <?php 
        echo $backup_disabled;
        ?>
 class="button-primary" style="padding-top:2px;padding-bottom:2px;font-size:22px !important; min-height: 32px; min-width: 170px;" onclick="jQuery('#updraft-backupnow-modal').dialog('open');"><?php 
        _e('Backup Now', 'updraftplus');
        ?>
</button>
				</div>
				<div style="margin-bottom: 10px;">
					<?php 
        $backup_history = UpdraftPlus_Options::get_updraft_option('updraft_backup_history');
        $backup_history = is_array($backup_history) ? $backup_history : array();
        ?>
					<input type="button" class="button-primary" value="<?php 
        _e('Restore', 'updraftplus');
        ?>
" style="padding-top:2px;padding-bottom:2px;font-size:22px !important; min-height: 32px;  min-width: 170px;" onclick="jQuery('.download-backups').slideDown(); updraft_historytimertoggle(1); jQuery('html,body').animate({scrollTop: jQuery('#updraft_lastlogcontainer').offset().top},'slow');">
				</div>
				<div>
					<button type="button" class="button-primary" style="padding-top:2px;padding-bottom:2px;font-size:22px !important; min-height: 32px;  min-width: 170px;" onclick="jQuery('#updraft-migrate-modal').dialog('open');"><?php 
        _e('Clone/Migrate', 'updraftplus');
        ?>
</button>
				</div>
			</div>
			<br style="clear:both" />
			<table class="form-table">
				<tr id="updraft_lastlogmessagerow">
					<th><?php 
        _e('Last log message', 'updraftplus');
        ?>
:</th>
					<td>
						<span id="updraft_lastlogcontainer"><?php 
        echo htmlspecialchars(UpdraftPlus_Options::get_updraft_option('updraft_lastmessage', __('(Nothing yet logged)', 'updraftplus')));
        ?>
</span><br>
						<a href="?page=updraftplus&action=downloadlatestmodlog&wpnonce=<?php 
        echo wp_create_nonce('updraftplus_download');
        ?>
"><?php 
        _e('Download most recently modified log file', 'updraftplus');
        ?>
</a>
					</td>
				</tr>
				<tr>
					<th><?php 
        echo htmlspecialchars(__('Backups, logs & restoring', 'updraftplus'));
        ?>
:</th>
					<td><a id="updraft_showbackups" href="#" title="<?php 
        _e('Press to see available backups', 'updraftplus');
        ?>
" onclick="jQuery('.download-backups').fadeToggle(); updraft_historytimertoggle(0);"><?php 
        echo sprintf(__('%d set(s) available', 'updraftplus'), count($backup_history));
        ?>
</a></td>
				</tr>
				<?php 
        if (defined('UPDRAFTPLUS_EXPERIMENTAL_MISC') && UPDRAFTPLUS_EXPERIMENTAL_MISC == true) {
            ?>
				<tr>
					<th><?php 
            echo __('Latest UpdraftPlus.com news:', 'updraftplus');
            ?>
</th>
					<td>Blah blah blah. Move to right-hand col?</td>
				</tr>
				<?php 
        }
        ?>
			</table>
			<table class="form-table">
				<tr>
					<td style="">&nbsp;</td><td class="download-backups" style="display:none; border: 2px dashed #aaa;">
						<h2><?php 
        echo __('Downloading and restoring', 'updraftplus');
        ?>
</h2>
						<p style="display:none; background-color:pink; padding:8px; margin:4px;border: 1px dotted;" id="ud-whitespace-warning">
						 <?php 
        echo '<strong>' . __('Warning', 'updraftplus') . ':</strong> ' . __('Your WordPress installation has a problem with outputting extra whitespace. This can corrupt backups that you download from here.', 'updraftplus') . ' <a href="http://updraftplus.com/problems-with-extra-white-space/">' . __('Please consult this FAQ for help on what to do about it.', 'updraftplus') . '</a>';
        ?>
						</p>
						<p style="max-width: 740px;"><ul style="list-style: disc inside;">
						<li><strong><?php 
        _e('Downloading', 'updraftplus');
        ?>
:</strong> <?php 
        _e("Pressing a button for Database/Plugins/Themes/Uploads/Others will make UpdraftPlus try to bring the backup file back from the remote storage (if any - e.g. Amazon S3, Dropbox, Google Drive, FTP) to your webserver. Then you will be allowed to download it to your computer. If the fetch from the remote storage stops progressing (wait 30 seconds to make sure), then press again to resume. Remember that you can also visit the cloud storage vendor's website directly.", 'updraftplus');
        ?>
</li>
						<li><strong><?php 
        _e('Restoring', 'updraftplus');
        ?>
:</strong> <?php 
        _e("Press the button for the backup you wish to restore. If your site is large and you are using remote storage, then you should first click on each entity in order to retrieve it back to the webserver. This will prevent time-outs from occuring during the restore process itself.", 'updraftplus');
        ?>
 <?php 
        _e('More tasks:', 'updraftplus');
        ?>
 <a href="#" onclick="jQuery('#updraft-plupload-modal').slideToggle(); return false;"><?php 
        _e('upload backup files', 'updraftplus');
        ?>
</a> | <a href="#" onclick="updraft_updatehistory(1); return false;" title="<?php 
        _e('Press here to look inside your UpdraftPlus directory (in your web hosting space) for any new backup sets that you have uploaded. The location of this directory is set in the expert settings, below.', 'updraftplus');
        ?>
"><?php 
        _e('rescan folder for new backup sets', 'updraftplus');
        ?>
</a></li>
						<li><strong><?php 
        _e('Opera web browser', 'updraftplus');
        ?>
:</strong> <?php 
        _e('If you are using this, then turn Turbo/Road mode off.', 'updraftplus');
        ?>
</li>
						<?php 
        if (UpdraftPlus_Options::get_updraft_option('updraft_service') == 'googledrive') {
            ?>
<li><strong><?php 
            _e('Google Drive', 'updraftplus');
            ?>
:</strong> <?php 
            _e('Google changed their permissions setup recently (April 2013). To download or restore from Google Drive, you <strong>must</strong> first re-authenticate (using the link in the Google Drive configuration section).', 'updraftplus');
            ?>
</li>
						<?php 
        }
        ?>
						<li title="<?php 
        _e('This is a count of the contents of your Updraft directory', 'updraftplus');
        ?>
"><strong><?php 
        _e('Web-server disk space in use by UpdraftPlus', 'updraftplus');
        ?>
:</strong> <span id="updraft_diskspaceused"><em>(calculating...)</em></span> <a href="#" onclick="updraftplus_diskspace(); return false;"><?php 
        _e('refresh', 'updraftplus');
        ?>
</a></li></ul>

						<div id="updraft-plupload-modal" title="<?php 
        _e('UpdraftPlus - Upload backup files', 'updraftplus');
        ?>
" style="width: 75%; margin: 16px; display:none; margin-left: 100px;">
						<p style="max-width: 600px;"><em><?php 
        _e("Upload files into UpdraftPlus. Use this to import backups made on a different WordPress installation.", 'updraftplus');
        ?>
 <?php 
        echo htmlspecialchars(__('Or, you can place them manually into your UpdraftPlus directory (usually wp-content/updraft), e.g. via FTP, and then use the "rescan" link above.', 'updraftplus'));
        ?>
</em></p>
							<div id="plupload-upload-ui" style="width: 70%;">
								<div id="drag-drop-area">
									<div class="drag-drop-inside">
									<p class="drag-drop-info"><?php 
        _e('Drop backup zips here', 'updraftplus');
        ?>
</p>
									<p><?php 
        _ex('or', 'Uploader: Drop zip files here - or - Select Files');
        ?>
</p>
									<p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php 
        esc_attr_e('Select Files');
        ?>
" class="button" /></p>
									</div>
								</div>
								<div id="filelist">
								</div>
							</div>

						</div>

						<div id="ud_downloadstatus"></div>
						<script>
							function updraftplus_diskspace() {
								jQuery('#updraft_diskspaceused').html('<em><?php 
        _e('calculating...', 'updraftplus');
        ?>
</em>');
								jQuery.get(ajaxurl, { action: 'updraft_ajax', entity: 'updraft', subaction: 'diskspaceused', nonce: '<?php 
        echo wp_create_nonce('updraftplus-credentialtest-nonce');
        ?>
' }, function(response) {
									jQuery('#updraft_diskspaceused').html(response);
								});
							}
							var lastlog_lastmessage = "";
							function updraftplus_deletefromserver(timestamp, type) {
								var pdata = {
									action: 'updraft_download_backup',
									stage: 'delete',
									timestamp: timestamp,
									type: type,
									_wpnonce: '<?php 
        echo wp_create_nonce("updraftplus_download");
        ?>
'
								};
								jQuery.post(ajaxurl, pdata, function(response) {
									if (response == 'deleted') {
										
									} else {
										alert('We requested to delete the file, but could not understand the server\'s response '+response);
									}
								});
							}
							function updraftplus_downloadstage2(timestamp, type) {
								location.href=ajaxurl+'?_wpnonce=<?php 
        echo wp_create_nonce("updraftplus_download");
        ?>
&timestamp='+timestamp+'&type='+type+'&stage=2&action=updraft_download_backup';
							}
							function updraft_downloader(base, nonce, what, whicharea) {
								// Create somewhere for the status to be found
								var stid = base+nonce+'_'+what;
								if (!jQuery('#'+stid).length) {
									jQuery(whicharea).append('<div style="clear:left; border: 1px solid; padding: 8px; margin-top: 4px; max-width:840px;" id="'+stid+'"><button onclick="jQuery(\'#'+stid+'\').fadeOut().remove();" type="button" style="float:right; margin-bottom: 8px;">X</button><strong>Download '+what+' ('+nonce+')</strong>:<div class="raw"><?php 
        _e('Begun looking for this entity', 'updraftplus');
        ?>
</div><div class="file" id="'+stid+'_st"><div class="dlfileprogress" style="width: 0;"></div></div>');
									// <b><span class="dlname">??</span></b> (<span class="dlsofar">?? KB</span>/<span class="dlsize">??</span> KB)
									setTimeout(function(){updraft_downloader_status(base, nonce, what);}, 300);
								}
								// Now send the actual request to kick it all off
								jQuery.post(ajaxurl, jQuery('#uddownloadform_'+what+'_'+nonce).serialize());
								// We don't want the form to submit as that replaces the document
								return false;
							}
							function updraft_restorer_checkstage2(doalert) {
								// How many left?
								var stilldownloading = jQuery('#ud_downloadstatus2 .file').length;
								if (stilldownloading > 0) {
									if (doalert) { alert('<?php 
        echo esc_js(__('Some files are still downloading or being processed - please wait.', 'updraftplus'));
        ?>
'); }
									return;
								}
								// Allow pressing 'Restore' to proceed
								jQuery('#updraft-restore-modal-stage2a').html('<?php 
        echo esc_js(__('Processing files - please wait...', 'updraftplus'));
        ?>
');
								jQuery.get(ajaxurl, {
									action: 'updraft_ajax',
									subaction: 'restore_alldownloaded', 
									nonce: '<?php 
        echo wp_create_nonce('updraftplus-credentialtest-nonce');
        ?>
',
									timestamp: jQuery('#updraft_restore_timestamp').val(),
									restoreopts: jQuery('#updraft_restore_form').serialize()
								}, function(data) {
									updraft_restore_stage = 3;
									jQuery('#updraft-restore-modal-stage2a').html(data);
								});
							}
							var dlstatus_sdata = {
								action: 'updraft_ajax',
								subaction: 'downloadstatus',
								nonce: '<?php 
        echo wp_create_nonce('updraftplus-credentialtest-nonce');
        ?>
'
							};
							dlstatus_lastlog = '';
							function updraft_downloader_status(base, nonce, what) {
								// Get the DOM id of the status div (add _st for the id of the file itself)
								var stid = base+nonce+'_'+what;
								if (jQuery('#'+stid).length) {
// 									console.log(stid+": "+jQuery('#'+stid).length);
									dlstatus_sdata.timestamp = nonce;
									dlstatus_sdata.type = what;
									jQuery.get(ajaxurl, dlstatus_sdata, function(response) {
										nexttimer = 1250;
										if (dlstatus_lastlog == response) { nexttimer = 3000; }
										try {
											var resp = jQuery.parseJSON(response);
											var cancel_repeat = 0;
											if (resp.e != null) {
												jQuery('#'+stid+' .raw').html('<strong><?php 
        _e('Error:', 'updraftplus');
        ?>
</strong> '+resp.e);
												console.log(resp);
											} else if (resp.p != null) {
												jQuery('#'+stid+'_st .dlfileprogress').width(resp.p+'%');
												//jQuery('#'+stid+'_st .dlsofar').html(Math.round(resp.s/1024));
												//jQuery('#'+stid+'_st .dlsize').html(Math.round(resp.t/1024));
												if (resp.m != null) {
													if (resp.p >=100 && base == 'udrestoredlstatus_') {
														jQuery('#'+stid+' .raw').html(resp.m);
														jQuery('#'+stid).fadeOut('slow', function() { jQuery(this).remove(); updraft_restorer_checkstage2(0);});
													} else if (resp.p < 100 || base != 'uddlstatus_') {
														jQuery('#'+stid+' .raw').html(resp.m);
													} else {
														jQuery('#'+stid+' .raw').html('<?php 
        _e('File ready.', 'updraftplus');
        ?>
 <?php 
        _e('You should:', 'updraftplus');
        ?>
 <button type="button" onclick="updraftplus_downloadstage2(\''+nonce+'\', \''+what+'\')\">Download to your computer</button> and then, if you wish, <button id="uddownloaddelete_'+nonce+'_'+what+'" type="button" onclick="updraftplus_deletefromserver(\''+nonce+'\', \''+what+'\')\">Delete from your web server</button>');
													}
												}
												dlstatus_lastlog = response;
											} else if (resp.m != null) {
													jQuery('#'+stid+' .raw').html(resp.m);
											} else {
												alert('<?php 
        _e('Download error: the server sent us a response (JSON) which we did not understand', 'updraftplus');
        ?>
 ('+response+')');
												cancel_repeat = 1;
											}
											if (cancel_repeat == 0) { setTimeout(function(){updraft_downloader_status(base, nonce, what)}, nexttimer); }
										} catch(err) {
											alert('<?php 
        _e('Download error: the server sent us a response which we did not understand.', 'updraftplus');
        ?>
 <?php 
        _e("Error:", 'updraftplus');
        ?>
 '+err);
										}
									});
								}
							}
						</script>
						<div id="updraft_existing_backups" style="margin-bottom:12px;">
							<?php 
        print $this->existing_backup_table($backup_history);
        ?>
						</div>
					</td>
				</tr>
			</table>

<div id="updraft-delete-modal" title="<?php 
        _e('Delete backup set', 'updraftplus');
        ?>
">
<form id="updraft_delete_form" method="post">
	<p style="margin-top:3px; padding-top:0">
		<?php 
        _e('Are you sure that you wish to delete this backup set?', 'updraftplus');
        ?>
	</p>
	<fieldset>
		<input type="hidden" name="nonce" value="<?php 
        echo wp_create_nonce('updraftplus-credentialtest-nonce');
        ?>
">
		<input type="hidden" name="action" value="updraft_ajax">
		<input type="hidden" name="subaction" value="deleteset">
		<input type="hidden" name="backup_timestamp" value="0" id="updraft_delete_timestamp">
		<input type="hidden" name="backup_nonce" value="0" id="updraft_delete_nonce">
		<div id="updraft-delete-remote-section"><input checked="checked" type="checkbox" name="delete_remote" id="updraft_delete_remote" value="1"> <label for="updraft_delete_remote"><?php 
        _e('Also delete from remote storage', 'updraftplus');
        ?>
</label><br>
		<p id="updraft-delete-waitwarning" style="display:none;"><em><?php 
        _e('Deleting... please allow time for the communications with the remote storage to complete.', 'updraftplus');
        ?>
</em></p>
		</div>
	</fieldset>
</form>
</div>

<div id="updraft-hidethis">
<p><strong><?php 
        _e('Warning:', 'updraftplus');
        ?>
 <?php 
        _e("If you can still read these words after the page finishes loading, then there is a JavaScript or jQuery problem in your web browser.", 'updraftplus');
        ?>
 <a href="http://updraftplus.com/do-you-have-a-javascript-or-jquery-error/"><?php 
        _e('Go here for more information.', 'updraftplus');
        ?>
</a></strong></p>
</p>
</div>
<script>
jQuery(document).ready(function() {
	jQuery.get(ajaxurl, { action: 'updraft_ajax', subaction: 'ping', nonce: '<?php 
        echo wp_create_nonce('updraftplus-credentialtest-nonce');
        ?>
' }, function(data, response) {
		if ('success' == response && data != 'pong' && data.indexOf('pong')>=0) {
			jQuery('#ud-whitespace-warning').show();
		}
	});
	jQuery('#updraft-hidethis').remove();
});
</script>

<div id="updraft-restore-modal" title="UpdraftPlus - <?php 
        _e('Restore backup', 'updraftplus');
        ?>
">
<p><strong><?php 
        _e('Restore backup from', 'updraftplus');
        ?>
:</strong> <span class="updraft_restore_date"></span></p>

<div id="updraft-restore-modal-stage2">

	<p><strong><?php 
        _e('Downloading / preparing backup files...', 'updraftplus');
        ?>
</strong></p>
	<div id="ud_downloadstatus2"></div>

	<div id="updraft-restore-modal-stage2a"></div>

</div>

<div id="updraft-restore-modal-stage1">
<p><?php 
        _e("Restoring will replace this site's themes, plugins, uploads, database and/or other content directories (according to what is contained in the backup set, and your selection).", 'updraftplus');
        ?>
 <?php 
        _e('Choose the components to restore', 'updraftplus');
        ?>
:</p>
<form id="updraft_restore_form" method="post">
	<fieldset>
		<input type="hidden" name="action" value="updraft_restore">
		<input type="hidden" name="backup_timestamp" value="0" id="updraft_restore_timestamp">
		<?php 
        # The 'off' check is for badly configured setups - http://wordpress.org/support/topic/plugin-wp-super-cache-warning-php-safe-mode-enabled-but-safe-mode-is-off
        if ($updraftplus->detect_safe_mode()) {
            echo "<p><em>" . __('Your web server has PHP\'s so-called safe_mode active.', 'updraftplus') . ' ' . __('This makes time-outs much more likely. You are recommended to turn safe_mode off, or to restore only one entity at a time, <a href="http://updraftplus.com/faqs/i-want-to-restore-but-have-either-cannot-or-have-failed-to-do-so-from-the-wp-admin-console/">or to restore manually</a>.', 'updraftplus') . "</em></p><br/>";
        }
        $backupable_entities = $updraftplus->get_backupable_file_entities(true, true);
        foreach ($backupable_entities as $type => $info) {
            if (!isset($info['restorable']) || $info['restorable'] == true) {
                echo '<div><input id="updraft_restore_' . $type . '" type="checkbox" name="updraft_restore[]" value="' . $type . '"> <label for="updraft_restore_' . $type . '">' . $info['description'] . '</label><br>';
                do_action("updraftplus_restore_form_{$type}");
                echo '</div>';
            } else {
                $sdescrip = isset($info['shortdescription']) ? $info['shortdescription'] : $info['description'];
                echo "<div style=\"margin: 8px 0;\"><em>" . htmlspecialchars(sprintf(__('The following entity cannot be restored automatically: "%s".', 'updraftplus'), $sdescrip)) . " " . __('You will need to restore it manually.', 'updraftplus') . "</em><br>" . '<input id="updraft_restore_' . $type . '" type="hidden" name="updraft_restore[]" value="' . $type . '"></div>';
            }
        }
        ?>
		<div><input id="updraft_restore_db" type="checkbox" name="updraft_restore[]" value="db"> <label for="updraft_restore_db"><?php 
        _e('Database', 'updraftplus');
        ?>
</label><br>


			<div id="updraft_restorer_dboptions" style="display:none; padding:12px; margin: 8px 0 4px; border: dashed 1px;"><h4 style="margin: 0px 0px 6px; padding:0px;"><?php 
        echo sprintf(__('%s restoration options:', 'updraftplus'), __('Database', 'updraftplus'));
        ?>
</h4>

			<?php 
        do_action("updraftplus_restore_form_db");
        if (!class_exists('UpdraftPlus_Addons_Migrator')) {
            echo '<a href="http://updraftplus.com/faqs/tell-me-more-about-the-search-and-replace-site-location-in-the-database-option/">' . __('You can search and replace your database (for migrating a website to a new location/URL) with the Migrator add-on - follow this link for more information', 'updraftplus') . '</a>';
        }
        ?>

			<script>
				jQuery('#updraft_restore_db').change(function(){
					if (jQuery('#updraft_restore_db').is(':checked')) {
						jQuery('#updraft_restorer_dboptions').slideDown();
					} else {
						jQuery('#updraft_restorer_dboptions').slideUp();
					}
				});
			</script>

			</div>

		</div>
	</fieldset>
</form>
<p><em><a href="http://updraftplus.com/faqs/what-should-i-understand-before-undertaking-a-restoration/" target="_new"><?php 
        _e('Do read this helpful article of useful things to know before restoring.', 'updraftplus');
        ?>
</a></em></p>
</div>

</div>

<div id="updraft-migrate-modal" title="<?php 
        _e('Migrate Site', 'updraftplus');
        ?>
">

<?php 
        if (class_exists('UpdraftPlus_Addons_Migrator')) {
            echo '<p>' . str_replace('"', "&quot;", __('Migration of data from another site happens through the "Restore" button. A "migration" is ultimately the same as a restoration - but using backup archives that you import from another site. UpdraftPlus modifies the restoration operation appropriately, to fit the backup data to the new site.', 'updraftplus')) . ' ' . sprintf(__('<a href="%s">Read this article to see step-by-step how it\'s done.</a>', 'updraftplus'), 'http://updraftplus.com/faqs/how-do-i-migrate-to-a-new-site-location/');
        } else {
            echo '<p>' . __('Do you want to migrate or clone/duplicate a site?', 'updraftplus') . '</p><p>' . __('Then, try out our "Migrator" add-on. After using it once, you\'ll have saved the purchase price compared to the time needed to copy a site by hand.', 'updraftplus') . '</p><p><a href="http://updraftplus.com/shop/migrator/">' . __('Get it here.', 'updraftplus') . '</a>';
        }
        ?>
</p>
</div>

<div id="updraft-iframe-modal">
	<div id="updraft-iframe-modal-innards">
	</div>
</div>

<div id="updraft-backupnow-modal" title="UpdraftPlus - <?php 
        _e('Perform a one-time backup', 'updraftplus');
        ?>
">
	<p><?php 
        _e("To proceed, press 'Backup Now'. Then, watch the 'Last Log Message' field for activity after about 10 seconds. WordPress should start the backup running in the background.", 'updraftplus');
        ?>
</p>

	<p><?php 
        _e('Does nothing happen when you schedule backups?', 'updraftplus');
        ?>
 <a href="http://updraftplus.com/faqs/my-scheduled-backups-and-pressing-backup-now-does-nothing-however-pressing-debug-backup-does-produce-a-backup/"><?php 
        _e('Go here for help.', 'updraft');
        ?>
</a></p>
</div>

			<?php 
        if (is_multisite() && !file_exists(UPDRAFTPLUS_DIR . '/addons/multisite.php')) {
            ?>
				<h2>UpdraftPlus <?php 
            _e('Multisite', 'updraftplus');
            ?>
</h2>
				<table>
				<tr>
				<td>
				<p style="max-width:800px;"><?php 
            echo __('Do you need WordPress Multisite support?', 'updraftplus') . ' <a href="http://updraftplus.com/">' . __('Please check out UpdraftPlus Premium, or the stand-alone Multisite add-on.', 'updraftplus');
            ?>
</a>.</p>
				</td>
				</tr>
				</table>
			<?php 
        }
        ?>
			<h2 style="margin-top: 6px;"><?php 
        _e('Configure Backup Contents And Schedule', 'updraftplus');
        ?>
</h2>
			<?php 
        UpdraftPlus_Options::options_form_begin();
        ?>
				<?php 
        $this->settings_formcontents($last_backup_html);
        ?>
			</form>
			<div style="padding-top: 40px; display:none;" class="expertmode">
				<hr>
				<h2><?php 
        _e('Debug Information And Expert Options', 'updraftplus');
        ?>
</h2>
				<p>
				<?php 
        echo sprintf(__('Web server:', 'updraftplus'), 'PHP') . ' ' . htmlspecialchars($_SERVER["SERVER_SOFTWARE"]) . ' (' . htmlspecialchars(php_uname()) . ')<br />';
        $peak_memory_usage = memory_get_peak_usage(true) / 1024 / 1024;
        $memory_usage = memory_get_usage(true) / 1024 / 1024;
        echo __('Peak memory usage', 'updraftplus') . ': ' . $peak_memory_usage . ' MB<br/>';
        echo __('Current memory usage', 'updraftplus') . ': ' . $memory_usage . ' MB<br/>';
        echo __('PHP memory limit', 'updraftplus') . ': ' . ini_get('memory_limit') . ' <br/>';
        echo sprintf(__('%s version:', 'updraftplus'), 'PHP') . ' ' . phpversion() . ' - ';
        echo '<a href="admin-ajax.php?page=updraftplus&action=updraft_ajax&subaction=phpinfo&nonce=' . wp_create_nonce('updraftplus-credentialtest-nonce') . '" id="updraftplus-phpinfo">' . __('show PHP information (phpinfo)', 'updraftplus') . '</a><br/>';
        echo sprintf(__('%s version:', 'updraftplus'), 'MySQL') . ' ' . (function_exists('mysql_get_server_info') ? mysql_get_server_info() : '?') . '<br>';
        if (version_compare(phpversion(), '5.2.0', '>=') && extension_loaded('zip')) {
            $ziparchive_exists .= __('Yes', 'updraftplus');
        } else {
            $ziparchive_exists .= method_exists('ZipArchive', 'addFile') ? __('Yes', 'updraftplus') : __('No', 'updraftplus');
        }
        echo __('PHP has support for ZipArchive::addFile:', 'updraftplus') . ' ' . $ziparchive_exists . '<br>';
        $binzip = $updraftplus->find_working_bin_zip(false);
        echo __('zip executable found:', 'updraftplus') . ' ' . (is_string($binzip) ? __('Yes') . ': ' . $binzip : __('No')) . '<br>';
        echo '<a href="admin-ajax.php?page=updraftplus&action=updraft_ajax&subaction=backuphistoryraw&nonce=' . wp_create_nonce('updraftplus-credentialtest-nonce') . '" id="updraftplus-rawbackuphistory">' . __('Show raw backup and file list', 'updraftplus') . '</a><br/>';
        echo '<h3>' . __('Total (uncompressed) on-disk data:', 'updraftplus') . '</h3>';
        echo '<p style="clear: left; max-width: 600px;"><em>' . __('N.B. This count is based upon what was, or was not, excluded the last time you saved the options.', 'updraftplus') . '</em></p>';
        foreach ($backupable_entities as $key => $info) {
            $sdescrip = preg_replace('/ \\(.*\\)$/', '', $info['description']);
            if (strlen($sdescrip) > 20 && isset($info['shortdescription'])) {
                $sdescrip = $info['shortdescription'];
            }
            echo '<div style="clear: left;float:left; width:150px;">' . ucfirst($sdescrip) . ':</strong></div><div style="float:left;"><span id="updraft_diskspaceused_' . $key . '"><em></em></span> <a href="#" onclick="updraftplus_diskspace_entity(\'' . $key . '\'); return false;">' . __('count', 'updraftplus') . '</a></div>';
        }
        ?>

				</p>
				<p style="clear: left; padding-top: 20px; max-width: 600px; margin:0;"><?php 
        _e('The buttons below will immediately execute a backup run, independently of WordPress\'s scheduler. If these work whilst your scheduled backups and the "Backup Now" button do absolutely nothing (i.e. not even produce a log file), then it means that your scheduler is broken. You should then disable all your other plugins, and try the "Backup Now" button. If that fails, then contact your web hosting company and ask them if they have disabled wp-cron. If it succeeds, then re-activate your other plugins one-by-one, and find the one that is the problem and report a bug to them.', 'updraftplus');
        ?>
</p>

				<table border="0" style="border: none;">
				<tbody>
				<tr>
				<td>
				<form method="post">
					<input type="hidden" name="action" value="updraft_backup_debug_all" />
					<p><input type="submit" class="button-primary" <?php 
        echo $backup_disabled;
        ?>
 value="<?php 
        _e('Debug Full Backup', 'updraftplus');
        ?>
" onclick="return(confirm('<?php 
        echo htmlspecialchars(__('This will cause an immediate backup. The page will stall loading until it finishes (ie, unscheduled).', 'updraftplus'));
        ?>
'))" /></p>
				</form>
				</td><td>
				<form method="post">
					<input type="hidden" name="action" value="updraft_backup_debug_db" />
					<p><input type="submit" class="button-primary" <?php 
        echo $backup_disabled;
        ?>
 value="<?php 
        _e('Debug Database Backup', 'updraftplus');
        ?>
" onclick="return(confirm('<?php 
        echo htmlspecialchars(__('This will cause an immediate DB backup. The page will stall loading until it finishes (ie, unscheduled). The backup may well run out of time; really this button is only helpful for checking that the backup is able to get through the initial stages, or for small WordPress sites..', 'updraftplus'));
        ?>
'))" /></p>
				</form>
				</td>
				</tr>
				</tbody>
				</table>
				<h3><?php 
        _e('Wipe Settings', 'updraftplus');
        ?>
</h3>
				<p style="max-width: 600px;"><?php 
        _e('This button will delete all UpdraftPlus settings (but not any of your existing backups from your cloud storage). You will then need to enter all your settings again. You can also do this before deactivating/deinstalling UpdraftPlus if you wish.', 'updraftplus');
        ?>
</p>
				<form method="post">
					<input type="hidden" name="action" value="updraft_wipesettings" />
					<p><input type="submit" class="button-primary" value="<?php 
        _e('Wipe All Settings', 'updraftplus');
        ?>
" onclick="return(confirm('<?php 
        echo htmlspecialchars(__('This will delete all your UpdraftPlus settings - are you sure you want to do this?'));
        ?>
'))" /></p>
				</form>
				<h3><?php 
        _e('Active jobs', 'updraftplus');
        ?>
</h3>
				<div id="updraft_activejobs">
				<?php 
        $this->print_active_jobs();
        ?>
				</div>
			</div>

			<script type="text/javascript">
			/* <![CDATA[ */
				
				function updraft_activejobs_delete(jobid) {
					jQuery.get(ajaxurl, { action: 'updraft_ajax', subaction: 'activejobs_delete', jobid: jobid, nonce: '<?php 
        echo wp_create_nonce('updraftplus-credentialtest-nonce');
        ?>
' }, function(response) {
						if (response.substr(0,2) == 'Y:') {
							jQuery('#updraft-jobid-'+jobid).html(response.substr(2)).fadeOut('slow').remove();
						} else if (response.substr(0,2) == 'X:') {
							alert(response.substr(2));
						} else {
							alert('<?php 
        _e('Unknown response:', 'updraftplus');
        ?>
 '+response);
						}
					});
				}

				function updraft_activejobs_update() {
					jQuery.get(ajaxurl, { action: 'updraft_ajax', subaction: 'activejobs_list', nonce: '<?php 
        echo wp_create_nonce('updraftplus-credentialtest-nonce');
        ?>
' }, function(response) {
						jQuery('#updraft_activejobs').html(response);
					});
				}

				function updraftplus_diskspace_entity(key) {
					jQuery('#updraft_diskspaceused_'+key).html('<em><?php 
        _e('calculating...', 'updraftplus');
        ?>
</em>');
					jQuery.get(ajaxurl, { action: 'updraft_ajax', subaction: 'diskspaceused', entity: key, nonce: '<?php 
        echo wp_create_nonce('updraftplus-credentialtest-nonce');
        ?>
' }, function(response) {
						jQuery('#updraft_diskspaceused_'+key).html(response);
					});
				}

				function updraft_iframe_modal(getwhat, title) {
					jQuery('#updraft-iframe-modal-innards').html('<iframe width="100%" height="440px" src="'+ajaxurl+'?action=updraft_ajax&subaction='+getwhat+'&nonce=<?php 
        echo wp_create_nonce('updraftplus-credentialtest-nonce');
        ?>
"></iframe>');
					jQuery('#updraft-iframe-modal').dialog('option', 'title', title).dialog('open');
				}

				jQuery(document).ready(function() {

					jQuery('#updraft-service').change(function() {
						jQuery('.updraftplusmethod').hide();
						var active_class = jQuery(this).val();
						jQuery('.'+active_class).show();
					});

				jQuery('#updraftplus-phpinfo').click(function(e) {
					e.preventDefault();
					updraft_iframe_modal('phpinfo', '<?php 
        _e('PHP information', 'updraftplus');
        ?>
');
				});

				jQuery('#updraftplus-rawbackuphistory').click(function(e) {
					e.preventDefault();
					updraft_iframe_modal('rawbackuphistory', '<?php 
        _e('Raw backup history', 'updraftplus');
        ?>
');
				});

				})
				jQuery(window).load(function() {
					//this is for hiding the restore progress at the top after it is done
					setTimeout('jQuery("#updraft-restore-progress").toggle(1000);',3000)
					jQuery('#updraft-restore-progress-toggle').click(function() {
						jQuery('#updraft-restore-progress').toggle(500)
					})
				})
			/* ]]> */
			</script>
			<?php 
    }