PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.7.1
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.7.1
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
wp-optimize / templates / cache / gzip-compression.php

gzip-compression.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.7.1, at templates/cache/gzip-compression.php

88 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
2
3 <div class="wpo_section wpo_group">
4
5 <h3 class="wpo-first-child"><?php esc_html_e('Gzip compression settings', 'wp-optimize');?></h3>
6 <p>
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')); ?>
13 </span>
14 </p>
15
16 <?php
17 if (is_wp_error($wpo_gzip_headers_information)) {
18 ?>
19 <div class="notice notice-error">
20 <p>
21 <b><?php esc_html_e('Error: Unable to Check GZIP Compression.', 'wp-optimize'); ?></b>
22 <?php esc_html_e('We encountered a problem while checking if GZIP compression is enabled.', 'wp-optimize'); ?>
23 </p>
24 <p><?php echo strip_tags($wpo_gzip_headers_information->get_error_message(), '<a><b>'); ?></p>
25 </div>
26 <?php
27 } else {
28 ?>
29 <?php if ($wpo_gzip_compression_enabled && !is_wp_error($wpo_gzip_compression_enabled) && !$wpo_gzip_compression_enabled_by_wpo) : ?>
30 <div class="wpo-fieldgroup wpo-gzip-already-enabled">
31 <p><span class="dashicons dashicons-yes"></span>
32 <?php if (is_array($wpo_gzip_headers_information) && 'brotli' == $wpo_gzip_headers_information['compression']) { ?>
33 <?php esc_html_e('Your server uses Brotli compression instead of Gzip, which is good.', 'wp-optimize'); ?>
34 <?php } else { ?>
35 <?php esc_html_e('Gzip compression is already enabled.', 'wp-optimize'); ?>
36 <?php } ?>
37 <?php if ($is_cloudflare_site) { ?>
38 <em><?php esc_html_e('It seems to be handled by Cloudflare.', 'wp-optimize'); ?></em>
39 <?php } ?>
40
41 </p>
42 </div>
43 <?php else : ?>
44 <div class="wpo-fieldgroup">
45 <p id="wpo_gzip_compression_status" class="<?php echo esc_attr($class_name); ?>">
46 <strong class="wpo-enabled"><?php esc_html_e('Gzip compression is currently ENABLED.', 'wp-optimize'); ?></strong>
47 <strong class="wpo-disabled"><?php esc_html_e('Gzip compression is currently DISABLED.', 'wp-optimize'); ?></strong>
48 <?php if (!$wp_optimize->is_apache_server() || ($wpo_gzip_compression_enabled && false == $wpo_gzip_compression_settings_added)) : ?>
49 <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>
50 <?php endif; ?>
51 </p>
52 <br>
53 <?php
54
55 // add gzip compression section only if gzip compression disabled or we added cache settings to .htaccess.
56 if (is_wp_error($wpo_gzip_compression_enabled) || false == $wpo_gzip_compression_enabled || $wpo_gzip_compression_settings_added) {
57
58 if ($wp_optimize->is_apache_server()) {
59 $button_text = (!is_wp_error($wpo_gzip_compression_enabled) && $wpo_gzip_compression_enabled) ? __('Disable', 'wp-optimize') : __('Enable', 'wp-optimize');
60 ?>
61 <form>
62 <button class="button-primary" type="button"
63 id="wp_optimize_gzip_compression_enable" data-enable="<?php echo $wpo_gzip_compression_enabled ? '0' : '1'; ?>"><?php echo esc_html($button_text); ?></button>
64 <img class="wpo_spinner display-none" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>"
65 width="20" height="20" alt="...">
66 <br>
67 </form>
68 <?php
69 } else {
70 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'));
71 }
72 }
73 ?>
74 </div>
75
76 <div id="wpo_gzip_compression_error_message">
77 <?php
78 if (is_wp_error($wpo_gzip_compression_enabled)) {
79 echo esc_html($wpo_gzip_compression_enabled->get_error_message());
80 }
81 ?>
82 </div>
83 <pre id="wpo_gzip_compression_output" style="display: none;"></pre>
84
85 <?php endif; ?>
86 <?php } ?>
87 </div>
88