PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.7.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.7.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
← All changes | templates/cache/browser-cache.php +33 -12 3.7.0 → 4.7.0 View file →
@@ -1,5 +1,5 @@
1 -<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
1 +<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?>
2 2
3 3 <div class="wpo_section wpo_group">
4 4
5 5 <h3 class="wpo-first-child"><?php esc_html_e('Browser static file caching settings (via headers)', 'wp-optimize');?></h3>
@@ -7,9 +7,9 @@
7 7 <?php echo esc_html__("Browser static file caching uses HTTP response headers to advise a visitor's browser to cache non-changing files for a while, so that it doesn't attempt to retrieve them upon every visit.", 'wp-optimize').' '.sprintf('<a href="%s" target="_blank">%s</a>', esc_url($info_link), esc_html__('Follow this link to get more information.', 'wp-optimize')); ?>
8 8 </p>
9 9
10 10 <div class="wpo-fieldgroup">
11 - <?php if ($is_cloudflare_site) : ?>
11 + <?php if ($is_cloudflare_handling_browser_cache) : ?>
12 12 <p class="wpo-enabled"><span class="dashicons dashicons-yes"></span>
13 13 <em><?php esc_html_e('Your website seems to use Cloudflare, which handles the browser caching rules.', 'wp-optimize'); ?></em>
14 14 </p>
15 15
@@ -15,10 +15,20 @@
15 15
16 16 <?php else : ?>
17 17
18 18 <div id="wpo_browser_cache_status" class="<?php echo esc_attr($class_name); ?>">
19 - <span class="wpo-enabled"><span class="dashicons dashicons-yes"></span> <?php echo strip_tags(sprintf(__('Browser static file caching headers are currently %s.', 'wp-optimize'), '<strong>'.esc_html__('enabled', 'wp-optimize').'</strong>'), '<strong>'); ?></span>
20 - <span class="wpo-disabled"><?php echo strip_tags(sprintf(__('Browser static file caching headers are currently %s.', 'wp-optimize'), '<strong>'.esc_html__('disabled', 'wp-optimize').'</strong>'), '<strong>'); ?></span>
19 + <span class="wpo-enabled"><span class="dashicons dashicons-yes"></span>
20 + <?php
21 + // translators: %s is the word "enabled" in bold
22 + echo wp_kses_post(sprintf(__('Browser static file caching headers are currently %s.', 'wp-optimize'), '<strong>'.esc_html__('enabled', 'wp-optimize').'</strong>'));
23 + ?>
24 + </span>
25 + <span class="wpo-disabled">
26 + <?php
27 + // translators: %s is the word "disabled" in bold
28 + echo wp_kses_post(sprintf(__('Browser static file caching headers are currently %s.', 'wp-optimize'), '<strong>'.esc_html__('disabled', 'wp-optimize').'</strong>'));
29 + ?>
30 + </span>
21 31 </div>
22 32
23 33 <br>
24 34
@@ -24,9 +34,9 @@
24 34
25 35 <?php
26 36
27 37 // add browser cache control section only if browser cache disabled or we added cache settings to .htaccess.
28 - if (false == $wpo_browser_cache_enabled || $wpo_browser_cache_settings_added || is_wp_error($wpo_browser_cache_enabled)) {
38 + if (false === $wpo_browser_cache_enabled || $wpo_browser_cache_settings_added || is_wp_error($wpo_browser_cache_enabled)) {
29 39 if (is_wp_error($wpo_browser_cache_enabled)) {
30 40 ?>
31 41 <div id="wpo_browser_cache_error_message" class="notice error below-h2">
32 42 <p>
@@ -32,9 +42,9 @@
32 42 <p>
33 43 <b><?php esc_html_e('Error: Unable to Check browser cache.', 'wp-optimize'); ?></b>
34 44 <?php esc_html_e('We encountered a problem while checking if browser cache is enabled.', 'wp-optimize'); ?>
35 45 </p>
36 - <p><?php echo strip_tags($wpo_browser_cache_enabled->get_error_message(), '<a><b>'); ?></p>
46 + <p><?php echo wp_kses_post($wpo_browser_cache_enabled->get_error_message()); ?></p>
37 47 </div>
38 48 <?php
39 49 } else {
40 50 if ($wp_optimize->is_apache_server()) {
@@ -42,14 +52,14 @@
42 52 ?>
43 53 <form>
44 54 <input type="hidden" id="wpo_enable_browser_cache" class="cache-settings" name="enable_browser_cache" value="<?php echo $wpo_browser_cache_enabled ? 'true' : 'false'; ?>" />
45 55 <label><?php esc_html_e('Expiration time:', 'wp-optimize'); ?></label>
46 - <input id="wpo_browser_cache_expire_days" class="cache-settings" type="number" min="0" step="1" name="browser_cache_expire_days" value="<?php echo esc_attr($wpo_browser_cache_expire_days); ?>">
47 - <label for="wpo_browser_cache_expire"><?php esc_html_e('day(s)', 'wp-optimize'); ?></label>
48 - <input id="wpo_browser_cache_expire_hours" class="cache-settings" type="number" min="0" step="1" name="browser_cache_expire_hours" value="<?php echo esc_attr($wpo_browser_cache_expire_hours); ?>">
56 + <input id="wpo_browser_cache_expire_days" class="cache-settings wpo_browser_cache_input" type="number" min="0" step="1" name="browser_cache_expire_days" value="<?php echo esc_attr($wpo_browser_cache_expire_days); ?>">
57 + <label for="wpo_browser_cache_expire_days"><?php esc_html_e('day(s)', 'wp-optimize'); ?></label>
58 + <input id="wpo_browser_cache_expire_hours" class="cache-settings wpo_browser_cache_input" type="number" min="0" step="1" name="browser_cache_expire_hours" value="<?php echo esc_attr($wpo_browser_cache_expire_hours); ?>">
49 59 <label for="wpo_browser_cache_expire_hours"><?php esc_html_e('hour(s)', 'wp-optimize'); ?></label>
50 60 <button class="button-primary" type="button" id="wp_optimize_browser_cache_enable"><?php echo esc_html($button_text); ?></button>
51 - <img class="wpo_spinner display-none" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>"
61 + <img class="wpo_spinner display-none" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage -- N/A ?>"
52 62 width="20" height="20" alt="...">
53 63 <p><?php esc_html_e('Empty or 0 values disable the headers.', 'wp-optimize'); ?></p>
54 64 </form>
55 65 <?php
@@ -59,9 +69,9 @@
59 69
60 70 ?>
61 71
62 72 <div id="wpo_browser_cache_message"><?php
63 - if (false == $wpo_browser_cache_enabled && $wpo_browser_cache_settings_added) {
73 + if (false === $wpo_browser_cache_enabled && $wpo_browser_cache_settings_added) {
64 74 ?>
65 75 <div class="notice notice-error">
66 76 <p>
67 77 <?php
@@ -76,9 +86,20 @@
76 86 </div>
77 87 <?php
78 88 }
79 89 ?></div>
80 - <pre id="wpo_browser_cache_output" style="display: none;"></pre>
90 +
91 + <?php if ('' !== $wpo_browser_cache_error_message) { ?>
92 + <div id="wpo_browser_cache_error_message" class="notice notice-error"><?php echo esc_html($wpo_browser_cache_error_message); ?></div>
93 + <?php } else { ?>
94 + <div id="wpo_browser_cache_error_message" class="notice notice-error" style="display: none;"></div>
95 + <?php } ?>
96 +
97 + <?php if ('' !== $wpo_browser_cache_output) { ?>
98 + <pre id="wpo_browser_cache_output"><?php echo esc_html($wpo_browser_cache_output); ?></pre>
99 + <?php } else { ?>
100 + <pre id="wpo_browser_cache_output" style="display: none;"></pre>
101 + <?php } ?>
81 102 <?php
82 103 }
83 104 }
84 105