PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 4.0.29
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v4.0.29
4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.0.30 4.0.29 4.0.28 4.0.27 4.0.26 4.0.24 4.0.25 4.0.23 4.0.22 4.0.21 4.0.19 4.0.18 4.0.17 4.0.16 1.9.3 1.9.4 1.9.5 1.9.6 All 170 releases
searchpro / admin / tabs / css-javascript.php

css-javascript.php in BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript 4.0.29, at admin/tabs/css-javascript.php

298 lines 15.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) exit;
3
4 // cdn exclusions
5 $cdn_exclude = get_option('berq_exclude_cdn', []);
6 $cdn_exclude_keywords = implode("\n", $cdn_exclude);
7
8 $include_critical_css = get_option('berqwp_force_include_critical_css', []);
9 $include_critical_css_lines = implode("\n", $include_critical_css);
10
11 $exclude_css = get_option('berqwp_exclude_css', []);
12 $exclude_css_lines = implode("\n", $exclude_css);
13
14 $exclude_js = get_option('berqwp_exclude_js', []);
15 $exclude_js_lines = implode("\n", $exclude_js);
16
17 $exclude_third_party_js = get_option('berqwp_exclude_third_party_js', []);
18 $exclude_third_party_js_lines = implode("\n", $exclude_third_party_js);
19
20
21 ?>
22 <div id="css-javascript" <?php bwp_is_tab('css-javascript'); ?>>
23 <h2 class="berq-tab-title"><?php esc_html_e('CSS & JavaScript', 'searchpro'); ?></h2>
24
25 <div class="berq-info-box berq-setting-group" style="<?php echo $berqwp_can_use_cloud ? 'display:none!important;' : '' ?>" >
26 <div class="group-container">
27 <h3 class="berq-box-title">
28 <?php esc_html_e('Used CSS', 'searchpro'); ?>
29 </h3>
30 <div class="berq-box-content berq-setting-toggle">
31 <div class="berq-option-content">
32 <p>
33 <?php esc_html_e('Extract and inline only the CSS used on each page, then load remaining CSS based on the "CSS Delivery Method" setting.', 'searchpro'); ?>
34 </p>
35 </div>
36 <?php berqwp_render_toggle('berqwp_enable_used_css', get_option('berqwp_enable_used_css')); ?>
37 </div>
38 </div>
39 <div class="group-container">
40 <h3 class="berq-box-title">
41 <?php esc_html_e('Force Include', 'searchpro'); ?>
42 </h3>
43 <div class="berq-box-content">
44 <p>
45 <?php esc_html_e('Force include selectors in Used CSS. Enter regex, one per line.', 'searchpro'); ?>
46 </p>
47 <textarea name="berqwp_force_include_critical_css" cols="30" rows="10"><?php echo esc_textarea($include_critical_css_lines); ?></textarea>
48 </div>
49 </div>
50 </div>
51
52 <div class="berq-info-box berq-setting-group" style="<?php echo !$berqwp_can_use_cloud ? 'display:none!important;' : '' ?>">
53 <div class="group-container">
54 <h3 class="berq-box-title">
55 <?php esc_html_e('Generate Critical CSS', 'searchpro'); ?>
56 </h3>
57 <div class="berq-box-content berq-setting-toggle">
58 <div class="berq-option-content">
59 <p>
60 <?php esc_html_e('Extract and inline the CSS needed to render above-the-fold content instantly, then load remaining CSS based on the "CSS Delivery Method" setting.', 'searchpro'); ?>
61 </p>
62 </div>
63 <?php berqwp_render_toggle('berqwp_enable_critical_css', get_option('berqwp_enable_critical_css')); ?>
64 </div>
65 </div>
66 <div class="group-container">
67 <h3 class="berq-box-title">
68 <?php esc_html_e('Force Include', 'searchpro'); ?>
69 </h3>
70 <div class="berq-box-content">
71 <p>
72 <?php esc_html_e('Force include selectors to always include in critical CSS. Enter regex, one per line.', 'searchpro'); ?>
73 </p>
74 <textarea name="berqwp_force_include_critical_css" cols="30" rows="10"><?php echo esc_textarea($include_critical_css_lines); ?></textarea>
75 </div>
76 </div>
77 </div>
78
79 <div class="berq-info-box berq-setting-group">
80 <div class="group-container">
81 <h3 class="berq-box-title <?php echo !$berqwp_can_use_cloud ? 'cloud-exclusive' : ''; ?>">
82 <?php esc_html_e('CSS Delivery Method', 'searchpro'); ?>
83 </h3>
84 <div class="berq-box-content">
85 <p>
86 <?php esc_html_e("Choose how CSS files should load to improve page performance. Select one of the following options:", 'searchpro'); ?>
87 </p>
88 <select name="berq_css_optimization">
89 <option <?php selected( get_option('berq_css_optimization'), 'auto' ); ?> value="auto"><?php esc_html_e('Auto (According to optimization mode setting)', 'searchpro'); ?></option>
90 <option <?php selected( get_option('berq_css_optimization'), 'delay' ); ?> value="delay"><?php esc_html_e('After user interaction', 'searchpro'); ?></option>
91 <option <?php selected( get_option('berq_css_optimization'), 'asynchronous' ); ?> value="asynchronous"><?php esc_html_e('Asynchronous', 'searchpro'); ?></option>
92 <option <?php selected( get_option('berq_css_optimization'), 'disable' ); ?> value="disable"><?php esc_html_e('Disable', 'searchpro'); ?></option>
93 </select>
94 </div>
95 </div>
96
97 <div class="group-container">
98 <h3 class="berq-box-title">
99 <?php esc_html_e('Exclude CSS', 'searchpro'); ?>
100 </h3>
101 <div class="berq-box-content">
102 <p>
103 <?php esc_html_e('Enter URLs, filenames, or keywords to exclude from the CSS Delivery Method. Enter one per line.', 'searchpro'); ?>
104 </p>
105 <textarea name="berqwp_exclude_css" cols="30" rows="10"><?php echo esc_textarea($exclude_css_lines); ?></textarea>
106 </div>
107 </div>
108
109 <div class="group-container">
110 <h3 class="berq-box-title <?php echo !$berqwp_can_use_cloud ? 'cloud-exclusive' : ''; ?>">
111 <?php esc_html_e('Async Excluded Styles', 'searchpro'); ?>
112 </h3>
113 <div class="berq-box-content berq-setting-toggle">
114 <div class="berq-option-content">
115 <p>
116 <?php esc_html_e("Asynchronously load excluded styles to make them non-blocking and improve page performance.", 'searchpro'); ?>
117 </p>
118 </div>
119 <?php berqwp_render_toggle('berqwp_async_excluded_styles', get_option('berqwp_async_excluded_styles')); ?>
120 </div>
121 </div>
122 </div>
123
124 <div class="berq-info-box berq-setting-group">
125 <div class="group-container">
126 <h3 class="berq-box-title">
127 <?php esc_html_e('JavaScript Delivery Method', 'searchpro'); ?>
128 </h3>
129 <div class="berq-box-content">
130 <p>
131 <?php esc_html_e("Choose how JavaScript files should load to improve page performance. Select one of the following options:", 'searchpro'); ?>
132 </p>
133 <select name="berq_js_optimization">
134 <option <?php selected( get_option('berq_js_optimization'), 'auto' ); ?> value="auto"><?php esc_html_e('Auto (According to optimization mode setting)', 'searchpro'); ?></option>
135 <option <?php selected( get_option('berq_js_optimization'), 'delay' ); ?> value="delay"><?php esc_html_e('After user interaction', 'searchpro'); ?></option>
136 <option <?php selected( get_option('berq_js_optimization'), 'asynchronous' ); ?> value="asynchronous"><?php esc_html_e('Asynchronous', 'searchpro'); ?></option>
137 <option <?php selected( get_option('berq_js_optimization'), 'defer' ); ?> value="defer"><?php esc_html_e('Defer', 'searchpro'); ?></option>
138 <option <?php selected( get_option('berq_js_optimization'), 'disable' ); ?> value="disable"><?php esc_html_e('Disable', 'searchpro'); ?></option>
139 </select>
140 </div>
141 </div>
142
143 <div class="group-container">
144 <h3 class="berq-box-title">
145 <?php esc_html_e('Exclude JavaScript', 'searchpro'); ?>
146 </h3>
147 <div class="berq-box-content">
148 <p>
149 <?php esc_html_e('Enter URLs, filenames, or keywords to exclude from the JavaScript Delivery Method. Enter one per line.', 'searchpro'); ?>
150 </p>
151 <textarea name="berqwp_exclude_js" cols="30" rows="10"><?php echo esc_textarea($exclude_js_lines); ?></textarea>
152 </div>
153 </div>
154
155 <div class="group-container">
156 <h3 class="berq-box-title">
157 <?php esc_html_e('Defer Excluded JavaScript', 'searchpro'); ?>
158 </h3>
159 <div class="berq-box-content berq-setting-toggle">
160 <div class="berq-option-content">
161 <p>
162 <?php esc_html_e("Defer excluded scripts to make them non-blocking and improve page performance.", 'searchpro'); ?>
163 </p>
164 </div>
165 <?php berqwp_render_toggle('berqwp_defer_excluded_js', get_option('berqwp_defer_excluded_js')); ?>
166 </div>
167 </div>
168
169 <div class="group-container">
170 <h3 class="berq-box-title <?php echo !$berqwp_can_use_cloud ? 'cloud-exclusive' : ''; ?>">
171 <?php esc_html_e('JavaScript Execution Mode', 'searchpro'); ?>
172 </h3>
173 <div class="berq-box-content">
174 <p>
175 <?php printf( /* translators: %s: Plugin name */ esc_html__('%s offers different JavaScript optimization modes, so every JavaScript-heavy website can unlock its true potential.', 'searchpro'), esc_html($plugin_name) ); ?>
176 </p>
177 <label class="berq-check">
178 <input type="radio" name="berqwp_javascript_execution_mode" value="5" <?php echo get_option('berqwp_javascript_execution_mode') == 5 ? 'checked' : ''; ?>>
179 <?php esc_html_e('Flora v2 - High Compatibility', 'searchpro'); ?>
180 </label>
181 <label class="berq-check">
182 <input type="radio" name="berqwp_javascript_execution_mode" value="4" <?php echo get_option('berqwp_javascript_execution_mode') == 4 ? 'checked' : ''; ?>>
183 <?php esc_html_e('Flora - High Compatibility (Default)', 'searchpro'); ?>
184 </label>
185 <label class="berq-check">
186 <input type="radio" name="berqwp_javascript_execution_mode" value="1" <?php echo get_option('berqwp_javascript_execution_mode') == 1 ? 'checked' : ''; ?>>
187 <?php esc_html_e('Sequential Blocking Execution - High Compatibility', 'searchpro'); ?>
188 </label>
189 <label class="berq-check">
190 <input type="radio" name="berqwp_javascript_execution_mode" value="3" <?php echo get_option('berqwp_javascript_execution_mode') == 3 ? 'checked' : ''; ?>>
191 <?php esc_html_e('Parallel Execution - High Compatibility', 'searchpro'); ?>
192 </label>
193 <label class="berq-check">
194 <input type="radio" name="berqwp_javascript_execution_mode" value="0" <?php echo get_option('berqwp_javascript_execution_mode') == 0 ? 'checked' : ''; ?>>
195 <?php esc_html_e('Sequential Execution', 'searchpro'); ?>
196 </label>
197 </div>
198 </div>
199
200 </div>
201 <div class="berq-info-box berq-setting-group">
202
203 <div class="group-container">
204 <h3 class="berq-box-title">
205 <?php esc_html_e('Delay Third-Party Scripts', 'searchpro'); ?>
206 </h3>
207 <div class="berq-box-content berq-setting-toggle">
208 <div class="berq-option-content">
209 <p>
210 <?php esc_html_e("Load third-party scripts only after user interaction to reduce initial page load time.", 'searchpro'); ?>
211 </p>
212 </div>
213 <?php berqwp_render_toggle('berqwp_delay_third_party_scripts', get_option('berqwp_delay_third_party_scripts')); ?>
214 </div>
215 </div>
216
217 <div class="group-container">
218 <h3 class="berq-box-title">
219 <?php esc_html_e('Exclude Third-Party Scripts', 'searchpro'); ?>
220 </h3>
221 <div class="berq-box-content">
222 <p>
223 <?php esc_html_e('Enter URLs, filenames, or keywords to exclude from the Delay Third-Party Scripts. Enter one per line.', 'searchpro'); ?>
224 </p>
225 <textarea name="berqwp_exclude_third_party_js" cols="30" rows="10"><?php echo esc_textarea($exclude_third_party_js_lines); ?></textarea>
226 </div>
227 </div>
228
229 </div>
230 <div class="berq-info-box berq-setting-group">
231
232 <div class="group-container">
233 <h3 class="berq-box-title <?php echo !$berqwp_can_use_cloud ? 'cloud-exclusive' : ''; ?>">
234 <?php esc_html_e('Preload Font Faces', 'searchpro'); ?>
235 </h3>
236 <div class="berq-box-content berq-setting-toggle">
237 <div class="berq-option-content">
238 <p>
239 <?php esc_html_e("Preload font faces along with the critical CSS upon the initial page load.", 'searchpro'); ?>
240 </p>
241 </div>
242 <?php berqwp_render_toggle('berqwp_preload_fontfaces', get_option('berqwp_preload_fontfaces')); ?>
243 </div>
244 </div>
245 <div class="group-container">
246 <h3 class="berq-box-title <?php echo !$berqwp_can_use_cloud ? 'cloud-exclusive' : ''; ?>">
247 <?php esc_html_e('Preload Cookie Banner', 'searchpro'); ?>
248 </h3>
249 <div class="berq-box-content berq-setting-toggle">
250 <div class="berq-option-content">
251 <p>
252 <?php esc_html_e("Preload the cookie banner on the initial page load, may sometimes cause a drop in the PageSpeed score. Currently supports Complianz, CookieYes, Real Cookie Banner, CYTRIO, GetTerms and My Agile Privacy. ", 'searchpro'); ?>
253 </p>
254 </div>
255 <?php berqwp_render_toggle('berqwp_preload_cookiebanner', get_option('berqwp_preload_cookiebanner')); ?>
256 </div>
257 </div>
258 <div class="group-container">
259 <h3 class="berq-box-title">
260 <?php esc_html_e('Prerender Page on Link Hover', 'searchpro'); ?>
261 </h3>
262 <div class="berq-box-content berq-setting-toggle">
263 <div class="berq-option-content">
264 <p>
265 <?php esc_html_e("Prerender the page using the browser's Speculation Rules API when a user hovers over a link, so it loads instantly on click.", 'searchpro'); ?>
266 </p>
267 </div>
268 <?php berqwp_render_toggle('berqwp_prerender_on_hover', get_option('berqwp_prerender_on_hover')); ?>
269 </div>
270 </div>
271
272 </div>
273 <div class="berq-info-box berq-setting-group">
274
275 <div class="group-container">
276 <h3 class="berq-box-title <?php echo !$berqwp_can_use_cloud ? 'cloud-exclusive' : ''; ?>">
277 <?php esc_html_e('Lazy Render Below the Fold', 'searchpro'); ?>
278 </h3>
279 <div class="berq-box-content berq-setting-toggle">
280 <div class="berq-option-content">
281 <p>
282 <?php esc_html_e("Defer rendering of below-the-fold content using the CSS content-visibility property for faster initial page load.", 'searchpro'); ?>
283 </p>
284 </div>
285 <?php berqwp_render_toggle('berqwp_lazy_render', get_option('berqwp_lazy_render')); ?>
286 </div>
287 </div>
288
289 </div>
290
291 <button type="submit" class="berqwp-save"><svg width="20" height="20" viewBox="0 0 20 20" fill="none"
292 xmlns="http://www.w3.org/2000/svg">
293 <path d="M4.16663 10.8333L7.49996 14.1667L15.8333 5.83334" stroke="white" stroke-width="2"
294 stroke-linecap="round" stroke-linejoin="round" />
295 </svg>
296 <?php esc_html_e("Save changes", "searchpro"); ?></button>
297 </div>
298