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

80 lines 4.0 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 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 } ?>
32
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
46
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)) {
71 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>
76
77 <?php endif; ?>
78 <?php } ?>
79 </div>
80