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 +27 -64 3.2.5 → 4.7.0 View file →
@@ -1,75 +1,38 @@
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 - <h3 class="wpo-first-child"><?php _e('Gzip compression settings', 'wp-optimize');?></h3>
5 + <h3 class="wpo-first-child"><?php esc_html_e('Gzip compression settings', 'wp-optimize');?></h3>
6 6 <p>
7 - <span class="dashicons dashicons-info"></span> <span><?php _e("This option improves the performance of your website and decreases its loading time. 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'); ?>
8 - <?php printf('<a href="%s" target="_blank">%s</a>', $info_link, __('Follow this link to get more information about Gzip compression.', 'wp-optimize')); ?>
7 + <span class="dashicons dashicons-info"></span>
8 + <span><?php
9 + esc_html_e("This option improves the performance of your website and decreases its loading time.", 'wp-optimize');
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 + ?>
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')); ?>
9 13 </span>
10 14 </p>
11 15
12 - <?php if (is_wp_error($wpo_gzip_headers_information)) {
13 - $class = 'notice notice-error';
14 - printf('<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $wpo_gzip_headers_information->get_error_message()));
15 - } else {
16 - ?>
17 - <?php if ($wpo_gzip_compression_enabled && !is_wp_error($wpo_gzip_compression_enabled) && !$wpo_gzip_compression_enabled_by_wpo) : ?>
18 - <div class="wpo-fieldgroup wpo-gzip-already-enabled">
19 - <p><span class="dashicons dashicons-yes"></span>
20 - <?php if (is_array($wpo_gzip_headers_information) && 'brotli' == $wpo_gzip_headers_information['compression']) { ?>
21 - <?php _e('Your server uses Brotli compression instead of Gzip, which is good.', 'wp-optimize'); ?>
22 - <?php } else { ?>
23 - <?php _e('Gzip compression is already enabled.', 'wp-optimize'); ?>
24 - <?php } ?>
25 - <?php if ($is_cloudflare_site) { ?>
26 - <em><?php _e('It seems to be handled by Cloudflare.', 'wp-optimize'); ?></em>
27 - <?php } ?>
16 + <div id="wpo_gzip_control_panel">
17 + <?php echo wp_kses_post($gzip_compression_control_panel); ?>
18 + </div>
28 19
29 - </p>
30 - </div>
31 - <?php else : ?>
32 - <div class="wpo-fieldgroup">
33 - <p id="wpo_gzip_compression_status" class="<?php echo $class_name; ?>">
34 - <strong class="wpo-enabled"><?php _e('Gzip compression is currently ENABLED.', 'wp-optimize'); ?></strong>
35 - <strong class="wpo-disabled"><?php _e('Gzip compression is currently DISABLED.', 'wp-optimize'); ?></strong>
36 - <?php if (!$wp_optimize->is_apache_server() || ($wpo_gzip_compression_enabled && false == $wpo_gzip_compression_settings_added)) : ?>
37 - <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 _e('Check status again', 'wp-optimize'); ?> <img class="wpo_spinner display-none" src="<?php echo esc_attr(admin_url('images/spinner-2x.gif')); ?>"></a>
38 - <?php endif; ?>
39 - </p>
40 - <br>
41 - <?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>
42 28
43 - // add gzip compression section only if gzip compression disabled or we added cache settings to .htaccess.
44 - if (is_wp_error($wpo_gzip_compression_enabled) || false == $wpo_gzip_compression_enabled || $wpo_gzip_compression_settings_added) {
29 + <div id="wpo_gzip_compression_error_message">
30 + <?php
31 + if (is_wp_error($wpo_gzip_compression_enabled)) {
32 + echo esc_html($wpo_gzip_compression_enabled->get_error_message());
33 + }
34 + ?>
35 + </div>
36 + <pre id="wpo_gzip_compression_output" style="display: none;"></pre>
45 37
46 - if ($wp_optimize->is_apache_server()) {
47 - $button_text = (!is_wp_error($wpo_gzip_compression_enabled) && $wpo_gzip_compression_enabled) ? __('Disable', 'wp-optimize') : __('Enable', 'wp-optimize');
48 - ?>
49 - <form>
50 - <button class="button-primary" type="button"
51 - id="wp_optimize_gzip_compression_enable" data-enable="<?php echo $wpo_gzip_compression_enabled ? '0' : '1'; ?>"><?php echo $button_text; ?></button>
52 - <img class="wpo_spinner display-none" src="<?php echo esc_attr(admin_url('images/spinner-2x.gif')); ?>"
53 - width="20" height="20" alt="...">
54 - <br>
55 - </form>
56 - <?php
57 - } else {
58 - printf('<a href="%s" target="_blank">%s</a>', $faq_link, __('Follow this link to read the article about how to enable Gzip compression with your server software.', 'wp-optimize'));
59 - }
60 - }
61 - ?>
62 - </div>
63 -
64 - <div id="wpo_gzip_compression_error_message">
65 - <?php
66 - if (is_wp_error($wpo_gzip_compression_enabled)) {
67 - echo htmlspecialchars($wpo_gzip_compression_enabled->get_error_message());
68 - }
69 - ?>
70 - </div>
71 - <pre id="wpo_gzip_compression_output" style="display: none;"></pre>
72 -
73 - <?php endif; ?>
74 - <?php } ?>
75 38 </div>