Plugin Directory

Changeset 3468552


Ignore:
Timestamp:
02/24/2026 10:42:54 AM (6 weeks ago)
Author:
adsimple
Message:

Release 2.1.4: Fix script tag sanitization, add version-based cache invalidation, extend third-party cache clearing

Location:
adsimple-cookie-manager-for-wp/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • adsimple-cookie-manager-for-wp/trunk/adsimple-cookie-manager.php

    r3467886 r3468552  
    77    *  Plugin Name:     AdSimple Cookie Consent Banner
    88    *  Description:     Add a GDPR-compliant cookie consent banner to your website in just a few steps. Certified CMP under IAB Europe TCF with CMP ID 463.
    9     *  Version:         2.1.3
     9    *  Version:         2.1.4
    1010    *  Author:          AdSimple
    1111    *  Author URI:      https://www.adsimple.at
  • adsimple-cookie-manager-for-wp/trunk/includes/controllers/extensions/rocket.php

    r3457260 r3468552  
    2121
    2222        /**
     23         * Clear all known third-party page caches.
     24         *
    2325         * @since 2.0.6
     26         * @since 2.1.4 extended to cover WP Super Cache, W3TC, LiteSpeed, Autoptimize, SG Optimizer, WP Fastest Cache
    2427         */
    2528        public static function auto_clear_cache() {
     29            // WP Rocket
    2630            if ( function_exists( 'rocket_clean_domain' ) ) {
    2731                rocket_clean_domain();
     32            }
     33
     34            // WP Super Cache
     35            if ( function_exists( 'wp_cache_clear_cache' ) ) {
     36                wp_cache_clear_cache();
     37            }
     38
     39            // W3 Total Cache
     40            if ( function_exists( 'w3tc_flush_all' ) ) {
     41                w3tc_flush_all();
     42            }
     43
     44            // LiteSpeed Cache
     45            // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Calling third-party LiteSpeed Cache hook, not defining our own.
     46            do_action( 'litespeed_purge_all' );
     47
     48            // Autoptimize
     49            if ( class_exists( 'autoptimizeCache' ) && method_exists( 'autoptimizeCache', 'clearall' ) ) {
     50                autoptimizeCache::clearall();
     51            }
     52
     53            // SG Optimizer (SiteGround)
     54            if ( function_exists( 'sg_cachepress_purge_cache' ) ) {
     55                sg_cachepress_purge_cache();
     56            }
     57
     58            // WP Fastest Cache
     59            if ( function_exists( 'wpfc_clear_all_cache' ) ) {
     60                wpfc_clear_all_cache( true );
    2861            }
    2962        }
  • adsimple-cookie-manager-for-wp/trunk/includes/controllers/popup.php

    r3457260 r3468552  
    3434            }
    3535
    36             echo "\r\n" . wp_kses_post( apply_filters( AS_CM_Manager::$action . '_embed_code', $code ) ) . "\r\n";
     36            $code = apply_filters( AS_CM_Manager::$action . '_embed_code', $code );
     37
     38            $allowed_html = array(
     39                'script' => array(
     40                    'type'        => true,
     41                    'src'         => true,
     42                    'id'          => true,
     43                    'async'       => true,
     44                    'defer'       => true,
     45                    'charset'     => true,
     46                    'crossorigin' => true,
     47                ),
     48            );
     49
     50            echo "\r\n" . wp_kses( $code, $allowed_html ) . "\r\n";
    3751        }
    3852
  • adsimple-cookie-manager-for-wp/trunk/includes/services/cache/loader.php

    r3457260 r3468552  
    217217
    218218            $options['cache']['timestamp'] = time();
     219            $options['cache']['plugin_version'] = AS_CM_Manager::$version;
    219220
    220221            AS_CM_Controllers_Options::update_options( $options );
  • adsimple-cookie-manager-for-wp/trunk/includes/services/cache/manager.php

    r3457260 r3468552  
    1212
    1313            add_action( AS_CM_Manager::$action . '_options_page', [ __CLASS__, 'handler_request_clear_cache' ] );
     14
     15            add_action( 'init', [ __CLASS__, 'maybe_invalidate_cache_on_update' ] );
     16        }
     17
     18        /**
     19         * @since 2.1.4
     20         */
     21        public static function maybe_invalidate_cache_on_update() {
     22            if ( ! static::is_cache_available() ) {
     23                return;
     24            }
     25
     26            $cache_options = AS_CM_Controllers_Options::get_option( 'cache' );
     27            $cached_version = isset( $cache_options['plugin_version'] ) ? $cache_options['plugin_version'] : '';
     28
     29            if ( $cached_version === AS_CM_Manager::$version ) {
     30                return;
     31            }
     32
     33            static::delete_cache();
     34
     35            $options = (array) AS_CM_Controllers_Options::get_option();
     36            $options['cache']['plugin_version'] = AS_CM_Manager::$version;
     37            $options['cache']['timestamp'] = 0;
     38            AS_CM_Controllers_Options::update_options( $options );
    1439        }
    1540
     
    150175            }
    151176
    152             if ( ! $result ) {
    153                 return false;
    154             }
    155 
    156177            do_action( AS_CM_Manager::$action . '_after_delete_cache' );
    157178
  • adsimple-cookie-manager-for-wp/trunk/readme.txt

    r3467886 r3468552  
    55Requires at least: 4.2.0
    66Tested up to: 6.9
    7 Stable tag: 2.1.3
     7Stable tag: 2.1.4
    88Requires PHP: 5.4
    99License: GPLv2 or later
     
    161161== Changelog ==
    162162
     163= 2.1.4 =
     164
     165*   Release Date - 24th February 2026
     166*   Fixed: Consent banner script tags were stripped by wp_kses_post(), causing raw JavaScript to appear as text on the page (with local cache) or the banner not loading at all (without local cache)
     167*   Fixed: Local script cache is now automatically invalidated when the plugin version changes, preventing stale cached scripts after updates
     168*   Fixed: Third-party page cache clearing now supports WP Super Cache, W3 Total Cache, LiteSpeed Cache, Autoptimize, SG Optimizer and WP Fastest Cache (in addition to WP Rocket)
     169*   Fixed: Third-party page caches are now always cleared when local cache is deleted, even if individual cache file deletions fail
     170
    163171= 2.1.3 =
    164172
Note: See TracChangeset for help on using the changeset viewer.