| 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 |
<?php if (!$berqwp_can_use_cloud): ?> |
| 25 |
<div class="berq-info-box berq-setting-group"> |
| 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 |
<?php else: ?> |
| 52 |
<div class="berq-info-box berq-setting-group"> |
| 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 |
<?php endif; ?> |
| 79 |
|
| 80 |
<div class="berq-info-box berq-setting-group"> |
| 81 |
<div class="group-container"> |
| 82 |
<h3 class="berq-box-title <?php echo !$berqwp_can_use_cloud ? 'cloud-exclusive' : ''; ?>"> |
| 83 |
<?php esc_html_e('CSS Delivery Method', 'searchpro'); ?> |
| 84 |
</h3> |
| 85 |
<div class="berq-box-content"> |
| 86 |
<p> |
| 87 |
<?php esc_html_e("Choose how CSS files should load to improve page performance. Select one of the following options:", 'searchpro'); ?> |
| 88 |
</p> |
| 89 |
<select name="berq_css_optimization"> |
| 90 |
<option <?php selected( get_option('berq_css_optimization'), 'auto' ); ?> value="auto"><?php esc_html_e('Auto (According to optimization mode setting)', 'searchpro'); ?></option> |
| 91 |
<option <?php selected( get_option('berq_css_optimization'), 'delay' ); ?> value="delay"><?php esc_html_e('After user interaction', 'searchpro'); ?></option> |
| 92 |
<option <?php selected( get_option('berq_css_optimization'), 'asynchronous' ); ?> value="asynchronous"><?php esc_html_e('Asynchronous', 'searchpro'); ?></option> |
| 93 |
<option <?php selected( get_option('berq_css_optimization'), 'disable' ); ?> value="disable"><?php esc_html_e('Disable', 'searchpro'); ?></option> |
| 94 |
</select> |
| 95 |
</div> |
| 96 |
</div> |
| 97 |
|
| 98 |
<div class="group-container"> |
| 99 |
<h3 class="berq-box-title"> |
| 100 |
<?php esc_html_e('Exclude CSS', 'searchpro'); ?> |
| 101 |
</h3> |
| 102 |
<div class="berq-box-content"> |
| 103 |
<p> |
| 104 |
<?php esc_html_e('Enter URLs, filenames, or keywords to exclude from the CSS Delivery Method. Enter one per line.', 'searchpro'); ?> |
| 105 |
</p> |
| 106 |
<textarea name="berqwp_exclude_css" cols="30" rows="10"><?php echo esc_textarea($exclude_css_lines); ?></textarea> |
| 107 |
</div> |
| 108 |
</div> |
| 109 |
|
| 110 |
<div class="group-container"> |
| 111 |
<h3 class="berq-box-title <?php echo !$berqwp_can_use_cloud ? 'cloud-exclusive' : ''; ?>"> |
| 112 |
<?php esc_html_e('Async Excluded Styles', 'searchpro'); ?> |
| 113 |
</h3> |
| 114 |
<div class="berq-box-content berq-setting-toggle"> |
| 115 |
<div class="berq-option-content"> |
| 116 |
<p> |
| 117 |
<?php esc_html_e("Asynchronously load excluded styles to make them non-blocking and improve page performance.", 'searchpro'); ?> |
| 118 |
</p> |
| 119 |
</div> |
| 120 |
<?php berqwp_render_toggle('berqwp_async_excluded_styles', get_option('berqwp_async_excluded_styles')); ?> |
| 121 |
</div> |
| 122 |
</div> |
| 123 |
</div> |
| 124 |
|
| 125 |
<div class="berq-info-box berq-setting-group"> |
| 126 |
<div class="group-container"> |
| 127 |
<h3 class="berq-box-title"> |
| 128 |
<?php esc_html_e('JavaScript Delivery Method', 'searchpro'); ?> |
| 129 |
</h3> |
| 130 |
<div class="berq-box-content"> |
| 131 |
<p> |
| 132 |
<?php esc_html_e("Choose how JavaScript files should load to improve page performance. Select one of the following options:", 'searchpro'); ?> |
| 133 |
</p> |
| 134 |
<select name="berq_js_optimization"> |
| 135 |
<option <?php selected( get_option('berq_js_optimization'), 'auto' ); ?> value="auto"><?php esc_html_e('Auto (According to optimization mode setting)', 'searchpro'); ?></option> |
| 136 |
<option <?php selected( get_option('berq_js_optimization'), 'delay' ); ?> value="delay"><?php esc_html_e('After user interaction', 'searchpro'); ?></option> |
| 137 |
<option <?php selected( get_option('berq_js_optimization'), 'asynchronous' ); ?> value="asynchronous"><?php esc_html_e('Asynchronous', 'searchpro'); ?></option> |
| 138 |
<option <?php selected( get_option('berq_js_optimization'), 'defer' ); ?> value="defer"><?php esc_html_e('Defer', 'searchpro'); ?></option> |
| 139 |
<option <?php selected( get_option('berq_js_optimization'), 'disable' ); ?> value="disable"><?php esc_html_e('Disable', 'searchpro'); ?></option> |
| 140 |
</select> |
| 141 |
</div> |
| 142 |
</div> |
| 143 |
|
| 144 |
<div class="group-container"> |
| 145 |
<h3 class="berq-box-title"> |
| 146 |
<?php esc_html_e('Exclude JavaScript', 'searchpro'); ?> |
| 147 |
</h3> |
| 148 |
<div class="berq-box-content"> |
| 149 |
<p> |
| 150 |
<?php esc_html_e('Enter URLs, filenames, or keywords to exclude from the JavaScript Delivery Method. Enter one per line.', 'searchpro'); ?> |
| 151 |
</p> |
| 152 |
<textarea name="berqwp_exclude_js" cols="30" rows="10"><?php echo esc_textarea($exclude_js_lines); ?></textarea> |
| 153 |
</div> |
| 154 |
</div> |
| 155 |
|
| 156 |
<div class="group-container"> |
| 157 |
<h3 class="berq-box-title"> |
| 158 |
<?php esc_html_e('Defer Excluded JavaScript', 'searchpro'); ?> |
| 159 |
</h3> |
| 160 |
<div class="berq-box-content berq-setting-toggle"> |
| 161 |
<div class="berq-option-content"> |
| 162 |
<p> |
| 163 |
<?php esc_html_e("Defer excluded scripts to make them non-blocking and improve page performance.", 'searchpro'); ?> |
| 164 |
</p> |
| 165 |
</div> |
| 166 |
<?php berqwp_render_toggle('berqwp_defer_excluded_js', get_option('berqwp_defer_excluded_js')); ?> |
| 167 |
</div> |
| 168 |
</div> |
| 169 |
|
| 170 |
<div class="group-container"> |
| 171 |
<h3 class="berq-box-title <?php echo !$berqwp_can_use_cloud ? 'cloud-exclusive' : ''; ?>"> |
| 172 |
<?php esc_html_e('JavaScript Execution Mode', 'searchpro'); ?> |
| 173 |
</h3> |
| 174 |
<div class="berq-box-content"> |
| 175 |
<p> |
| 176 |
<?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) ); ?> |
| 177 |
</p> |
| 178 |
<label class="berq-check"> |
| 179 |
<input type="radio" name="berqwp_javascript_execution_mode" value="4" <?php echo get_option('berqwp_javascript_execution_mode') == 4 ? 'checked' : ''; ?>> |
| 180 |
<?php esc_html_e('Flora - High Compatibility (Default)', 'searchpro'); ?> |
| 181 |
</label> |
| 182 |
<label class="berq-check"> |
| 183 |
<input type="radio" name="berqwp_javascript_execution_mode" value="1" <?php echo get_option('berqwp_javascript_execution_mode') == 1 ? 'checked' : ''; ?>> |
| 184 |
<?php esc_html_e('Sequential Blocking Execution - High Compatibility', 'searchpro'); ?> |
| 185 |
</label> |
| 186 |
<label class="berq-check"> |
| 187 |
<input type="radio" name="berqwp_javascript_execution_mode" value="3" <?php echo get_option('berqwp_javascript_execution_mode') == 3 ? 'checked' : ''; ?>> |
| 188 |
<?php esc_html_e('Parallel Execution - High Compatibility', 'searchpro'); ?> |
| 189 |
</label> |
| 190 |
<label class="berq-check"> |
| 191 |
<input type="radio" name="berqwp_javascript_execution_mode" value="0" <?php echo get_option('berqwp_javascript_execution_mode') == 0 ? 'checked' : ''; ?>> |
| 192 |
<?php esc_html_e('Sequential Execution', 'searchpro'); ?> |
| 193 |
</label> |
| 194 |
</div> |
| 195 |
</div> |
| 196 |
|
| 197 |
</div> |
| 198 |
<div class="berq-info-box berq-setting-group"> |
| 199 |
|
| 200 |
<div class="group-container"> |
| 201 |
<h3 class="berq-box-title"> |
| 202 |
<?php esc_html_e('Delay Third-Party Scripts', 'searchpro'); ?> |
| 203 |
</h3> |
| 204 |
<div class="berq-box-content berq-setting-toggle"> |
| 205 |
<div class="berq-option-content"> |
| 206 |
<p> |
| 207 |
<?php esc_html_e("Load third-party scripts only after user interaction to reduce initial page load time.", 'searchpro'); ?> |
| 208 |
</p> |
| 209 |
</div> |
| 210 |
<?php berqwp_render_toggle('berqwp_delay_third_party_scripts', get_option('berqwp_delay_third_party_scripts')); ?> |
| 211 |
</div> |
| 212 |
</div> |
| 213 |
|
| 214 |
<div class="group-container"> |
| 215 |
<h3 class="berq-box-title"> |
| 216 |
<?php esc_html_e('Exclude Third-Party Scripts', 'searchpro'); ?> |
| 217 |
</h3> |
| 218 |
<div class="berq-box-content"> |
| 219 |
<p> |
| 220 |
<?php esc_html_e('Enter URLs, filenames, or keywords to exclude from the Delay Third-Party Scripts. Enter one per line.', 'searchpro'); ?> |
| 221 |
</p> |
| 222 |
<textarea name="berqwp_exclude_third_party_js" cols="30" rows="10"><?php echo esc_textarea($exclude_third_party_js_lines); ?></textarea> |
| 223 |
</div> |
| 224 |
</div> |
| 225 |
|
| 226 |
</div> |
| 227 |
<div class="berq-info-box berq-setting-group"> |
| 228 |
|
| 229 |
<div class="group-container"> |
| 230 |
<h3 class="berq-box-title <?php echo !$berqwp_can_use_cloud ? 'cloud-exclusive' : ''; ?>"> |
| 231 |
<?php esc_html_e('Preload Font Faces', 'searchpro'); ?> |
| 232 |
</h3> |
| 233 |
<div class="berq-box-content berq-setting-toggle"> |
| 234 |
<div class="berq-option-content"> |
| 235 |
<p> |
| 236 |
<?php esc_html_e("Preload font faces along with the critical CSS upon the initial page load.", 'searchpro'); ?> |
| 237 |
</p> |
| 238 |
</div> |
| 239 |
<?php berqwp_render_toggle('berqwp_preload_fontfaces', get_option('berqwp_preload_fontfaces')); ?> |
| 240 |
</div> |
| 241 |
</div> |
| 242 |
<div class="group-container"> |
| 243 |
<h3 class="berq-box-title <?php echo !$berqwp_can_use_cloud ? 'cloud-exclusive' : ''; ?>"> |
| 244 |
<?php esc_html_e('Preload Cookie Banner', 'searchpro'); ?> |
| 245 |
</h3> |
| 246 |
<div class="berq-box-content berq-setting-toggle"> |
| 247 |
<div class="berq-option-content"> |
| 248 |
<p> |
| 249 |
<?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'); ?> |
| 250 |
</p> |
| 251 |
</div> |
| 252 |
<?php berqwp_render_toggle('berqwp_preload_cookiebanner', get_option('berqwp_preload_cookiebanner')); ?> |
| 253 |
</div> |
| 254 |
</div> |
| 255 |
<div class="group-container"> |
| 256 |
<h3 class="berq-box-title"> |
| 257 |
<?php esc_html_e('Prerender Page on Link Hover', 'searchpro'); ?> |
| 258 |
</h3> |
| 259 |
<div class="berq-box-content berq-setting-toggle"> |
| 260 |
<div class="berq-option-content"> |
| 261 |
<p> |
| 262 |
<?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'); ?> |
| 263 |
</p> |
| 264 |
</div> |
| 265 |
<?php berqwp_render_toggle('berqwp_prerender_on_hover', get_option('berqwp_prerender_on_hover')); ?> |
| 266 |
</div> |
| 267 |
</div> |
| 268 |
|
| 269 |
</div> |
| 270 |
<div class="berq-info-box berq-setting-group"> |
| 271 |
|
| 272 |
<div class="group-container"> |
| 273 |
<h3 class="berq-box-title <?php echo !$berqwp_can_use_cloud ? 'cloud-exclusive' : ''; ?>"> |
| 274 |
<?php esc_html_e('Lazy Render Below the Fold', 'searchpro'); ?> |
| 275 |
</h3> |
| 276 |
<div class="berq-box-content berq-setting-toggle"> |
| 277 |
<div class="berq-option-content"> |
| 278 |
<p> |
| 279 |
<?php esc_html_e("Defer rendering of below-the-fold content using the CSS content-visibility property for faster initial page load.", 'searchpro'); ?> |
| 280 |
</p> |
| 281 |
</div> |
| 282 |
<?php berqwp_render_toggle('berqwp_lazy_render', get_option('berqwp_lazy_render')); ?> |
| 283 |
</div> |
| 284 |
</div> |
| 285 |
|
| 286 |
</div> |
| 287 |
|
| 288 |
<button type="submit" class="berqwp-save"><svg width="20" height="20" viewBox="0 0 20 20" fill="none" |
| 289 |
xmlns="http://www.w3.org/2000/svg"> |
| 290 |
<path d="M4.16663 10.8333L7.49996 14.1667L15.8333 5.83334" stroke="white" stroke-width="2" |
| 291 |
stroke-linecap="round" stroke-linejoin="round" /> |
| 292 |
</svg> |
| 293 |
<?php esc_html_e("Save changes", "searchpro"); ?></button> |
| 294 |
</div> |
| 295 |
|