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/gzip-compression.php +20 -61 3.2.21 → 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('Gzip compression settings', 'wp-optimize');?></h3>
@@ -8,72 +8,31 @@
8 8 <span><?php
9 9 esc_html_e("This option improves the performance of your website and decreases its loading time.", 'wp-optimize');
10 10 esc_html_e('When a visitor makes a request, the server compresses the requested resource before sending it leading to smaller file sizes and faster loading.', 'wp-optimize');
11 11 ?>
12 - <?php printf('<a href="%s" target="_blank">%s</a>', $info_link, __('Follow this link to get more information about Gzip compression.', 'wp-optimize')); ?>
12 + <?php printf('<a href="%s" target="_blank">%s</a>', esc_url($info_link), esc_html__('Follow this link to get more information about Gzip compression.', 'wp-optimize')); ?>
13 13 </span>
14 14 </p>
15 15
16 - <?php if (is_wp_error($wpo_gzip_headers_information)) {
17 - $class = 'notice notice-error';
18 - printf('<div class="%1$s"><p>%2$s</p></div>', esc_attr($class), esc_html($wpo_gzip_headers_information->get_error_message()));
19 - } else {
20 - ?>
21 - <?php if ($wpo_gzip_compression_enabled && !is_wp_error($wpo_gzip_compression_enabled) && !$wpo_gzip_compression_enabled_by_wpo) : ?>
22 - <div class="wpo-fieldgroup wpo-gzip-already-enabled">
23 - <p><span class="dashicons dashicons-yes"></span>
24 - <?php if (is_array($wpo_gzip_headers_information) && 'brotli' == $wpo_gzip_headers_information['compression']) { ?>
25 - <?php esc_html_e('Your server uses Brotli compression instead of Gzip, which is good.', 'wp-optimize'); ?>
26 - <?php } else { ?>
27 - <?php esc_html_e('Gzip compression is already enabled.', 'wp-optimize'); ?>
28 - <?php } ?>
29 - <?php if ($is_cloudflare_site) { ?>
30 - <em><?php esc_html_e('It seems to be handled by Cloudflare.', 'wp-optimize'); ?></em>
31 - <?php } ?>
16 + <div id="wpo_gzip_control_panel">
17 + <?php echo wp_kses_post($gzip_compression_control_panel); ?>
18 + </div>
32 19
33 - </p>
34 - </div>
35 - <?php else : ?>
36 - <div class="wpo-fieldgroup">
37 - <p id="wpo_gzip_compression_status" class="<?php echo esc_attr($class_name); ?>">
38 - <strong class="wpo-enabled"><?php esc_html_e('Gzip compression is currently ENABLED.', 'wp-optimize'); ?></strong>
39 - <strong class="wpo-disabled"><?php esc_html_e('Gzip compression is currently DISABLED.', 'wp-optimize'); ?></strong>
40 - <?php if (!$wp_optimize->is_apache_server() || ($wpo_gzip_compression_enabled && false == $wpo_gzip_compression_settings_added)) : ?>
41 - <a href="#" class="wpo-refresh-gzip-status" title="<?php esc_attr_e('Press this to see if any changes were made to your Gzip configuration', 'wp-optimize'); ?>"><?php esc_html_e('Check status again', 'wp-optimize'); ?> <img class="wpo_spinner display-none" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>"></a>
42 - <?php endif; ?>
43 - </p>
44 - <br>
45 - <?php
20 + <div class="wpo-fieldgroup">
21 + <strong><?php esc_html_e('Gzip compression test', 'wp-optimize'); ?></strong> <span tabindex="0" data-tooltip="<?php esc_attr_e('This section displays the current compression status for different resources such as HTML, CSS, and JS.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
22 + <a href="javascript:;" id="wpo_gzip_compression_test_btn" class="wpo-refresh-button"><span class="dashicons dashicons-image-rotate"></span><?php esc_html_e('Test again', 'wp-optimize'); ?></a>
23 + <br>
24 + <p id="wpo_gzip_compression_details">
25 + <?php echo $compression_test_results_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- already escaped ?>
26 + </p>
27 + </div>
46 28
47 - // add gzip compression section only if gzip compression disabled or we added cache settings to .htaccess.
48 - if (is_wp_error($wpo_gzip_compression_enabled) || false == $wpo_gzip_compression_enabled || $wpo_gzip_compression_settings_added) {
49 -
50 - if ($wp_optimize->is_apache_server()) {
51 - $button_text = (!is_wp_error($wpo_gzip_compression_enabled) && $wpo_gzip_compression_enabled) ? __('Disable', 'wp-optimize') : __('Enable', 'wp-optimize');
52 - ?>
53 - <form>
54 - <button class="button-primary" type="button"
55 - id="wp_optimize_gzip_compression_enable" data-enable="<?php echo $wpo_gzip_compression_enabled ? '0' : '1'; ?>"><?php echo esc_html($button_text); ?></button>
56 - <img class="wpo_spinner display-none" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>"
57 - width="20" height="20" alt="...">
58 - <br>
59 - </form>
60 - <?php
61 - } else {
62 - printf('<a href="%s" target="_blank">%s</a>', esc_url($faq_link), esc_html__('Follow this link to read the article about how to enable Gzip compression with your server software.', 'wp-optimize'));
63 - }
64 - }
65 - ?>
66 - </div>
67 -
68 - <div id="wpo_gzip_compression_error_message">
69 - <?php
70 - if (is_wp_error($wpo_gzip_compression_enabled)) {
29 + <div id="wpo_gzip_compression_error_message">
30 + <?php
31 + if (is_wp_error($wpo_gzip_compression_enabled)) {
71 32 echo esc_html($wpo_gzip_compression_enabled->get_error_message());
72 - }
73 - ?>
74 - </div>
75 - <pre id="wpo_gzip_compression_output" style="display: none;"></pre>
33 + }
34 + ?>
35 + </div>
36 + <pre id="wpo_gzip_compression_output" style="display: none;"></pre>
76 37
77 - <?php endif; ?>
78 - <?php } ?>
79 38 </div>