PluginProbe
HTTP Headers / trunk
HTTP Headers vtrunk
1.19.5 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.12.0 1.12.1 1.12.2 1.13.0 1.13.1 1.13.2 1.13.3 1.13.4 1.14.0 1.14.1 1.14.2 1.15.0 All 60 releases
http-headers / views / content-encoding.php

content-encoding.php in HTTP Headers trunk, at views/content-encoding.php

122 lines 5.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) {
3 exit;
4 }
5 ?>
6 <tr>
7 <th scope="row">Content-Encoding
8 <p class="description"><?php esc_html_e('Compression is an important way to increase the performance of a Web site. For some documents, size reduction of up to 70% lowers the bandwidth capacity needs.', 'http-headers'); ?></p>
9 <hr>
10 <p class="description"><?php esc_html_e('Read more at', 'http-headers'); ?>
11 <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding"><?php esc_html_e('MDN Web Docs', 'http-headers'); ?></a>
12 </p>
13 </th>
14 <td>
15 <fieldset>
16 <legend class="screen-reader-text">Content-Encoding</legend>
17 <?php
18 $http_headers_content_encoding = get_option('hh_content_encoding', 0);
19 foreach ($http_headers_bools as $http_headers_k => $http_headers_v)
20 {
21 ?><p><label><input type="radio" class="http-header" name="hh_content_encoding" value="<?php echo esc_attr($http_headers_k); ?>"<?php checked($http_headers_content_encoding, $http_headers_k); ?> /> <?php echo esc_html($http_headers_v); ?></label></p><?php
22 }
23 ?>
24 </fieldset>
25 </td>
26 <td>
27 <?php settings_fields( 'http-headers-ce' ); ?>
28 <?php do_settings_sections( 'http-headers-ce' ); ?>
29 <table>
30 <tbody>
31 <tr>
32 <th colspan="2"><?php esc_html_e('Module', 'http-headers'); ?></th>
33 </tr>
34 <?php
35 $http_headers_content_encoding_module = get_option('hh_content_encoding_module');
36 ?>
37 <tr>
38 <td colspan="2" class="hh-td-inner">
39 <table style="width: 100%">
40 <tbody>
41 <tr>
42 <td>
43 <label><input type="radio" name="hh_content_encoding_module" value="deflate"<?php echo $http_headers_content_encoding_module == 'deflate' || !$http_headers_content_encoding_module ? ' checked' : NULL; ?>> <?php esc_html_e('DEFLATE', 'http-headers'); ?></label>
44 </td>
45 <td>
46 <label><input type="radio" name="hh_content_encoding_module" value="brotli"<?php checked($http_headers_content_encoding_module, 'brotli'); ?>> <?php esc_html_e('BROTLI', 'http-headers'); ?></label>
47 </td>
48 <td>
49 <label><input type="radio" name="hh_content_encoding_module" value="brotli_deflate"<?php checked($http_headers_content_encoding_module, 'brotli_deflate'); ?>> <?php esc_html_e('BROTLI; DEFLATE', 'http-headers'); ?></label>
50 </td>
51 </tr>
52 </tbody>
53 </table>
54 </td>
55 </tr>
56 <tr>
57 <th colspan="2"><?php esc_html_e('By content type', 'http-headers'); ?></th>
58 </tr><tr>
59 <?php
60 $http_headers_items = array(
61 'application/javascript',
62 'application/x-javascript',
63 'application/json',
64 'application/ld+json',
65 'application/manifest+json',
66 'application/rdf+xml',
67 'application/rss+xml',
68 'application/schema+json',
69 'application/vnd.geo+json',
70 'application/x-web-app-manifest+json',
71 'application/vnd.ms-fontobject',
72 'application/x-font-ttf',
73 'application/xhtml+xml',
74 'application/xml',
75 'font/opentype',
76 'font/eot',
77 'image/bmp',
78 'image/svg+xml',
79 'image/x-icon',
80 'image/vnd.microsoft.icon',
81 'text/javascript',
82 'text/css',
83 'text/html',
84 'text/plain',
85 'text/x-component',
86 'text/xml',
87 );
88 $http_headers_content_encoding_value = get_option('hh_content_encoding_value');
89 if (!$http_headers_content_encoding_value) {
90 $http_headers_content_encoding_value = array();
91 }
92 foreach ($http_headers_items as $http_headers_i => $http_headers_item) {
93 if ($http_headers_i > 0 && $http_headers_i % 2 === 0) {
94 ?></tr><tr><?php
95 }
96 ?><td><label><input type="checkbox" class="http-header-value" name="hh_content_encoding_value[<?php echo esc_attr($http_headers_item); ?>]" value="1"<?php echo !array_key_exists($http_headers_item, $http_headers_content_encoding_value) ? NULL : ' checked'; ?><?php echo $http_headers_content_encoding == 1 ? NULL : ' readonly'; ?> /> <?php echo esc_html($http_headers_item); ?></label></td><?php
97 }
98 ?>
99 </tr>
100
101 <tr>
102 <th colspan="2"><?php esc_html_e('By extension', 'http-headers'); ?></th>
103 </tr>
104 <tr>
105 <?php
106 $http_headers_content_encoding_ext = get_option('hh_content_encoding_ext');
107 if (!$http_headers_content_encoding_ext) {
108 $http_headers_content_encoding_ext = array();
109 }
110 $http_headers_items = array('php', 'html', 'js', 'css', 'json', 'xml', 'svg', 'txt', 'bmp', 'ico', 'ttf', 'otf', 'eot');
111 foreach ($http_headers_items as $http_headers_i => $http_headers_item) {
112 if ($http_headers_i > 0 && $http_headers_i % 2 === 0) {
113 ?></tr><tr><?php
114 }
115 ?><td><label><input type="checkbox" class="http-header-value" name="hh_content_encoding_ext[<?php echo esc_attr($http_headers_item); ?>]" value="1"<?php echo !array_key_exists($http_headers_item, $http_headers_content_encoding_ext) ? NULL : ' checked'; ?><?php echo $http_headers_content_encoding == 1 ? NULL : ' readonly'; ?> /> *.<?php echo esc_html($http_headers_item); ?></label></td><?php
116 }
117 ?>
118 </tr>
119
120 </tbody></table>
121 </td>
122 </tr>