| @@ -1,15 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - if (!defined('WPO_VERSION')) die('No direct access allowed'); | |
| 3 | + if (!defined('ABSPATH')) die('No direct access allowed'); | |
| 4 | 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 | 5 | ?> |
| 13 | 6 | |
| 14 | 7 | <h3 class="wpo-first-child"><?php esc_html_e('Status', 'wp-optimize'); ?></h3> |
| 15 | 8 | |
| @@ -15,15 +8,11 @@ | ||
| 15 | 8 | |
| 16 | 9 | <div class="wpo-fieldgroup" id="wp_optimize_status_box"> |
| 17 | 10 | <p> |
| 18 | 11 | <?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>'); | |
| 12 | + if ('Never' !== $last_optimized) { | |
| 13 | + // translators: %s is the last scheduled optimization date. | |
| 14 | + printf(esc_html__('Last scheduled optimization was at %s', 'wp-optimize'), '<span style="color: #004600; font-weight:bold;">' . esc_html($last_optimized) . '</span>'); | |
| 26 | 15 | } else { |
| 27 | 16 | echo esc_html__('There was no scheduled optimization', 'wp-optimize'); |
| 28 | 17 | } |
| 29 | 18 | ?> |
| @@ -30,53 +19,33 @@ | ||
| 30 | 19 | <br> |
| 31 | 20 | |
| 32 | 21 | <?php |
| 33 | 22 | |
| 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 | 23 | if ($scheduled_optimizations_enabled) { |
| 52 | 24 | printf( |
| 53 | - esc_html__('%sScheduled cleaning %senabled%s%s', 'wp-optimize'), | |
| 25 | + // translators: 1: Opening strong tag, 2: Opening color span tag, 3: Closing color span tag, 4: Closing strong tag | |
| 26 | + esc_html__('%1$sScheduled cleaning %2$senabled%3$s%4$s', 'wp-optimize'), | |
| 54 | 27 | '<strong>', |
| 55 | 28 | '<span style="color: #009B24;">', |
| 56 | 29 | '</span>', |
| 57 | - '</strong> ' | |
| 30 | + '</strong>' | |
| 58 | 31 | ); |
| 32 | + echo ' '; | |
| 59 | 33 | |
| 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(); | |
| 34 | + if ($next_optimization_timestamp) { | |
| 67 | 35 | |
| 68 | - $date = new DateTime("@".$timestamp); | |
| 36 | + $date = new DateTime("@".$next_optimization_timestamp); | |
| 69 | 37 | esc_html_e('Next schedule:', 'wp-optimize'); |
| 70 | 38 | echo ' '; |
| 71 | 39 | echo '<span style="font-color: #004600">'; |
| 72 | - echo esc_html(gmdate(get_option('date_format') . ' ' . get_option('time_format'), $timestamp)); | |
| 40 | + echo esc_html(gmdate(get_option('date_format') . ' ' . get_option('time_format'), $next_optimization_timestamp)); | |
| 73 | 41 | echo '</span>'; |
| 74 | - echo ' - <a id="wp_optimize_status_box_refresh" href="'.esc_url($admin_page_url).'">'.esc_html__('Refresh', 'wp-optimize').'</a>'; | |
| 42 | + echo ' - <a id="wp_optimize_status_box_refresh" href="#">'.esc_html__('Refresh', 'wp-optimize').'</a>'; | |
| 75 | 43 | } |
| 76 | 44 | } else { |
| 77 | 45 | printf( |
| 78 | - esc_html__('%sScheduled cleaning disabled%s', 'wp-optimize'), | |
| 46 | + // translators: 1: Opening strong tag, 2: Closing strong tag | |
| 47 | + esc_html__('%1$sScheduled cleaning disabled%2$s', 'wp-optimize'), | |
| 79 | 48 | '<strong>', |
| 80 | 49 | '</strong>' |
| 81 | 50 | ); |
| 82 | 51 | } |
| @@ -81,10 +50,11 @@ | ||
| 81 | 50 | ); |
| 82 | 51 | } |
| 83 | 52 | echo '<br>'; |
| 84 | 53 | |
| 85 | - if ('true' == $retention_enabled) { | |
| 54 | + if ('true' === $retention_enabled) { | |
| 86 | 55 | echo '<strong><span style="font-color: #0000FF;">'; |
| 56 | + // translators: %s is number of weeks | |
| 87 | 57 | printf(esc_html__('Keeping last %s weeks data', 'wp-optimize'), esc_html($retention_period)); |
| 88 | 58 | echo '</span></strong>'; |
| 89 | 59 | } else { |
| 90 | 60 | echo '<strong>'.esc_html__('Not keeping recent data', 'wp-optimize').'</strong>'; |
| @@ -91,10 +61,11 @@ | ||
| 91 | 61 | } |
| 92 | 62 | |
| 93 | 63 | echo '<br>'; |
| 94 | 64 | |
| 95 | - if ('true' == $revisions_retention_enabled) { | |
| 65 | + if ('true' === $revisions_retention_enabled) { | |
| 96 | 66 | echo '<strong><span style="font-color: #0000FF;">'; |
| 67 | + // translators: %s is number of revisions | |
| 97 | 68 | printf(esc_html__('Keeping last %s revisions', 'wp-optimize'), esc_html($revisions_retention_count)); |
| 98 | 69 | echo '</span></strong>'; |
| 99 | 70 | } else { |
| 100 | 71 | echo '<strong>'.esc_html__('Not keeping any revisions', 'wp-optimize').'</strong>'; |
| @@ -103,16 +74,16 @@ | ||
| 103 | 74 | </p> |
| 104 | 75 | |
| 105 | 76 | <p> |
| 106 | 77 | <?php |
| 107 | - $total_cleaned = $options->get_option('total-cleaned'); | |
| 108 | 78 | $total_cleaned_num = floatval($total_cleaned); |
| 109 | 79 | |
| 110 | 80 | if ($total_cleaned_num > 0) { |
| 111 | 81 | printf( |
| 112 | - esc_html__('%sTotal clean up overall: %s %s', 'wp-optimize'), | |
| 82 | + // translators: 1: Opening h5 tag, 2: Formatted size in colored span, 3: Closing h5 tag | |
| 83 | + esc_html__('%1$sTotal clean up overall: %2$s%3$s', 'wp-optimize'), | |
| 113 | 84 | '<h5>', |
| 114 | - '<span style="color: #004600;">' . esc_html($wp_optimize->format_size($total_cleaned)) . '</span>', | |
| 85 | + '<span style="color: #004600;">' . esc_html($total_cleanup_size) . '</span>', | |
| 115 | 86 | '</h5>' |
| 116 | 87 | ); |
| 117 | 88 | } |
| 118 | 89 | ?> |
| @@ -118,14 +89,28 @@ | ||
| 118 | 89 | ?> |
| 119 | 90 | </p> |
| 120 | 91 | |
| 121 | 92 | <?php |
| 122 | - $corrupted_tables_count = $options->get_option('corrupted-tables-count', 0); | |
| 123 | 93 | |
| 124 | 94 | if ($corrupted_tables_count > 0) { |
| 125 | 95 | ?> |
| 126 | 96 | <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> | |
| 97 | + <span style="color: #E07575;"> | |
| 98 | + <?php | |
| 99 | + echo esc_html( | |
| 100 | + sprintf( | |
| 101 | + // translators: %s: Number of corrupted tables | |
| 102 | + _n( | |
| 103 | + 'Your database has %s corrupted table.', | |
| 104 | + 'Your database has %s corrupted tables.', | |
| 105 | + $corrupted_tables_count, | |
| 106 | + 'wp-optimize' | |
| 107 | + ), | |
| 108 | + $corrupted_tables_count | |
| 109 | + ) | |
| 110 | + ); | |
| 111 | + ?> | |
| 112 | + </span><br> | |
| 128 | 113 | <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 | 114 | </p> |
| 130 | 115 | <?php } ?> |
| 131 | 116 | </div> |