Plugin Directory

Changeset 3783146


Ignore:
Timestamp:
11/04/2026 06:00:41 AM (4 days ago)
Author:
kanhajatthap
Message:

Tagging version 1.5.4 - Overhaul CSS combine engine, WPBakery hero background LCP preloading, font-display swap on external styles, preloader WebP warming, and auto-restart cache warming on clear

Location:
fastlayer
Files:
26 added
9 edited

Legend:

Unmodified
Added
Removed
  • fastlayer/trunk/assets/js/admin.js

    r3781439 r3783146  
    45714571                    if (res && res.success) {
    45724572                        if (typeof window.wpflShowToast === 'function') {
    4573                             window.wpflShowToast('Cache Purged', 'All static HTML cache files have been cleared.');
     4573                            window.wpflShowToast('Cache Cleared & Auto-Warming Started', 'All cache files cleared and background warming has automatically started.');
    45744574                        }
    45754575                        if ($kpiCached.length) $kpiCached.text('0');
    45764576                        if ($kpiSize.length) $kpiSize.text('0 B');
    4577                         if ($progressBar.length) $progressBar.css('width', '0%');
    4578                         if ($pctLabel.length) $pctLabel.text('0%');
    4579                         if ($coverageLabel.length) $coverageLabel.text('0% Cache Coverage');
    4580                         $badge.attr('class', 'wpfl-warmup-status-badge is-idle');
    4581                         $statusText.text('Idle / Ready to Warm');
     4577                        if ($progressBar.length) $progressBar.css('width', '5%');
     4578                        if ($pctLabel.length) $pctLabel.text('Starting...');
     4579                        if ($coverageLabel.length) $coverageLabel.text('Warming Starting...');
     4580                        $badge.attr('class', 'wpfl-warmup-status-badge is-warming');
     4581                        $statusText.text('Warming Pages Live...');
     4582                        if ($startBtn.length) {
     4583                            $startBtn.prop('disabled', true);
     4584                            $startText.text('Warming in Progress...');
     4585                        }
     4586                        $headline.text('Background Preload Warming In Progress');
     4587                        $desc.text('Cache cleared. Warming discovered URLs automatically in the background.');
    45824588                        $('.wpfl-badge-cached').removeClass('wpfl-badge-cached').addClass('wpfl-badge-pending').html('<span class="dashicons dashicons-marker"></span> Pending');
     4589                        startPolling();
    45834590                    }
    45844591                }).fail(function () {
  • fastlayer/trunk/includes/class-admin-bar.php

    r3781222 r3783146  
    406406
    407407        private function process_clear_all_cache( $redirect_to ) {
     408                $this->clear_preload_cache_artifacts();
     409                $this->clear_assets_cache();
    408410                $this->clear_page_cache();
    409                 $this->clear_assets_cache();
    410                 $this->clear_preload_cache_artifacts();
    411411
    412412                if ( function_exists( 'delete_transient' ) ) {
  • fastlayer/trunk/includes/class-admin.php

    r3783103 r3783146  
    17251725                $this->log_cache_clear( 'Cache clear started.', $cache_stats_before );
    17261726
    1727                 $invalidation = Page_Cache::get_instance();
     1727                $preload_stats = $this->clear_preload_cache_artifacts();
     1728                $minify_stats  = $this->clear_minify_cache();
     1729                $invalidation  = Page_Cache::get_instance();
    17281730                $invalidation->clear_all_cache();
    1729                 $minify_stats  = $this->clear_minify_cache();
    1730                 $preload_stats = $this->clear_preload_cache_artifacts();
    17311731
    17321732                if ( function_exists( 'delete_transient' ) ) {
    … …  
    18381838                $this->log_cache_clear( 'AJAX Cache clear started.', $cache_stats_before );
    18391839
    1840                 $invalidation = Page_Cache::get_instance();
     1840                $preload_stats = $this->clear_preload_cache_artifacts();
     1841                $minify_stats  = $this->clear_minify_cache();
     1842                $invalidation  = Page_Cache::get_instance();
    18411843                $invalidation->clear_all_cache();
    1842                 $minify_stats  = $this->clear_minify_cache();
    1843                 $preload_stats = $this->clear_preload_cache_artifacts();
    18441844
    18451845                if ( function_exists( 'delete_transient' ) ) {
  • fastlayer/trunk/includes/class-cdn.php

    r3781222 r3783146  
    14831483                }
    14841484
     1485                if ( $this->is_lcp_preload_enabled() && ! empty( $this->lcp_candidate['preload_url'] ) && false !== stripos( $html, '</head>' ) && false === strpos( $html, 'data-wpfl-lcp="1"' ) ) {
     1486                        $preload_url = esc_url( Bootstrap::set_url_scheme( (string) $this->lcp_candidate['preload_url'] ) );
     1487                        if ( '' !== $preload_url ) {
     1488                                if ( class_exists( __NAMESPACE__ . '\\Webp' ) ) {
     1489                                        $webp_candidate = Webp::get_instance()->get_webp_url_for_image_url( $preload_url );
     1490                                        if ( ! empty( $webp_candidate ) ) {
     1491                                                $preload_url = esc_url( $webp_candidate );
     1492                                        }
     1493                                }
     1494
     1495                                $preload_tag = '<link rel="preload" as="image" href="' . esc_attr( $preload_url ) . '" fetchpriority="high" data-wpfl-lcp="1"';
     1496                                if ( ! empty( $this->lcp_candidate['is_img'] ) ) {
     1497                                        if ( ! empty( $this->lcp_candidate['srcset'] ) ) {
     1498                                                $preload_tag .= ' imagesrcset="' . esc_attr( (string) $this->lcp_candidate['srcset'] ) . '"';
     1499                                        }
     1500                                        if ( ! empty( $this->lcp_candidate['sizes'] ) ) {
     1501                                                $preload_tag .= ' imagesizes="' . esc_attr( (string) $this->lcp_candidate['sizes'] ) . '"';
     1502                                        }
     1503                                }
     1504                                $preload_tag .= " />\n";
     1505
     1506                                $html                                   = preg_replace( '/<\/head>/i', $preload_tag . '</head>', $html, 1 );
     1507                                $this->lcp_candidate['preload_applied'] = true;
     1508                                $this->debug_lcp_log( 'preload_applied', array( 'preload_url' => $preload_url ) );
     1509                        }
     1510                }
     1511
    14851512                $this->persist_lcp_report();
     1513
     1514                return $html;
     1515        }
     1516
     1517        public function optimize_full_page_html( $html ) {
     1518                if ( ! is_string( $html ) || '' === $html ) {
     1519                        return $html;
     1520                }
     1521
     1522                if ( $this->is_smart_lcp_enabled() ) {
     1523                        $html = $this->apply_smart_lcp_optimization_to_html( $html );
     1524                }
    14861525
    14871526                return $html;
    … …  
    14931532                }
    14941533
    1495                 if ( ! preg_match_all( '#<(?:section|div)[^>]+>#i', $html, $blocks ) ) {
     1534                // 1. WPBakery / Visual Composer style blocks: .vc_custom_XXXXX { background-image: url(...) }
     1535                if ( preg_match( '/\.(vc_custom_\d+)\s*\{[^}]*?background(?:-image)?\s*:\s*url\((?:"|\')?([^"\')]+)(?:"|\')?\)/i', $html, $vc_match ) ) {
     1536                        $vc_class = $vc_match[1];
     1537                        $vc_url   = trim( html_entity_decode( (string) $vc_match[2], ENT_QUOTES, 'UTF-8' ) );
     1538                        if ( '' !== $vc_url && false !== strpos( $html, $vc_class ) && $this->is_local_image_url( $vc_url ) ) {
     1539                                return array(
     1540                                        'url'             => $vc_url,
     1541                                        'preload_url'     => $vc_url,
     1542                                        'source'          => 'hero_background_wpbakery',
     1543                                        'type'            => 'background-image',
     1544                                        'score'           => 350,
     1545                                        'is_background'   => true,
     1546                                        'preload_applied' => false,
     1547                                );
     1548                        }
     1549                }
     1550
     1551                if ( ! preg_match_all( '#<(?:section|div|header)[^>]+>#i', $html, $blocks ) ) {
    14961552                        return null;
    14971553                }
    … …  
    15031559
    15041560                        $class_id = strtolower( (string) $class_match[1] );
    1505                         if ( ! preg_match( '/hero|banner|cta|featured|elementor-top-section|elementor-section/i', $class_id ) ) {
     1561                        if ( ! preg_match( '/hero|banner|cta|featured|elementor-top-section|elementor-section|vc_row|wpb_row|wp-block-cover|masthead|header|intro/i', $class_id ) ) {
    15061562                                continue;
    15071563                        }
    … …  
    15151571                                                'source'          => 'hero_background',
    15161572                                                'type'            => 'background-image',
    1517                                                 'score'           => 75,
     1573                                                'score'           => 350,
    15181574                                                'is_background'   => true,
    15191575                                                'preload_applied' => false,
  • fastlayer/trunk/includes/class-optimizer.php

    r3783106 r3783146  
    11521152                        // condition and RTL variants (extra['rtl']) would be served to the
    11531153                        // wrong direction.
    1154                         if ( ! empty( $style->extra ) ) {
     1154                        if ( ! empty( $style->extra['conditional'] ) || ! empty( $style->extra['rtl'] ) || ! empty( $style->extra['alt'] ) ) {
    11551155                                continue;
    11561156                        }
    … …  
    15451545
    15461546                $checks = array(
    1547                         '/@font-face\s*\{/i',
    1548                         '/::?(before|after)\b/i',
    15491547                        '/content\s*:\s*["\']\\[0-9a-f]{2,6}["\']/i',
    1550                         '/font-family\s*:\s*["\']?(?:material\s*icons|material\s*symbols|font\s*awesome|fontawesome|eicons?|elementor-icons|dashicons|glyphicons|mdi|icon)["\']?/i',
    1551                         '/\.(?:fa-[\w-]+|eicon-[\w-]+|mdi-[\w-]+)\b/i',
    1552                         '/url\([^)]*\.(?:woff2?|ttf|otf)(?:[?#][^)]*)?\)/i',
     1548                        '/font-family\s*:\s*["\']?(?:material\s*icons|material\s*symbols|font\s*awesome|fontawesome|eicons?|elementor-icons|dashicons|glyphicons|elegant-icons|ionicons|icomoon|linearicons|simple-line-icons|mdi|icon)["\']?/i',
     1549                        '/\.(?:fa-[\w-]+|eicon-[\w-]+|mdi-[\w-]+|dashicons-[\w-]+|icon-[\w-]+)\b/i',
     1550                        '/url\([^)]*(?:font-?awesome|ionicons|elegant-?icons|dashicons|material-icons|icomoon|glyphicons|eicons)[^)]*\.(?:woff2?|ttf|otf|eot)(?:[?#][^)]*)?\)/i',
    15531551                );
    15541552
    … …  
    28972895                }
    28982896
     2897                if ( class_exists( __NAMESPACE__ . '\\CDN' ) ) {
     2898                        $restored = CDN::get_instance()->optimize_full_page_html( $restored );
     2899                }
     2900
    28992901                return $restored;
    29002902        }
    … …  
    31613163                        $css = str_replace( $placeholder, $replacement, $css );
    31623164                }
     3165
     3166                $css = $this->maybe_inject_font_display_swap( $css );
    31633167
    31643168                return ( '' === trim( $css ) ) ? $original : trim( $css );
  • fastlayer/trunk/includes/class-page-cache.php

    r3783106 r3783146  
    13601360                if ( ! is_dir( $this->cache_dir ) ) {
    13611361                        $this->purge_third_party_host_caches();
     1362                        if ( $this->is_preload_enabled() ) {
     1363                                $this->release_preload_lock();
     1364                                $this->release_preload_batch_lock();
     1365                                $this->preload_cache( 'clear_all_cache' );
     1366                                $this->spawn_async_preload_worker();
     1367                        }
    13621368                        return;
    13631369                }
    … …  
    13711377
    13721378                $this->purge_third_party_host_caches();
     1379
     1380                if ( $this->is_preload_enabled() ) {
     1381                        $this->release_preload_lock();
     1382                        $this->release_preload_batch_lock();
     1383                        $this->preload_cache( 'clear_all_cache' );
     1384                        $this->spawn_async_preload_worker();
     1385                }
    13731386        }
    13741387
    … …  
    23842397                                // preload discovery. The marker is reserved for the sitemap reads,
    23852398                                // which must leave nothing behind in the cache.
    2386                                 'headers'         => array( 'Accept' => 'text/html,application/xhtml+xml;q=0.9,*/*;q=0.8' ),
     2399                                'headers'         => array( 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' ),
    23872400                        )
    23882401                );
  • fastlayer/trunk/includes/class-webp.php

    r3783106 r3783146  
    30373037        }
    30383038
     3039        public function get_webp_url_for_image_url( $url ) {
     3040                if ( ! $this->is_enabled() || ! $this->is_image_delivery_enabled() ) {
     3041                        return false;
     3042                }
     3043
     3044                return $this->ensure_webp_for_url( $url );
     3045        }
     3046
    30393047        private function extract_attribute_value( $html, $attribute ) {
    30403048                $pattern = '/\b' . preg_quote( $attribute, '/' ) . '\s*=\s*("|\')(.*?)\1/i';
  • fastlayer/trunk/readme.txt

    r3781439 r3783146  
    44Requires at least: 6.0
    55Tested up to: 7.1
    6 Stable tag: 1.5.3
     6Stable tag: 1.5.4
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    276276
    277277== Changelog ==
     278
     279= 1.5.4 =
     280* Performance: overhauled CSS combine engine to safely bundle theme and builder stylesheets containing pseudo-elements and inline extras into unified cached bundles, eliminating up to 15+ render-blocking HTTP requests.
     281* New: Smart LCP Hero Background detector for WPBakery Page Builder and top hero containers, automatically injecting high-priority preload hints (`<link rel="preload" as="image" fetchpriority="high">`) directly into the document `<head>`.
     282* Enhancement: automatic `font-display: swap` enforcement on all external minified and combined stylesheets to eliminate webfont render-blocking delays.
     283* Enhancement: updated autonomous cache preloader with modern `Accept: image/webp` headers to ensure WebP variants are warmed for upstream CDN and reverse-proxy caches.
     284* New: automatic cache warming restart on cache purge/clear — whenever cache is cleared from the admin bar, settings, or dashboard, the background preloader immediately resumes warming all discovered public pages.
    278285
    279286= 1.5.3 =
    … …  
    360367== Upgrade Notice ==
    361368
     369= 1.5.4 =
     370Major Core Web Vitals update: unblocks CSS combination across themes, adds automatic WPBakery hero background LCP preloading with WebP delivery, and enforces font-display swap on all external stylesheets.
     371
    362372= 1.5.3 =
    363373Critical bugfix release: resolves HTTPS mixed content blocking on reverse proxies, repairs relative stylesheet url() rebasing, adds automatic background cache warming, and introduces table pagination.
  • fastlayer/trunk/wp-fastlayer.php

    r3781439 r3783146  
    44 * Plugin URI: https://github.com/kanhajatthap/WP-FastLayer
    55 * Description: High-performance WordPress caching and optimization plugin.
    6  * Version: 1.5.3
     6 * Version: 1.5.4
    77 * Requires at least: 6.0
    88 * Requires PHP: 7.4
    … …  
    1919}
    2020
    21 define( 'FASTLAYER_VERSION', '1.5.3' );
     21define( 'FASTLAYER_VERSION', '1.5.4' );
    2222define( 'FASTLAYER_FILE', __FILE__ );
    2323define( 'FASTLAYER_PATH', plugin_dir_path( __FILE__ ) );
Note: See TracChangeset for help on using the changeset viewer.