| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) die('No direct access allowed'); |
| 3 |
|
| 4 |
?> |
| 5 |
<div class="wpo_shade hidden"> |
| 6 |
<div class="wpo_shade_inner"> |
| 7 |
<span class="dashicons dashicons-update-alt wpo-rotate"></span> |
| 8 |
<h4><?php esc_html_e('Loading data...', 'wp-optimize'); ?></h4> |
| 9 |
</div> |
| 10 |
</div> |
| 11 |
|
| 12 |
<div class="wpo_section wpo_group"> |
| 13 |
|
| 14 |
<?php |
| 15 |
if (!empty($optimization_results)) { |
| 16 |
echo '<div id="message" class="updated below-h2"><strong>'; |
| 17 |
foreach ($optimization_results as $optimization_result) { |
| 18 |
if (!empty($optimization_result->output)) { |
| 19 |
foreach ($optimization_result->output as $line) { |
| 20 |
echo wp_kses_post($line)."<br>"; |
| 21 |
} |
| 22 |
} |
| 23 |
} |
| 24 |
echo '</strong></div>'; |
| 25 |
} |
| 26 |
?> |
| 27 |
|
| 28 |
<?php WP_Optimize()->include_template('database/status-box-contents.php', false, $status_data); ?> |
| 29 |
<?php |
| 30 |
$message = __('Warning: This operation is permanent.', 'wp-optimize'); |
| 31 |
$message .= ' '; |
| 32 |
$message .= __('Continue?', 'wp-optimize'); |
| 33 |
?> |
| 34 |
<form onsubmit="return confirm('<?php echo esc_js($message); ?>')" action="#" method="post" enctype="multipart/form-data" name="optimize_form" id="optimize_form"> |
| 35 |
|
| 36 |
<?php wp_nonce_field('wpo_optimization'); ?> |
| 37 |
|
| 38 |
<h3><?php esc_html_e('Optimizations', 'wp-optimize'); ?></h3> |
| 39 |
|
| 40 |
<div class="wpo-run-optimizations__container"> |
| 41 |
<?php if ($should_show_load_in_batches_button) : ?> |
| 42 |
<button type="button" id="wpo-load-tables-in-batches" class="button button-primary button-large"><?php echo esc_html__('Reload database tables in batches', 'wp-optimize'); ?></button> |
| 43 |
<?php endif; ?> |
| 44 |
<?php $button_caption = apply_filters('wpo_run_button_caption', __('Run all selected optimizations', 'wp-optimize')); ?> |
| 45 |
<input class="button button-primary button-large" type="submit" id="wp-optimize" name="wp-optimize" value="<?php echo esc_attr($button_caption); ?>"><?php WP_Optimize()->include_template('take-a-backup.php', false, array('checkbox_name' => 'enable-auto-backup')); ?> |
| 46 |
</div> |
| 47 |
|
| 48 |
<?php do_action('wpo_additional_options'); ?> |
| 49 |
|
| 50 |
<?php |
| 51 |
if ($load_data) { |
| 52 |
WP_Optimize()->include_template('database/optimizations-table.php', false, $optimizations_table_data); |
| 53 |
} else { |
| 54 |
?> |
| 55 |
<div class="wp-optimize-optimizations-table-placeholder"> |
| 56 |
</div> |
| 57 |
<?php } ?> |
| 58 |
|
| 59 |
<p class="wp-optimize-sensitive-tables-warning"> |
| 60 |
<span style="color: #E07575;"> |
| 61 |
<span class="dashicons dashicons-warning"></span> |
| 62 |
<?php esc_html_e('Warning:', 'wp-optimize'); ?> |
| 63 |
</span> |
| 64 |
<?php |
| 65 |
$message = __('Items marked with this icon perform more intensive database operations.', 'wp-optimize'); |
| 66 |
$message .= ' '; |
| 67 |
$message .= __('In very rare cases, if your database server happened to crash or be forcibly powered down at the same time as an optimization operation was running, data might be corrupted.', 'wp-optimize'); |
| 68 |
$message .= ' '; |
| 69 |
$message .= __('You may wish to run a backup before optimizing.', 'wp-optimize'); |
| 70 |
echo esc_html($message); |
| 71 |
?> |
| 72 |
</p> |
| 73 |
</form> |
| 74 |
</div> |
| 75 |
<?php if ($should_show_load_in_batches_button) : ?> |
| 76 |
<?php |
| 77 |
// Determine scan offset |
| 78 |
$scan_job_offset = ($total_table_count === $done_table_count) ? 0 : $done_table_count; |
| 79 |
|
| 80 |
// Escape values once for reuse |
| 81 |
$total_table_count_esc = esc_html($total_table_count); |
| 82 |
$scan_job_offset_esc = esc_js($scan_job_offset); |
| 83 |
?> |
| 84 |
<div id="wpo-too-many-tables-popup" class="wpo-modal--container wpo-too-many-tables" style="display:none;"> |
| 85 |
<div class="wpo-modal--bg"></div> |
| 86 |
<div class="wpo-modal" style="text-align:center; max-width:600px;"> |
| 87 |
<button type="button" class="wpo-modal--close wpo-too-many-tables-close"> |
| 88 |
<span class="dashicons dashicons-no"></span> |
| 89 |
<span class="screen-reader-text"><?php esc_html_e('Close', 'wp-optimize'); ?></span> |
| 90 |
</button> |
| 91 |
<div class="wpo-modal--content"> |
| 92 |
<p> |
| 93 |
<?php |
| 94 |
printf( |
| 95 |
/* translators: %s = total number of tables */ |
| 96 |
esc_html__( |
| 97 |
'You have a total of %s tables which will take some time to load.', |
| 98 |
'wp-optimize' |
| 99 |
) . ' ' . esc_html__( |
| 100 |
'Click the button below and please wait while it loads all the tables.', |
| 101 |
'wp-optimize' |
| 102 |
), |
| 103 |
$total_table_count_esc // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output already escaped |
| 104 |
); |
| 105 |
?> |
| 106 |
</p> |
| 107 |
<p> |
| 108 |
<button id="wpo-load-tables-in-batches-button" class="button button-primary button-large"> |
| 109 |
<?php |
| 110 |
echo (0 === $scan_job_offset) ? esc_html__('Load Tables', 'wp-optimize') : esc_html__('Continue Loading Tables', 'wp-optimize'); |
| 111 |
?> |
| 112 |
</button> |
| 113 |
</p> |
| 114 |
<div id="wpo-load-tables-in-batches-progress"></div> |
| 115 |
<div id="wpo-load-tables-eta"></div> |
| 116 |
</div> |
| 117 |
</div> |
| 118 |
</div> |
| 119 |
<script> |
| 120 |
var wpo_table_scan_offset = <?php echo $scan_job_offset_esc; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output already escaped ?>; |
| 121 |
</script> |
| 122 |
<?php endif; ?> |
| 123 |
<script> |
| 124 |
var wpo_too_many_tables = <?php echo $too_many_tables ? 'true' : 'false'; ?>; |
| 125 |
var wpo_onboarding_active = <?php echo $onboarding_active ? 'true' : 'false'; ?>; |
| 126 |
</script> |