PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.7.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.7.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
← All changes | templates/database/optimize-table.php +80 -11 3.2.5 → 4.7.0 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 -if (!defined('WPO_VERSION')) die('No direct access allowed');
2 +if (!defined('ABSPATH')) die('No direct access allowed');
3 3
4 4 ?>
5 5 <div class="wpo_shade hidden">
6 6 <div class="wpo_shade_inner">
7 7 <span class="dashicons dashicons-update-alt wpo-rotate"></span>
8 - <h4><?php _e('Loading data...', 'wp-optimize'); ?></h4>
8 + <h4><?php esc_html_e('Loading data...', 'wp-optimize'); ?></h4>
9 9 </div>
10 10 </div>
11 11
12 12 <div class="wpo_section wpo_group">
@@ -16,9 +16,9 @@
16 16 echo '<div id="message" class="updated below-h2"><strong>';
17 17 foreach ($optimization_results as $optimization_result) {
18 18 if (!empty($optimization_result->output)) {
19 19 foreach ($optimization_result->output as $line) {
20 - echo $line."<br>";
20 + echo wp_kses_post($line)."<br>";
21 21 }
22 22 }
23 23 }
24 24 echo '</strong></div>';
@@ -24,20 +24,26 @@
24 24 echo '</strong></div>';
25 25 }
26 26 ?>
27 27
28 - <?php WP_Optimize()->include_template('database/status-box-contents.php', false, array('optimize_db' => false)); ?>
29 -
30 - <form onsubmit="return confirm('<?php echo esc_js(__('Warning: This operation is permanent. Continue?', 'wp-optimize')); ?>')" action="#" method="post" enctype="multipart/form-data" name="optimize_form" id="optimize_form">
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">
31 35
32 36 <?php wp_nonce_field('wpo_optimization'); ?>
33 37
34 - <h3><?php _e('Optimizations', 'wp-optimize'); ?></h3>
38 + <h3><?php esc_html_e('Optimizations', 'wp-optimize'); ?></h3>
35 39
36 -
37 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; ?>
38 44 <?php $button_caption = apply_filters('wpo_run_button_caption', __('Run all selected optimizations', 'wp-optimize')); ?>
39 - <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')); ?>
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')); ?>
40 46 </div>
41 47
42 48 <?php do_action('wpo_additional_options'); ?>
43 49
@@ -42,9 +48,9 @@
42 48 <?php do_action('wpo_additional_options'); ?>
43 49
44 50 <?php
45 51 if ($load_data) {
46 - WP_Optimize()->include_template('database/optimizations-table.php', false, array('does_server_allows_table_optimization' => $does_server_allows_table_optimization));
52 + WP_Optimize()->include_template('database/optimizations-table.php', false, $optimizations_table_data);
47 53 } else {
48 54 ?>
49 55 <div class="wp-optimize-optimizations-table-placeholder">
50 56 </div>
@@ -50,8 +56,71 @@
50 56 </div>
51 57 <?php } ?>
52 58
53 59 <p class="wp-optimize-sensitive-tables-warning">
54 - <span style="color: #E07575;"><span class="dashicons dashicons-warning"></span> <?php echo __('Warning:', 'wp-optimize').'</span> '.__('Items marked with this icon perform more intensive database operations. 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').' '.__('You may wish to run a backup before optimizing.', 'wp-optimize'); ?>
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 + ?>
55 72 </p>
56 73 </form>
57 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>