| @@ -1,34 +1,20 @@ | ||
| 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 | -<h3 class="wpo-first-child"><?php _e('Status', 'wp-optimize'); ?></h3> | |
| 7 | +<h3 class="wpo-first-child"><?php esc_html_e('Status', 'wp-optimize'); ?></h3> | |
| 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 | - echo __('Last scheduled optimization was at', 'wp-optimize').': '; | |
| 26 | - echo '<span style="font-color: #004600; font-weight:bold;">'; | |
| 27 | - echo htmlspecialchars($lastopt); | |
| 28 | - echo '</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>'); | |
| 29 | 15 | } else { |
| 30 | - echo __('There was no scheduled optimization', 'wp-optimize'); | |
| 16 | + echo esc_html__('There was no scheduled optimization', 'wp-optimize'); | |
| 31 | 17 | } |
| 32 | 18 | ?> |
| 33 | 19 | <br> |
| 34 | 20 | |
| @@ -33,70 +19,57 @@ | ||
| 33 | 19 | <br> |
| 34 | 20 | |
| 35 | 21 | <?php |
| 36 | 22 | |
| 37 | - $scheduled_optimizations_enabled = false; | |
| 38 | - | |
| 39 | - if (WP_Optimize::is_premium()) { | |
| 40 | - $scheduled_optimizations = WP_Optimize_Premium()->get_scheduled_optimizations(); | |
| 41 | - | |
| 42 | - if (!empty($scheduled_optimizations)) { | |
| 43 | - foreach ($scheduled_optimizations as $optimization) { | |
| 44 | - if (isset($optimization['status']) && 1 == $optimization['status']) { | |
| 45 | - $scheduled_optimizations_enabled = true; | |
| 46 | - break; | |
| 47 | - } | |
| 48 | - } | |
| 49 | - } | |
| 50 | - } else { | |
| 51 | - $scheduled_optimizations_enabled = $options->get_option('schedule', 'false') == 'true'; | |
| 52 | - } | |
| 53 | - | |
| 54 | 23 | if ($scheduled_optimizations_enabled) { |
| 55 | - echo '<strong>'; | |
| 56 | - _e('Scheduled cleaning', 'wp-optimize'); | |
| 57 | - echo ' <span style="color: #009B24;">'.__('enabled', 'wp-optimize').'</span>'; | |
| 58 | - echo ', </strong>'; | |
| 24 | + printf( | |
| 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'), | |
| 27 | + '<strong>', | |
| 28 | + '<span style="color: #009B24;">', | |
| 29 | + '</span>', | |
| 30 | + '</strong>' | |
| 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); | |
| 69 | - _e('Next schedule:', 'wp-optimize'); | |
| 36 | + $date = new DateTime("@".$next_optimization_timestamp); | |
| 37 | + esc_html_e('Next schedule:', 'wp-optimize'); | |
| 70 | 38 | echo ' '; |
| 71 | 39 | echo '<span style="font-color: #004600">'; |
| 72 | - echo 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_attr($admin_page_url).'">'.__('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 | - echo '<strong>'; | |
| 78 | - _e('Scheduled cleaning disabled', 'wp-optimize'); | |
| 79 | - echo '</strong>'; | |
| 45 | + printf( | |
| 46 | + // translators: 1: Opening strong tag, 2: Closing strong tag | |
| 47 | + esc_html__('%1$sScheduled cleaning disabled%2$s', 'wp-optimize'), | |
| 48 | + '<strong>', | |
| 49 | + '</strong>' | |
| 50 | + ); | |
| 80 | 51 | } |
| 81 | 52 | echo '<br>'; |
| 82 | 53 | |
| 83 | - if ('true' == $retention_enabled) { | |
| 54 | + if ('true' === $retention_enabled) { | |
| 84 | 55 | echo '<strong><span style="font-color: #0000FF;">'; |
| 85 | - printf(__('Keeping last %s weeks data', 'wp-optimize'), $retention_period); | |
| 56 | + // translators: %s is number of weeks | |
| 57 | + printf(esc_html__('Keeping last %s weeks data', 'wp-optimize'), esc_html($retention_period)); | |
| 86 | 58 | echo '</span></strong>'; |
| 87 | 59 | } else { |
| 88 | - echo '<strong>'.__('Not keeping recent data', 'wp-optimize').'</strong>'; | |
| 60 | + echo '<strong>'.esc_html__('Not keeping recent data', 'wp-optimize').'</strong>'; | |
| 89 | 61 | } |
| 90 | 62 | |
| 91 | 63 | echo '<br>'; |
| 92 | 64 | |
| 93 | - if ('true' == $revisions_retention_enabled) { | |
| 65 | + if ('true' === $revisions_retention_enabled) { | |
| 94 | 66 | echo '<strong><span style="font-color: #0000FF;">'; |
| 95 | - printf(__('Keeping last %s revisions', 'wp-optimize'), $revisions_retention_count); | |
| 67 | + // translators: %s is number of revisions | |
| 68 | + printf(esc_html__('Keeping last %s revisions', 'wp-optimize'), esc_html($revisions_retention_count)); | |
| 96 | 69 | echo '</span></strong>'; |
| 97 | 70 | } else { |
| 98 | - echo '<strong>'.__('Not keeping any revisions', 'wp-optimize').'</strong>'; | |
| 71 | + echo '<strong>'.esc_html__('Not keeping any revisions', 'wp-optimize').'</strong>'; | |
| 99 | 72 | } |
| 100 | 73 | ?> |
| 101 | 74 | </p> |
| 102 | 75 | |
| @@ -101,27 +74,43 @@ | ||
| 101 | 74 | </p> |
| 102 | 75 | |
| 103 | 76 | <p> |
| 104 | 77 | <?php |
| 105 | - $total_cleaned = $options->get_option('total-cleaned'); | |
| 106 | 78 | $total_cleaned_num = floatval($total_cleaned); |
| 107 | 79 | |
| 108 | 80 | if ($total_cleaned_num > 0) { |
| 109 | - echo '<h5>'.__('Total clean up overall:', 'wp-optimize').' '; | |
| 110 | - echo '<span style="font-color: #004600">'; | |
| 111 | - echo $wp_optimize->format_size($total_cleaned); | |
| 112 | - echo '</span></h5>'; | |
| 81 | + printf( | |
| 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'), | |
| 84 | + '<h5>', | |
| 85 | + '<span style="color: #004600;">' . esc_html($total_cleanup_size) . '</span>', | |
| 86 | + '</h5>' | |
| 87 | + ); | |
| 113 | 88 | } |
| 114 | 89 | ?> |
| 115 | 90 | </p> |
| 116 | 91 | |
| 117 | 92 | <?php |
| 118 | - $corrupted_tables_count = $options->get_option('corrupted-tables-count', 0); | |
| 119 | 93 | |
| 120 | 94 | if ($corrupted_tables_count > 0) { |
| 121 | 95 | ?> |
| 122 | 96 | <p> |
| 123 | - <span style="color: #E07575;"><?php printf(_n('Your database has %s corrupted table.', 'Your database has %s corrupted tables.', $corrupted_tables_count, 'wp-optimize'), $corrupted_tables_count); ?></span><br> | |
| 124 | - <a href="<?php echo esc_attr($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 _e('Repair corrupted tables here.', 'wp-optimize'); ?></a> | |
| 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> | |
| 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> | |
| 125 | 114 | </p> |
| 126 | 115 | <?php } ?> |
| 127 | 116 | </div> |