| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('WPO_VERSION')) die('No direct access allowed'); |
| 4 |
|
| 5 |
$retention_enabled = $options->get_option('retention-enabled', 'false'); |
| 6 |
$retention_period = $options->get_option('retention-period', '2'); |
| 7 |
$admin_page_url = $options->admin_page_url(); |
| 8 |
|
| 9 |
$revisions_retention_enabled = $options->get_option('revisions-retention-enabled', 'false'); |
| 10 |
$revisions_retention_count = $options->get_option('revisions-retention-count', '2'); |
| 11 |
|
| 12 |
?> |
| 13 |
|
| 14 |
<h3 class="wpo-first-child"><?php esc_html_e('Status', 'wp-optimize'); ?></h3> |
| 15 |
|
| 16 |
<div class="wpo-fieldgroup" id="wp_optimize_status_box"> |
| 17 |
<p> |
| 18 |
<?php |
| 19 |
$lastopt = $options->get_option('last-optimized', 'Never'); |
| 20 |
if ('Never' !== $lastopt) { |
| 21 |
// check if last optimized value is integer. |
| 22 |
if (is_numeric($lastopt)) { |
| 23 |
$lastopt = date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $lastopt + ( get_option('gmt_offset') * HOUR_IN_SECONDS )); |
| 24 |
} |
| 25 |
printf(esc_html__('Last scheduled optimization was at %s', 'wp-optimize'), '<span style="color: #004600; font-weight:bold;">' . esc_html($lastopt) . '</span>'); |
| 26 |
} else { |
| 27 |
echo esc_html__('There was no scheduled optimization', 'wp-optimize'); |
| 28 |
} |
| 29 |
?> |
| 30 |
<br> |
| 31 |
|
| 32 |
<?php |
| 33 |
|
| 34 |
$scheduled_optimizations_enabled = false; |
| 35 |
|
| 36 |
if (WP_Optimize::is_premium()) { |
| 37 |
$scheduled_optimizations = WP_Optimize_Premium()->get_scheduled_optimizations(); |
| 38 |
|
| 39 |
if (!empty($scheduled_optimizations)) { |
| 40 |
foreach ($scheduled_optimizations as $optimization) { |
| 41 |
if (isset($optimization['status']) && 1 == $optimization['status']) { |
| 42 |
$scheduled_optimizations_enabled = true; |
| 43 |
break; |
| 44 |
} |
| 45 |
} |
| 46 |
} |
| 47 |
} else { |
| 48 |
$scheduled_optimizations_enabled = $options->get_option('schedule', 'false') == 'true'; |
| 49 |
} |
| 50 |
|
| 51 |
if ($scheduled_optimizations_enabled) { |
| 52 |
printf( |
| 53 |
esc_html__('%sScheduled cleaning %senabled%s%s', 'wp-optimize'), |
| 54 |
'<strong>', |
| 55 |
'<span style="color: #009B24;">', |
| 56 |
'</span>', |
| 57 |
'</strong> ' |
| 58 |
); |
| 59 |
|
| 60 |
$timestamp = apply_filters('wpo_cron_next_event', wp_next_scheduled('wpo_cron_event2')); |
| 61 |
|
| 62 |
if ($timestamp) { |
| 63 |
|
| 64 |
$timestamp = $timestamp + 60 * 60 * get_option('gmt_offset'); |
| 65 |
|
| 66 |
$wp_optimize->cron_activate(); |
| 67 |
|
| 68 |
$date = new DateTime("@".$timestamp); |
| 69 |
esc_html_e('Next schedule:', 'wp-optimize'); |
| 70 |
echo ' '; |
| 71 |
echo '<span style="font-color: #004600">'; |
| 72 |
echo esc_html(gmdate(get_option('date_format') . ' ' . get_option('time_format'), $timestamp)); |
| 73 |
echo '</span>'; |
| 74 |
echo ' - <a id="wp_optimize_status_box_refresh" href="'.esc_url($admin_page_url).'">'.esc_html__('Refresh', 'wp-optimize').'</a>'; |
| 75 |
} |
| 76 |
} else { |
| 77 |
printf( |
| 78 |
esc_html__('%sScheduled cleaning disabled%s', 'wp-optimize'), |
| 79 |
'<strong>', |
| 80 |
'</strong>' |
| 81 |
); |
| 82 |
} |
| 83 |
echo '<br>'; |
| 84 |
|
| 85 |
if ('true' == $retention_enabled) { |
| 86 |
echo '<strong><span style="font-color: #0000FF;">'; |
| 87 |
printf(esc_html__('Keeping last %s weeks data', 'wp-optimize'), esc_html($retention_period)); |
| 88 |
echo '</span></strong>'; |
| 89 |
} else { |
| 90 |
echo '<strong>'.esc_html__('Not keeping recent data', 'wp-optimize').'</strong>'; |
| 91 |
} |
| 92 |
|
| 93 |
echo '<br>'; |
| 94 |
|
| 95 |
if ('true' == $revisions_retention_enabled) { |
| 96 |
echo '<strong><span style="font-color: #0000FF;">'; |
| 97 |
printf(esc_html__('Keeping last %s revisions', 'wp-optimize'), esc_html($revisions_retention_count)); |
| 98 |
echo '</span></strong>'; |
| 99 |
} else { |
| 100 |
echo '<strong>'.esc_html__('Not keeping any revisions', 'wp-optimize').'</strong>'; |
| 101 |
} |
| 102 |
?> |
| 103 |
</p> |
| 104 |
|
| 105 |
<p> |
| 106 |
<?php |
| 107 |
$total_cleaned = $options->get_option('total-cleaned'); |
| 108 |
$total_cleaned_num = floatval($total_cleaned); |
| 109 |
|
| 110 |
if ($total_cleaned_num > 0) { |
| 111 |
printf( |
| 112 |
esc_html__('%sTotal clean up overall: %s %s', 'wp-optimize'), |
| 113 |
'<h5>', |
| 114 |
'<span style="color: #004600;">' . esc_html($wp_optimize->format_size($total_cleaned)) . '</span>', |
| 115 |
'</h5>' |
| 116 |
); |
| 117 |
} |
| 118 |
?> |
| 119 |
</p> |
| 120 |
|
| 121 |
<?php |
| 122 |
$corrupted_tables_count = $options->get_option('corrupted-tables-count', 0); |
| 123 |
|
| 124 |
if ($corrupted_tables_count > 0) { |
| 125 |
?> |
| 126 |
<p> |
| 127 |
<span style="color: #E07575;"><?php echo esc_html(sprintf(_n('Your database has %s corrupted table.', 'Your database has %s corrupted tables.', $corrupted_tables_count, 'wp-optimize'), $corrupted_tables_count)); ?></span><br> |
| 128 |
<a href="<?php echo esc_url($admin_page_url); ?>&tab=wp_optimize_tables" onclick="jQuery('.wpo-pages-menu > a').first().trigger('click'); jQuery('#wp-optimize-nav-tab-wpo_database-tables').trigger('click'); return false;"><?php esc_html_e('Repair corrupted tables here.', 'wp-optimize'); ?></a> |
| 129 |
</p> |
| 130 |
<?php } ?> |
| 131 |
</div> |
| 132 |
|