PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 4.1.18
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v4.1.18
4.1.19 4.1.18 4.1.17 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 All 173 releases
← All changes | inc/photon/class-berqPageOptimizer.php +16 -7 4.0.23 → 4.1.18 View file →
@@ -7,8 +7,9 @@
7 7 class berqPageOptimizer {
8 8 public $page_slug = null;
9 9 public $page_url = null;
10 10 public $settings = null;
11 + public $early_head_html = '';
11 12
12 13 function __construct() {
13 14
14 15 if ($this->settings === null) {
@@ -1192,9 +1193,9 @@
1192 1193
1193 1194 function store_cache($buffer) {
1194 1195 // Define the cache directory
1195 1196 $cache_directory = bwp_get_cache_dir();
1196 - $url = $this->page_url;
1197 + $url = bwp_canonicalize_page_url($this->page_url);
1197 1198
1198 1199 // Create the cache directory if it doesn't exist
1199 1200 if (!file_exists($cache_directory)) {
1200 1201 mkdir($cache_directory, 0755, true);
@@ -1337,9 +1338,10 @@
1337 1338
1338 1339 $prelaod_html .= '>'.PHP_EOL;
1339 1340 }
1340 1341
1341 - $buffer = berqwp_prependHtmlToHead($buffer, $prelaod_html);
1342 + /* $buffer = berqwp_prependHtmlToHead($buffer, $prelaod_html); */
1343 + $this->early_head_html .= $preload_html;
1342 1344
1343 1345 }
1344 1346
1345 1347
@@ -1516,9 +1518,9 @@
1516 1518 $buffer = $this->lazy_load_videos($buffer);
1517 1519 }
1518 1520
1519 1521 if ($this->settings['youtube_lazyloading']) {
1520 - $buffer = $this->lazy_load_iframes($buffer);
1522 + // $buffer = $this->lazy_load_iframes($buffer);
1521 1523 }
1522 1524
1523 1525 if ($this->settings['css_optimization'] == 'auto') {
1524 1526 if ($this->settings['opt_mode'] == 'basic') {
@@ -1537,21 +1539,28 @@
1537 1539 $this->settings['css_optimization'] = 'delay';
1538 1540 }
1539 1541 }
1540 1542
1541 - $enable_critical_css = (bool) apply_filters('berqwp_local_critical_css', false);
1543 + $enable_used_css = (bool) apply_filters(
1544 + 'berqwp_local_used_css',
1545 + apply_filters('berqwp_local_critical_css', (bool) get_option('berqwp_enable_used_css'))
1546 + );
1542 1547
1543 - if ($enable_critical_css && $this->settings['css_optimization'] !== 'disable') {
1548 + // $enable_used_css = false; // disable
1549 +
1550 + if ($enable_used_css && $this->settings['css_optimization'] !== 'disable') {
1544 1551 $critical_css = new berqUsedCSS(get_option('home'));
1545 1552 $critical_css->forceInclude($this->settings['force_include_critical_css']);
1546 1553 $critical_css = $critical_css->process_css($buffer);
1547 - $critical_css = sprintf('<style data-berqwp-exclude id="berqwp-critical-css">%s</style>', $critical_css);
1554 + $critical_css = sprintf('<style data-berqwp-exclude id="berqwp-used-css">%s</style>', $critical_css);
1548 1555
1549 - $buffer = berqwp_prependHtmlToHead($buffer, $critical_css);
1556 + /* $buffer = berqwp_prependHtmlToHead($buffer, $critical_css); */
1557 + $this->early_head_html .= $critical_css;
1550 1558 $buffer = $this->delay_styles($buffer);
1551 1559
1552 1560 }
1553 1561
1562 + $buffer = berqwp_earlyHeadHtml($buffer, $this->early_head_html);
1554 1563
1555 1564 $buffer = $this->restore_template_scripts( $buffer, $template_placeholders );
1556 1565
1557 1566 $script = apply_filters('berqwp_photon_before_closing_body', $script);