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/tables-body.php +67 -87 3.2.7 → 4.7.0 View file →
@@ -1,58 +1,50 @@
1 -<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
1 +<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?>
2 2
3 3 <tbody id="the-list">
4 4 <?php
5 -
6 - // Check for InnoDB tables.
7 - // Check for windows servers.
8 - $sqlversion = $wp_optimize->get_db_info()->get_version();
9 - $tablesstatus = $wp_optimize->get_optimizer()->get_tables();
10 - $is_multisite_mode = $wp_optimize->is_multisite_mode();
11 - $total_gain = 0;
12 - $no = 0;
13 - $row_usage = 0;
14 - $data_usage = 0;
15 - $index_usage = 0;
16 - $overhead_usage = 0;
17 - $non_inno_db_tables = 0;
18 - $inno_db_tables = 0;
19 - $small_overhead_size = 1048576;
20 5
21 - foreach ($tablesstatus as $tablestatus) {
22 - $no++;
23 - echo '<tr
24 - data-tablename="'.esc_attr($tablestatus->Name).'"
25 - data-type="'.esc_attr($tablestatus->Engine).'"
26 - data-optimizable="'.($tablestatus->is_optimizable ? 1 : 0).'"
27 - '.($is_multisite_mode ? 'data-blog_id="'.($tablestatus->blog_id).'"' : '').'
28 - >'."\n";
29 - echo '<td data-colname="'.__('No.', 'wp-optimize').'">'.number_format_i18n($no).'</td>'."\n";
30 - echo '<td data-tablename="'.esc_attr($tablestatus->Name).'" data-colname="'.__('Table', 'wp-optimize').'">'.htmlspecialchars($tablestatus->Name);
6 + $row_number = 0;
7 + foreach ($table_list_object_format as $tablestatus) {
8 + $row_number++;
9 + printf('<tr data-tablename="%1$s" data-type="%2$s" data-optimizable="%3$s" data-blog_id="%4$s">',
10 + esc_attr($tablestatus->Name),
11 + esc_attr($tablestatus->Engine),
12 + $tablestatus->is_optimizable ? 1 : 0,
13 + $is_multisite_mode ? esc_attr($tablestatus->blog_id) : '');
14 + printf('<td data-colname="%1$s">%2$s</td>', esc_attr__('No.', 'wp-optimize'), esc_html(number_format_i18n($row_number)));
15 + printf('<td data-tablename="%1$s" data-colname="%2$s">%3$s', esc_attr($tablestatus->Name), esc_attr__('Table', 'wp-optimize'), esc_html($tablestatus->Name));
31 16
32 17 if (!empty($tablestatus->plugin_status)) {
33 18 if ($tablestatus->wp_core_table) {
34 - echo "<br><span style='font-size: 11px;'>".__('Belongs to:', 'wp-optimize')."</span> ";
35 - echo "<span style='font-size: 11px;'>".__('WordPress core', 'wp-optimize')."</span>";
19 + printf('<br><span>%s</span> ', esc_html__('Belongs to:', 'wp-optimize'));
20 + printf('<span>%s</span>', esc_html__('WordPress core', 'wp-optimize'));
36 21 } elseif (false !== stripos($tablestatus->Name, 'actionscheduler_')) {
37 - echo "<br><span style='font-size: 11px;'>".__('This table is used by many plugins for batch processing. ', 'wp-optimize')."</span> ";
38 - echo "<span style='font-size: 11px;'>".__('Thus, it cannot be deleted.', 'wp-optimize')."</span>";
22 + printf('<br><span>%s</span> ', esc_html__('This table is used by many plugins for batch processing.', 'wp-optimize'));
23 + printf('<span>%s</span>', esc_html__('Thus, it cannot be deleted.', 'wp-optimize'));
39 24 } else {
40 25 echo '<div class="table-plugins">';
41 - echo "<span style='font-size: 11px;'>".__('Known plugins that use this table name:', 'wp-optimize')."</span> ";
42 - $separator = '<br>';
26 + printf('<span>%s</span> ', esc_html__('Known plugins that use this table name:', 'wp-optimize'));
43 27 foreach ($tablestatus->plugin_status as $plugins_status) {
44 28 $plugin = $plugins_status['plugin'];
45 29 $status = $plugins_status['status'];
46 30
47 - echo $separator;
31 + echo '<br>';
32 +
33 + if (in_array($plugin, $closed_plugins)) {
34 + continue;
35 + }
48 36
49 - echo " <a href='https://wordpress.org/plugins/{$plugin}/' target='_blank'><span style='font-size: 11px;'>{$plugin}</a>";
37 + if ('sfwd-lms' === $plugin) {
38 + $wp_optimize->wp_optimize_url('https://www.learndash.com/', '', '<span>LearnDash</span>');
39 + } else {
40 + $wp_optimize->wp_optimize_url('https://wordpress.org/plugins/'.$plugin.'/', '', '<span>'.esc_html($plugin).'</span>');
41 + }
50 42
51 - if (false == $status['installed']) {
52 - echo " <span style='font-size: 11px; color: #9B0000; font-weight: bold;'>[".__('not installed', 'wp-optimize')."]</span>";
53 - } elseif (false == $status['active']) {
54 - echo " <span style='font-size: 11px; color: #9B0000; font-weight: bold;'>[".__('inactive', 'wp-optimize')."]</span>";
43 + if (false === $status['installed']) {
44 + printf(' <span class="status">[%s]</span>', esc_html__('not installed', 'wp-optimize'));
45 + } elseif (false === $status['active']) {
46 + printf(' <span class="status">[%s]</span>', esc_html__('inactive', 'wp-optimize'));
55 47 }
56 48 }
57 49 echo '</div>';
58 50 }
@@ -59,62 +51,50 @@
59 51 }
60 52
61 53 echo "</td>\n";
62 54
63 - echo '<td data-colname="'.__('Records', 'wp-optimize').'" data-raw_value="'.esc_attr(intval($tablestatus->Rows)).'">'.number_format_i18n($tablestatus->Rows).'</td>'."\n";
64 - echo '<td data-colname="'.__('Data Size', 'wp-optimize').'" data-raw_value="'.esc_attr(intval($tablestatus->Data_length)).'">'.$wp_optimize->format_size($tablestatus->Data_length).'</td>'."\n";
65 - echo '<td data-colname="'.__('Index Size', 'wp-optimize').'" data-raw_value="'.esc_attr(intval($tablestatus->Index_length)).'">'.$wp_optimize->format_size($tablestatus->Index_length).'</td>'."\n";
55 + $table_rows = intval($tablestatus->Rows);
56 + printf('<td data-colname="%1$s" data-sort="%2$s">%3$s</td>', esc_attr__('Records', 'wp-optimize'), esc_attr($table_rows), esc_html(number_format_i18n($table_rows)));
57 + printf('<td data-colname="%1$s" data-sort="%2$s">%3$s</td>', esc_attr__('Data Size', 'wp-optimize'), esc_attr(intval($tablestatus->Data_length)), esc_html($wp_optimize->format_size($tablestatus->Data_length)));
58 + printf('<td data-colname="%1$s" data-sort="%2$s">%3$s</td>', esc_attr__('Index Size', 'wp-optimize'), esc_attr(intval($tablestatus->Index_length)), esc_html($wp_optimize->format_size($tablestatus->Index_length)));
66 59
67 60 if ($tablestatus->is_optimizable) {
68 - echo '<td data-colname="'.__('Type', 'wp-optimize').'" data-optimizable="1">'.htmlspecialchars($tablestatus->Engine).'</td>'."\n";
69 -
70 - echo '<td data-colname="'.__('Overhead', 'wp-optimize').'" data-raw_value="'.esc_attr(intval($tablestatus->Data_free)).'">';
61 + printf('<td data-colname="%1$s" data-optimizable="1">%2$s</td>', esc_attr__('Type', 'wp-optimize'), esc_html($tablestatus->Engine));
62 + printf('<td data-colname="%1$s" data-sort="%2$s">', esc_attr__('Overhead', 'wp-optimize'), esc_attr(intval($tablestatus->Data_free)));
71 63 $font_colour = ($optimize_db ? (($tablestatus->Data_free > $small_overhead_size) ? '#0000FF' : '#004600') : (($tablestatus->Data_free > $small_overhead_size) ? '#9B0000' : '#004600'));
72 - echo '<span style="color:'.$font_colour.';">';
73 - echo $wp_optimize->format_size($tablestatus->Data_free);
74 - echo '</span>';
75 - echo '</td>'."\n";
76 -
77 - $overhead_usage += $tablestatus->Data_free;
78 - $total_gain += $tablestatus->Data_free;
79 - $non_inno_db_tables++;
64 + printf('<span style="color:%1$s;">%2$s</span>', esc_attr($font_colour), esc_html($wp_optimize->format_size($tablestatus->Data_free)));
65 + echo "</td>\n";
80 66 } else {
81 - echo '<td data-colname="'.__('Type', 'wp-optimize').'" data-optimizable="0">'.htmlspecialchars($tablestatus->Engine).'</td>'."\n";
82 - echo '<td data-colname="'.__('Overhead', 'wp-optimize').'">';
83 - echo '<span style="color:#0000FF;">-</span>';
84 - echo '</td>'."\n";
85 -
86 - $inno_db_tables++;
67 + printf('<td data-colname="%1$s" data-optimizable="0">%2$s</td>', esc_attr__('Type', 'wp-optimize'), esc_html($tablestatus->Engine));
68 + printf('<td data-colname="%s">', esc_attr__('Overhead', 'wp-optimize'));
69 + ?>
70 + <span style="color:#0000FF;">-</span>
71 + </td>
72 + <?php
87 73 }
88 74
89 - echo '<td data-colname="'.__('Actions', 'wp-optimize').'">'.apply_filters('wpo_tables_list_additional_column_data', '', $tablestatus).'</td>';
75 + printf('<td data-colname="%1$s">%2$s</td>', esc_attr__('Actions', 'wp-optimize'), wp_kses_post(apply_filters('wpo_tables_list_additional_column_data', '', $tablestatus)));
90 76
91 - $row_usage += $tablestatus->Rows;
92 - $data_usage += $tablestatus->Data_length;
93 - $index_usage += $tablestatus->Index_length;
94 -
95 - echo '</tr>'."\n";
77 + echo "</tr>\n";
96 78 }
97 -
98 - // THis extra tbody with class of tablesorter-no-sort
99 - // Is for tablesorter and it will not allow the total bar
100 - // At the bottom of the table information to be sorted with the rest of the data
101 - echo '<tbody class="tablesorter-no-sort">'."\n";
102 -
103 - echo '<tr class="thead">'."\n";
104 - echo '<th>'.__('Total:', 'wp-optimize').'</th>'."\n";
105 - echo '<th>'.sprintf(_n('%s Table', '%s Tables', $no, 'wp-optimize'), number_format_i18n($no)).'</th>'."\n";
106 - echo '<th>'.number_format_i18n($row_usage).'</th>'."\n";
107 - echo '<th>'.$wp_optimize->format_size($data_usage).'</th>'."\n";
108 - echo '<th>'.$wp_optimize->format_size($index_usage).'</th>'."\n";
109 - echo '<th>'.'-'.'</th>'."\n";
110 - echo '<th>';
111 -
112 - $font_colour = (($optimize_db) ? (($overhead_usage > $small_overhead_size) ? '#0000FF' : '#004600') : (($overhead_usage > $small_overhead_size) ? '#9B0000' : '#004600'));
113 -
114 - echo '<span style="color:'.$font_colour.'">'.$wp_optimize->format_size($overhead_usage).'</span>';
115 -
116 - ?>
117 - </th>
118 - <th><?php _e('Actions', 'wp-optimize'); ?></th>
79 +?>
80 +</tbody>
81 +<tfoot>
82 + <tr class="thead">
83 + <th><?php esc_html_e('Total:', 'wp-optimize'); ?></th>
84 + <th>
85 + <?php
86 + // translators: %s is the number of tables
87 + echo esc_html(sprintf(_n('%s Table', '%s Tables', $no, 'wp-optimize'), $no));
88 + ?>
89 + </th>
90 + <th><?php echo esc_html($row_usage); ?></th>
91 + <th><?php echo esc_html($data_usage); ?></th>
92 + <th><?php echo esc_html($index_usage); ?></th>
93 + <th>-</th>
94 + <th>
95 + <?php $font_colour = (($optimize_db) ? (($overhead_usage > $small_overhead_size) ? '#0000FF' : '#004600') : (($overhead_usage > $small_overhead_size) ? '#9B0000' : '#004600')); ?>
96 + <span style="color:<?php echo esc_attr($font_colour); ?>"><?php echo esc_html($overhead_usage_formatted); ?></span>
97 + </th>
98 + <th><?php esc_html_e('Actions', 'wp-optimize'); ?></th>
119 99 </tr>
120 -</tbody>
100 +</tfoot>