| 1 |
<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?> |
| 2 |
|
| 3 |
<div class="wpo_shade hidden"> |
| 4 |
<div class="wpo_shade_inner"> |
| 5 |
<span class="dashicons dashicons-update-alt wpo-rotate"></span> |
| 6 |
</div> |
| 7 |
</div> |
| 8 |
<?php |
| 9 |
if (is_wp_error($wpo_gzip_headers_information)) { |
| 10 |
?> |
| 11 |
<div class="notice notice-error"> |
| 12 |
<p> |
| 13 |
<b><?php esc_html_e('Error: Unable to Check GZIP Compression.', 'wp-optimize'); ?></b> |
| 14 |
<?php esc_html_e('We encountered a problem while checking if GZIP compression is enabled.', 'wp-optimize'); ?> |
| 15 |
</p> |
| 16 |
<p><?php echo wp_kses_post($wpo_gzip_headers_information->get_error_message()); ?></p> |
| 17 |
</div> |
| 18 |
<?php |
| 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')); // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage -- N/A ?>" alt="..."></a> |
| 42 |
<?php endif; ?> |
| 43 |
|
| 44 |
<?php if ($wp_optimize->is_apache_server() && $wpo_gzip_compression_partially_enabled) : ?> |
| 45 |
<div> |
| 46 |
<?php |
| 47 |
// translators: %1$s and %2$s is a list of content types HTML, CSS, JS. |
| 48 |
printf(esc_html__('Gzip is already enabled for %1$s files but you can make loading faster by enabling gzip compression with WP-Optimize for %2$s and other static files', 'wp-optimize'), esc_html(join('/', $wpo_gzip_compression_content_types['enabled'])), esc_html(join(', ', $wpo_gzip_compression_content_types['disabled']))); |
| 49 |
?> |
| 50 |
</div> |
| 51 |
<?php endif; ?> |
| 52 |
</p> |
| 53 |
<br> |
| 54 |
<?php |
| 55 |
|
| 56 |
// add gzip compression section only if gzip compression disabled or we added cache settings to .htaccess. |
| 57 |
if (is_wp_error($wpo_gzip_compression_enabled) || false === $wpo_gzip_compression_enabled || $wpo_gzip_compression_settings_added) { |
| 58 |
|
| 59 |
if ($wp_optimize->is_apache_server()) { |
| 60 |
$button_text = $wpo_gzip_compression_settings_added ? __('Disable', 'wp-optimize') : __('Enable', 'wp-optimize'); |
| 61 |
?> |
| 62 |
<form> |
| 63 |
<button class="button-primary" type="button" |
| 64 |
id="wp_optimize_gzip_compression_enable" data-enable="<?php echo $wpo_gzip_compression_settings_added ? '0' : '1'; ?>"><?php echo esc_html($button_text); ?></button> |
| 65 |
<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 ?>" |
| 66 |
width="20" height="20" alt="..."> |
| 67 |
<br> |
| 68 |
</form> |
| 69 |
<?php |
| 70 |
} else { |
| 71 |
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')); |
| 72 |
} |
| 73 |
} |
| 74 |
?> |
| 75 |
|
| 76 |
</div> |
| 77 |
|
| 78 |
<?php endif; ?> |
| 79 |
|
| 80 |
<?php } |
| 81 |
|