Plugin Directory

Changeset 3319025


Ignore:
Timestamp:
06/28/2025 04:47:59 AM (8 months ago)
Author:
sethta
Message:

Update to version 1.2.1

Location:
easy-critical-css
Files:
293 added
7 edited

Legend:

Unmodified
Added
Removed
  • easy-critical-css/trunk/easy-critical-css.php

    r3317868 r3319025  
    33 * Plugin Name:       Easy Critical CSS
    44 * Description:       Easily inject Critical CSS and optimized Secondary CSS to improve page speed and performance.
    5  * Version:           1.2.0
     5 * Version:           1.2.1
    66 * Requires at least: 6.2
    77 * Tested up to:      6.8.1
  • easy-critical-css/trunk/inc/class-api-service.php

    r3317868 r3319025  
    1616
    1717    public static function request_critical_css( $url_or_id, $options = [] ) {
     18        // Bail early if no API key.
     19        if ( empty( Helpers::get_uid() )
     20            || empty( Helpers::get_api_key() )
     21            || empty( Helpers::get_install_id() )
     22        ) {
     23            Debug::ecc_log(
     24                [
     25                    'step' => 'skipping_api_call_no_license',
     26                    'url'  => $url_or_id,
     27                ]
     28            );
     29
     30            Critical_CSS_Status::update_critical_css_status(
     31                $url_or_id,
     32                'failed',
     33                'No API Key'
     34            );
     35
     36            return new WP_Error( 'missing_api_key', __( 'API Key is required.', 'easy-critical-css' ) );
     37        }
     38
    1839        Debug::ecc_log(
    1940            [
  • easy-critical-css/trunk/inc/class-critical-css-injector.php

    r3317868 r3319025  
    99class Critical_CSS_Injector {
    1010    public static function init() {
    11         add_filter( 'style_loader_tag', [ __CLASS__, 'add_async_styles' ], 9999, 2 );
     11        add_filter( 'style_loader_tag', [ __CLASS__, 'add_async_styles' ], 9999, 3 );
    1212
    1313        add_action( 'wp_head', [ __CLASS__, 'inject_critical_css' ], 1 );
     
    1616    }
    1717
    18     public static function add_async_styles( $tag, $handle ) {
     18    public static function add_async_styles( $tag, $handle, $href ) {
    1919        // Only apply async loading to the secondary CSS.
    2020        if ( 'easy-secondary-css' !== $handle ) {
     
    2222        }
    2323
    24         // Add async loading: media="print" changes to media="all" after load.
    25         $async_tag = str_replace( "media='all'", "media='print' onload=\"this.media='all'\"", $tag );
     24        // Add async loading: build the preload tag with onload swap.
     25        $async_tag = sprintf(
     26            '<link rel="preload" as="style" href="%s" onload="this.onload=null;this.rel=\'stylesheet\'">',
     27            esc_url( $href )
     28        );
    2629
    2730        // Fallback for users with JavaScript disabled.
  • easy-critical-css/trunk/inc/class-plugin.php

    r3317868 r3319025  
    1010    private static $instance = null;
    1111
    12     private static $plugin_version = '1.2.0';
     12    private static $plugin_version = '1.2.1';
    1313
    1414    private static $db_version = '2';
  • easy-critical-css/trunk/inc/class-rest-api.php

    r3317868 r3319025  
    515515        $css_combined = '';
    516516        foreach ( $allowed as $href ) {
    517             $css_res = wp_remote_get( $href );
     517            $uncached_href = add_query_arg( [ 'critical-css' => 'skip' . current_time( 'YmdHis' ) ], $href );
     518            $css_res       = wp_remote_get( $uncached_href );
    518519            if ( is_wp_error( $css_res ) ) {
    519520                continue;
  • easy-critical-css/trunk/readme.txt

    r3317868 r3319025  
    5555 - **Links**: [Terms of Service](https://criticalcss.net/terms/), [Privacy Policy](https://criticalcss.net/privacy/).
    5656
    57 
    58572. **Cloudflare API (api.cloudflare.com)**
    5958This service is used to automatically clear your Cloudflare cache after new critical CSS is generated, ensuring your visitors see updated styles immediately.
     
    103102== Changelog ==
    104103
     104= 1.2.1 =
     105- OPTIMIZATION: Utilizes a preload swap to defer Secondary CSS instead of a print/media swap
     106- FIX: Prevents Auto mode calls from being sent to api.criticalcss.net when no API key has been added
     107- FIX: Compiles CSS more reliably when using fallback endpoint
     108
    105109= 1.2.0 =
    106110- FEATURE: Adds Debug Mode setting with secure, locked-down endpoints
  • easy-critical-css/trunk/vendor/composer/installed.php

    r3317868 r3319025  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '9d1beb8466b4051bfb4b005c65b0ec5faa125478',
     6        'reference' => '6dbdd173fea13327e403938376d1d677bae57e28',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    3232            'pretty_version' => 'dev-main',
    3333            'version' => 'dev-main',
    34             'reference' => '9d1beb8466b4051bfb4b005c65b0ec5faa125478',
     34            'reference' => '6dbdd173fea13327e403938376d1d677bae57e28',
    3535            'type' => 'wordpress-plugin',
    3636            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.