| 1 |
<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?> |
| 2 |
|
| 3 |
<tbody id="the-list"> |
| 4 |
<?php |
| 5 |
|
| 6 |
foreach ($table_list_object_format as $index => $tablestatus) { |
| 7 |
printf('<tr data-tablename="%1$s" data-type="%2$s" data-optimizable="%3$s" data-blog_id="%4$s">', |
| 8 |
esc_attr($tablestatus->Name), |
| 9 |
esc_attr($tablestatus->Engine), |
| 10 |
$tablestatus->is_optimizable ? 1 : 0, |
| 11 |
$is_multisite_mode ? esc_attr($tablestatus->blog_id) : ''); |
| 12 |
printf('<td data-colname="%1$s">%2$s</td>', esc_attr__('No.', 'wp-optimize'), esc_html(number_format_i18n($table_list[$index]['index']))); |
| 13 |
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)); |
| 14 |
|
| 15 |
if (!empty($tablestatus->plugin_status)) { |
| 16 |
if ($tablestatus->wp_core_table) { |
| 17 |
printf('<br><span>%s</span> ', esc_html__('Belongs to:', 'wp-optimize')); |
| 18 |
printf('<span>%s</span>', esc_html__('WordPress core', 'wp-optimize')); |
| 19 |
} elseif (false !== stripos($tablestatus->Name, 'actionscheduler_')) { |
| 20 |
printf('<br><span>%s</span> ', esc_html__('This table is used by many plugins for batch processing.', 'wp-optimize')); |
| 21 |
printf('<span>%s</span>', esc_html__('Thus, it cannot be deleted.', 'wp-optimize')); |
| 22 |
} else { |
| 23 |
echo '<div class="table-plugins">'; |
| 24 |
printf('<span>%s</span> ', esc_html__('Known plugins that use this table name:', 'wp-optimize')); |
| 25 |
foreach ($tablestatus->plugin_status as $plugins_status) { |
| 26 |
$plugin = $plugins_status['plugin']; |
| 27 |
$status = $plugins_status['status']; |
| 28 |
|
| 29 |
echo '<br>'; |
| 30 |
|
| 31 |
if (in_array($plugin, $closed_plugins)) { |
| 32 |
continue; |
| 33 |
} |
| 34 |
|
| 35 |
if ('sfwd-lms' === $plugin) { |
| 36 |
$wp_optimize->wp_optimize_url('https://www.learndash.com/', '', '<span>LearnDash</span>'); |
| 37 |
} else { |
| 38 |
$wp_optimize->wp_optimize_url('https://wordpress.org/plugins/'.$plugin.'/', '', '<span>'.esc_html($plugin).'</span>'); |
| 39 |
} |
| 40 |
|
| 41 |
if (false === $status['installed']) { |
| 42 |
printf(' <span class="status">[%s]</span>', esc_html__('not installed', 'wp-optimize')); |
| 43 |
} elseif (false === $status['active']) { |
| 44 |
printf(' <span class="status">[%s]</span>', esc_html__('inactive', 'wp-optimize')); |
| 45 |
} |
| 46 |
} |
| 47 |
echo '</div>'; |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
echo "</td>\n"; |
| 52 |
|
| 53 |
printf('<td data-colname="%1$s" data-sort="%2$s">%3$s</td>', esc_attr__('Records', 'wp-optimize'), esc_attr(intval($tablestatus->Rows)), esc_html(number_format_i18n($tablestatus->Rows))); |
| 54 |
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))); |
| 55 |
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))); |
| 56 |
|
| 57 |
if ($tablestatus->is_optimizable) { |
| 58 |
printf('<td data-colname="%1$s" data-optimizable="1">%2$s</td>', esc_attr__('Type', 'wp-optimize'), esc_html($tablestatus->Engine)); |
| 59 |
printf('<td data-colname="%1$s" data-sort="%2$s">', esc_attr__('Overhead', 'wp-optimize'), esc_attr(intval($tablestatus->Data_free))); |
| 60 |
$font_colour = ($optimize_db ? (($tablestatus->Data_free > $small_overhead_size) ? '#0000FF' : '#004600') : (($tablestatus->Data_free > $small_overhead_size) ? '#9B0000' : '#004600')); |
| 61 |
printf('<span style="color:%1$s;">%2$s</span>', esc_attr($font_colour), esc_html($wp_optimize->format_size($tablestatus->Data_free))); |
| 62 |
echo "</td>\n"; |
| 63 |
} else { |
| 64 |
printf('<td data-colname="%1$s" data-optimizable="0">%2$s</td>', esc_attr__('Type', 'wp-optimize'), esc_html($tablestatus->Engine)); |
| 65 |
printf('<td data-colname="%s">', esc_attr__('Overhead', 'wp-optimize')); |
| 66 |
?> |
| 67 |
<span style="color:#0000FF;">-</span> |
| 68 |
</td> |
| 69 |
<?php |
| 70 |
} |
| 71 |
|
| 72 |
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))); |
| 73 |
|
| 74 |
echo "</tr>\n"; |
| 75 |
} |
| 76 |
?> |
| 77 |
</tbody> |
| 78 |
<tfoot> |
| 79 |
<tr class="thead"> |
| 80 |
<th><?php esc_html_e('Total:', 'wp-optimize'); ?></th> |
| 81 |
<th> |
| 82 |
<?php |
| 83 |
// translators: %s is the number of tables |
| 84 |
echo esc_html(sprintf(_n('%s Table', '%s Tables', $no, 'wp-optimize'), $no)); |
| 85 |
?> |
| 86 |
</th> |
| 87 |
<th><?php echo esc_html($row_usage); ?></th> |
| 88 |
<th><?php echo esc_html($data_usage); ?></th> |
| 89 |
<th><?php echo esc_html($index_usage); ?></th> |
| 90 |
<th>-</th> |
| 91 |
<th> |
| 92 |
<?php $font_colour = (($optimize_db) ? (($overhead_usage > $small_overhead_size) ? '#0000FF' : '#004600') : (($overhead_usage > $small_overhead_size) ? '#9B0000' : '#004600')); ?> |
| 93 |
<span style="color:<?php echo esc_attr($font_colour); ?>"><?php echo esc_html($overhead_usage_formatted); ?></span> |
| 94 |
</th> |
| 95 |
<th><?php esc_html_e('Actions', 'wp-optimize'); ?></th> |
| 96 |
</tr> |
| 97 |
</tfoot> |
| 98 |
|