PluginProbe ʕ •ᴥ•ʔ
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.5.4
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.5.4
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 3.8.0 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 3.2.2 trunk 0.7.0 1.8.9.10 1.8.9.7 1.8.9.8 1.8.9.9 1.9 1.9.1 2.0.1 2.1.0 2.1.1 2.2.0 2.2.1 2.2.10 2.2.11 2.2.12 2.2.13 2.2.2 2.2.3 2.2.4 2.2.6 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.18 3.0.19 3.0.2 3.0.3 3.0.4 3.0.5 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.2 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.17 3.2.18 3.2.19
wp-optimize / templates / minify / js-settings-tab.php
wp-optimize / templates / minify Last commit date
advanced-tab.php 1 month ago analytics-settings-tab.php 1 month ago asset-preload.php 1 month ago cached-file-log.php 1 month ago cached-file.php 1 month ago capo-js.php 1 month ago css-settings-tab.php 1 month ago font-settings-tab.php 1 month ago html-settings-tab.php 1 month ago js-settings-tab.php 1 month ago preload-tab.php 1 month ago settings-tab.php 1 month ago status-tab.php 1 month ago
js-settings-tab.php
278 lines
1 <?php if (!defined('ABSPATH')) die('No direct access allowed'); ?>
2 <div id='wpo_section_js' class="wpo_section wpo_group">
3 <div id="wpo_settings_warnings"></div>
4 <div class="notice notice-warning wpo-warning is-dismissible wpo_section_notice_js show-if-enabled" style="<?php echo $show_section_notice ? '' : 'display:none;'; ?>">
5 <p>
6 <span class="dashicons dashicons-shield"></span>
7 <strong><?php esc_html_e('Enable merging of JavaScript files into one to reduce HTTP requests.', 'wp-optimize'); ?></strong><br>
8 <?php echo wp_kses_post($notice_text);?>
9 </p>
10 </div>
11 <form>
12 <h3 class="show-if-enabled"><?php esc_html_e('JavaScript options', 'wp-optimize'); ?></h3>
13 <div class="wpo-fieldgroup show-if-enabled">
14 <fieldset>
15 <div class="wpo-fieldgroup__subgroup">
16 <label for="enable_js_minification">
17 <input
18 name="enable_js_minification"
19 type="checkbox"
20 id="enable_js_minification"
21 value="1"
22 <?php checked($wpo_minify_options['enable_js_minification']); ?>
23 >
24 <?php esc_html_e('Enable minification of JavaScript files', 'wp-optimize'); ?>
25 </label>
26 </div>
27 <div class="wpo-fieldgroup__subgroup">
28 <label for="enable_merging_of_js">
29 <input
30 name="enable_merging_of_js"
31 type="checkbox"
32 id="enable_merging_of_js"
33 value="1"
34 <?php checked($wpo_minify_options['enable_merging_of_js']); ?>
35 >
36 <?php esc_html_e('Enable merging of JavaScript files', 'wp-optimize'); ?>
37 </label>
38 <span tabindex="0" data-tooltip="<?php echo esc_attr($tooltip); ?>"><span class="dashicons dashicons-editor-help"></span> </span>
39 </div>
40 <div class="wpo-fieldgroup__subgroup">
41 <label for="enable_js_trycatch">
42 <input
43 name="enable_js_trycatch"
44 type="checkbox"
45 id="enable_js_trycatch"
46 value="1"
47 <?php checked($wpo_minify_options['enable_js_trycatch']); ?>
48 >
49 <?php esc_html_e('Contain each included file in its own block', 'wp-optimize'); ?>
50 <em><?php esc_html_e('(enable if trying to isolate a JavaScript error introduced by minifying or merging)', 'wp-optimize'); ?></em>
51 <?php
52 $message = __('When enabled, the content of each JavaScript file that is combined will be wrapped in its own "try / catch" statement.', 'wp-optimize');
53 $message .= ' ';
54 $message .= __('This means that if one file has an error, it should not impede execution of other, independent files.', 'wp-optimize');
55 ?>
56 </label>
57 <span tabindex="0" data-tooltip="<?php echo esc_attr($message); ?>"><span class="dashicons dashicons-editor-help"></span> </span>
58 </div>
59 </fieldset>
60 </div>
61
62 <?php do_action('wpo_after_minify_javascript_options'); ?>
63
64 <h3 class="show-if-enabled"><?php esc_html_e('Exclude JavaScript from processing', 'wp-optimize'); ?></h3>
65 <div class="wpo-fieldgroup show-if-enabled">
66 <fieldset>
67 <label for="exclude_js">
68 <?php esc_html_e('Any JavaScript files that match the paths below will be completely ignored', 'wp-optimize'); ?>
69 <span tabindex="0" data-tooltip="<?php esc_attr_e('Use this if you are having issues with a certain JavaScript file.', 'wp-optimize'); ?> <?php esc_attr_e('Any file present here will be loaded normally by WordPress', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
70 </label>
71 <textarea
72 name="exclude_js"
73 rows="7" cols="50"
74 id="exclude_js"
75 class="large-text code"
76 placeholder="<?php esc_attr_e('e.g.: /wp-includes/js/jquery/jquery.js', 'wp-optimize'); ?>"
77 ><?php echo esc_textarea($wpo_minify_options['exclude_js']);?></textarea>
78 <br>
79 <?php esc_html_e('Some files known for causing issues when combined / minified are excluded by default.', 'wp-optimize'); ?> <?php esc_html_e('You can see / edit them in the Advanced tab.', 'wp-optimize'); ?>
80 </fieldset>
81 </div>
82
83 <h3 class="show-if-enabled"><?php esc_html_e('Defer JavaScript', 'wp-optimize'); ?></h3>
84 <div class="wpo-fieldgroup show-if-enabled">
85 <fieldset class="async-js-manual-list">
86 <div class="wpo-fieldgroup__subgroup">
87 <h4><label>
88 <input
89 name="enable_defer_js"
90 type="radio"
91 value="individual"
92 <?php checked($wpo_minify_options['enable_defer_js'], 'individual'); ?>
93 >
94 <?php esc_html_e('Asynchronously load selected JavaScript files', 'wp-optimize'); ?>
95 </label>
96 <span tabindex="0" data-tooltip="<?php esc_attr_e('The files in the list will be loaded asynchronously, and will not be minified or merged.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span><br>
97 </h4>
98 </div>
99 <div class="defer-js-settings">
100 <div class="wpo-fieldgroup__subgroup">
101 <label for="async_js">
102 <?php esc_html_e('Any JavaScript files that match the paths below will be loaded asynchronously.', 'wp-optimize'); ?>
103 <br>
104 <?php esc_html_e('Use this if you have a completely independent script', 'wp-optimize'); ?>
105 <?php
106 $message = __('Independent scripts are for example \'analytics\' or \'pixel\' scripts.', 'wp-optimize');
107 $message .= ' ';
108 $message .= __('They are not required for the website to work', 'wp-optimize');
109 ?>
110 <span tabindex="0" data-tooltip="<?php echo esc_attr($message);?>"><span class="dashicons dashicons-editor-help"></span></span>
111 </label>
112 <textarea
113 name="async_js"
114 rows="7"
115 cols="50"
116 id="async_js"
117 class="large-text code"
118 placeholder="<?php esc_attr_e('e.g.: /js/main.js', 'wp-optimize'); ?>"
119 ><?php echo esc_textarea($wpo_minify_options['async_js']); ?></textarea>
120 </div>
121 <div class="wpo-fieldgroup__subgroup">
122 <label for="exclude_js_from_page_speed_tools">
123 <input
124 name="exclude_js_from_page_speed_tools"
125 type="checkbox"
126 id="exclude_js_from_page_speed_tools"
127 value="1"
128 <?php checked($wpo_minify_options['exclude_js_from_page_speed_tools']); ?>
129 >
130 <?php esc_html_e('Exclude scripts from page speed tests (PageSpeed Insights, GTMetrix...)', 'wp-optimize'); ?>
131 </label>
132 <span tabindex="0" data-tooltip="<?php esc_attr_e('Use this only for testing purpose to find out which scripts are slowing down your site.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span><br>
133 </div>
134 </div>
135 </fieldset>
136
137 <fieldset>
138 <div class="wpo-fieldgroup__subgroup">
139 <h4>
140 <label>
141 <input
142 name="enable_defer_js"
143 type="radio"
144 value="all"
145 <?php checked($wpo_minify_options['enable_defer_js'], 'all'); ?>
146 >
147 <?php esc_html_e('Defer all the JavaScript files', 'wp-optimize'); ?>
148 </label>
149 <span tabindex="0" data-tooltip="<?php esc_attr_e('All files - including the ones processed by WP-Optimize - will be deferred, except the ones in the exclusion list above.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
150 </h4>
151 </div>
152 <div class="defer-js-settings">
153 <div class="notice notice-warning below-h2">
154 <p class="wpo_min-bold-green wpo_min-rowintro">
155 <?php esc_html_e('Some themes and plugins need render blocking scripts to work.', 'wp-optimize'); ?> <?php esc_html_e('Please check the browser console for any eventual JavaScript errors caused by deferring the scripts.', 'wp-optimize'); ?>
156 </p>
157 </div>
158 <h4><?php esc_html_e('Defer method:', 'wp-optimize'); ?></h4>
159 <div class="wpo-fieldgroup__subgroup">
160 <label>
161 <input
162 name="defer_js_type"
163 type="radio"
164 value="defer"
165 <?php checked($wpo_minify_options['defer_js_type'], 'defer'); ?>
166 >
167 <?php esc_html_e('Use the "defer" html attribute', 'wp-optimize'); ?>
168 </label>
169 <span tabindex="0" data-tooltip="<?php esc_attr_e('Supported by all modern browsers.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
170 </div>
171 <div class="wpo-fieldgroup__subgroup">
172 <label>
173 <input
174 name="defer_js_type"
175 type="radio"
176 value="async_using_js"
177 <?php checked($wpo_minify_options['defer_js_type'], 'async_using_js'); ?>
178 >
179 <?php esc_html_e('Defer using JavaScript', 'wp-optimize'); ?>
180 <em>
181 <?php
182 $message = '(';
183 $message .= esc_html__('Asynchronous loading.', 'wp-optimize');
184 $message .= ' ';
185 // translators: %1$s is a opening anchor tag, %2$s is a closing anchor tag
186 $message .= sprintf(esc_html__('Use this method if you require support for %1$solder browsers%2$s.', 'wp-optimize'), '<a href="https://www.w3schools.com/tags/att_script_defer.asp" target="_blank">', '</a>');
187 $message .= ')';
188 echo wp_kses_post($message);
189 ?>
190 </em>
191 </label>
192 </div>
193 <div class="wpo-fieldgroup__subgroup">
194 <label for="defer_jquery">
195 <input
196 name="defer_jquery"
197 type="checkbox"
198 id="defer_jquery"
199 value="1"
200 <?php checked($wpo_minify_options['defer_jquery']); ?>
201 >
202 <?php esc_html_e('Defer jQuery', 'wp-optimize'); ?> <em><?php esc_html_e('(Note that as jQuery is a common dependency, it probably needs to be loaded synchronously).', 'wp-optimize'); ?></em>
203 </label>
204 <span tabindex="0" data-tooltip="<?php esc_attr_e('Disable this setting if you have an error \'jQuery undefined\'.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
205 </div>
206 </div>
207 </fieldset>
208 </div>
209
210 <h3><?php esc_html_e('Delay JavaScript', 'wp-optimize'); ?></h3>
211 <div class="wpo-fieldgroup">
212 <fieldset>
213 <div class="wpo-fieldgroup__subgroup">
214 <h4><label>
215 <input
216 name="enable_delay_js"
217 type="checkbox"
218 value="true"
219 <?php checked($wpo_minify_options['enable_delay_js'], true); ?>
220 >
221 <?php esc_html_e('Delay JS', 'wp-optimize'); ?>
222 </label>
223 <span tabindex="0" data-tooltip="<?php esc_attr_e('Delays JavaScript file loading until the user interacts with the page (e.g., mouse movement, scrolling, or touch), thereby improving page load performance', 'wp-optimize'); ?>"><span class="dashicons dashicons-editor-help"></span> </span>
224 </h4>
225 </div>
226
227 <div class="wpo-fieldgroup__subgroup">
228 <h4><label>
229 <input
230 name="enable_preload_js"
231 type="checkbox"
232 value="true"
233 <?php checked($wpo_minify_options['enable_preload_js'], true); ?>
234 >
235 <?php esc_html_e('Preload JavaScript files', 'wp-optimize'); ?>
236 </label>
237 <span tabindex="0" data-tooltip="<?php esc_attr_e('Preloads JavaScript files in parallel with other resources ahead of time, ensuring they are ready for faster execution without impacting the overall page load time', 'wp-optimize'); ?>"><span class="dashicons dashicons-editor-help"></span> </span>
238 </h4>
239 </div>
240
241 <div class="wpo-fieldgroup__subgroup">
242 <label for="exclude_delay_js">
243 <?php esc_html_e('Any JavaScript files that match the paths below will be completely ignored.', 'wp-optimize'); ?>
244 <?php esc_html_e('It is also possible to exclude scripts by adding the "data-no-delay-js" attribute.', 'wp-optimize'); ?>
245 </label>
246 <span tabindex="0" data-tooltip="<?php esc_attr_e('Use this if you are having issues with a specific JavaScript file.', 'wp-optimize'); ?> <?php esc_attr_e('Any file present here will be loaded normally by WordPress', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
247
248 <textarea
249 name="exclude_delay_js"
250 rows="7" cols="50"
251 id="exclude_delay_js"
252 class="large-text code"
253 placeholder="<?php esc_attr_e('e.g.: /wp-includes/js/jquery/jquery.js', 'wp-optimize'); ?>"
254 ><?php echo esc_textarea($wpo_minify_options['exclude_delay_js']);?></textarea>
255 <span>
256 <?php
257 esc_html_e('Use the wildcard * to similar JavaScript files.', 'wp-optimize');
258 echo ' ';
259 // translators: %1$s and %2$s are examples of path using the wildcards
260 printf(esc_html_x('e.g. %1$s or %2$s', '%s are examples of path using the wildcard *', 'wp-optimize'), '<code>/js/*</code>', '<code>/jquery*.js</code>');
261 ?>
262 </span>
263 </div>
264 </fieldset>
265 </div>
266
267 <p class="submit">
268 <input
269 class="wp-optimize-save-minify-settings button button-primary"
270 type="submit"
271 value="<?php esc_attr_e('Save settings', 'wp-optimize'); ?>"
272 >
273 <img class="wpo_spinner" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage -- N/A ?>" alt="...">
274 <span class="save-done dashicons dashicons-yes display-none"></span>
275 </p>
276 </form>
277 </div>
278