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