Plugin Directory

Changeset 3736319


Ignore:
Timestamp:
10/09/2026 09:37:32 AM (2 weeks ago)
Author:
finsburymedia
Message:

Release 1.4.0

Location:
finsbury-media-cookie-consent
Files:
2 added
1 deleted
3 edited
8 copied

Legend:

Unmodified
Added
Removed
  • finsbury-media-cookie-consent/tags/1.4.0/finsbury-media-cookie-consent.php

    r3734696 r3736319  
    33 * Plugin Name: Finsbury Media Cookie Consent
    44 * Description: Adds Google Consent Mode v2, Meta pixel consent mode, Microsoft UET & Clarity Consent Mode support to your site.
    5  * Version: 1.3.5
     5 * Version: 1.4.0
    66 * Author: Finsbury Media
    77 * Author URI: https://finsburymedia.com
    … …  
    1818define( 'FINSMECO_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    1919define( 'FINSMECO_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    20 define( 'FINSMECO_VERSION', '1.3.5' );
     20define( 'FINSMECO_VERSION', '1.4.0' );
     21
     22require_once FINSMECO_PLUGIN_DIR . 'configuration-loader.php';
    2123
    2224if (is_admin()) {
    … …  
    2426}
    2527
    26 require_once FINSMECO_PLUGIN_DIR . 'asset.php';
    27 
    2828function finsmeco_add_preload_tags() {
    29         $core_css_url = admin_url('admin-ajax.php?action=finsmeco_serve_asset&f=cc-core.css&ver=' . FINSMECO_VERSION);
    30         $setup_css_url = admin_url('admin-ajax.php?action=finsmeco_serve_asset&f=cc-setup.css&ver=' . FINSMECO_VERSION);
     29        $core_css_url = FINSMECO_PLUGIN_URL . 'assets/css/cc-core.css?ver=' . FINSMECO_VERSION;
     30        $setup_css_url = FINSMECO_PLUGIN_URL . 'assets/css/cc-setup.css?ver=' . FINSMECO_VERSION;
    3131       
    3232        echo '<link rel="preload" as="style" href="' . esc_url($core_css_url) . '" />' . "\n";
    … …  
    7070                        w.__updateMetaConsent=function(g){
    7171                                w.__metaConsentDefault=g?"grant":"revoke";
    72                                 if(w.__metaPixelConsentMode&&w.fbq&&w.fbq.callMethod) w.fbq("consent",w.__metaConsentDefault);
     72                                if(w.__metaPixelConsentMode && typeof w.fbq==="function") w.fbq("consent",w.__metaConsentDefault);
    7373                        };
    7474                }(window);
    … …  
    7676       
    7777        wp_add_inline_script('finsmeco-consent-defaults', $consent_defaults_js);
     78
     79        // Print this registered handle before later head callbacks add tracking scripts.
     80        wp_scripts()->do_items(['finsmeco-consent-defaults']);
    7881}
    7982
    8083function finsmeco_enqueue_scripts() {
     84        $config = finsmeco_get_config();
     85        if ($config === []) {
     86                return;
     87        }
     88
    8189        wp_enqueue_style(
    8290                'finsbury-media-cookie-consent-core-css',
    83                 admin_url('admin-ajax.php?action=finsmeco_serve_asset&f=cc-core.css'),
     91                FINSMECO_PLUGIN_URL . 'assets/css/cc-core.css',
    8492                [],
    8593                FINSMECO_VERSION,
    … …  
    8997        wp_enqueue_script(
    9098                'finsbury-media-cookie-consent-core-js',
    91                 admin_url('admin-ajax.php?action=finsmeco_serve_asset&f=cc-core.js'),
     99                FINSMECO_PLUGIN_URL . 'assets/js/cc-core.js',
    92100                [],
    93101                FINSMECO_VERSION,
    … …  
    97105        wp_enqueue_style(
    98106                'finsbury-media-cookie-consent-setup-css',
    99                 admin_url('admin-ajax.php?action=finsmeco_serve_asset&f=cc-setup.css'),
     107                FINSMECO_PLUGIN_URL . 'assets/css/cc-setup.css',
    100108                ['finsbury-media-cookie-consent-core-css'],
    101109                FINSMECO_VERSION,
    … …  
    105113        wp_enqueue_script(
    106114                'finsbury-media-cookie-consent-setup-js',
    107                 admin_url('admin-ajax.php?action=finsmeco_serve_asset&f=cc-setup.js'),
     115                FINSMECO_PLUGIN_URL . 'assets/js/cc-setup.js',
    108116                ['finsbury-media-cookie-consent-core-js'],
    109117                FINSMECO_VERSION,
    … …  
    111119        );
    112120       
    113         // load default config
    114         $config = file_get_contents(FINSMECO_PLUGIN_DIR . 'assets/json/cc-setup.json');
    115 
    116         $license_key = get_option('finsmeco_license_key', '');
    117         if ($license_key !== '') {
    118                 $url = sprintf('https://tracking.finsburymedia.co.uk/cookie-consent/%s/cc-setup.json', $license_key);
    119         $response = wp_remote_get($url);
    120 
    121         if (!is_wp_error($response) && wp_remote_retrieve_response_code($response) === 200) {
    122             // valid licence key, use customer specific config
    123             $config = wp_remote_retrieve_body($response);
    124         }
    125         }
    126 
    127121        wp_localize_script('finsbury-media-cookie-consent-setup-js', 'FINSMECO', [
    128                 'config' => json_decode($config, true),
     122                'config' => $config,
    129123        ]);
    130124       
    131         // Add consent defaults in header
    132         finsmeco_early_consent_defaults();
    133125}
    134126add_action('wp_enqueue_scripts', 'finsmeco_enqueue_scripts', 1);
     127add_action('wp_head', 'finsmeco_early_consent_defaults', -100);
    135128add_action('wp_head', 'finsmeco_add_preload_tags', 1);
  • finsbury-media-cookie-consent/tags/1.4.0/readme.txt

    r3734696 r3736319  
    55Tested up to: 7.1
    66Requires PHP: 8.0
    7 Stable tag: 1.3.5
     7Stable tag: 1.4.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    105105- A customer ID (used in premium version only)
    106106
     107Custom banner settings are saved on your website for up to 30 minutes to help pages load faster. Changing or removing your license key clears the saved settings automatically. If custom settings cannot be loaded, the banner uses its standard settings and tries again on a later visit after one minute. Changes may take longer to appear if your website also saves copies of its pages.
     108
    107109In the premium version, and only if explicitly enabled, the plugin may also log anonymous consent events to the following endpoint:
    108110
    … …  
    172174= 1.3.5 =
    173175* **WordPress 7.1 Compatibility**: Tested and confirmed full compatibility with WordPress 7.1
     176
     177= 1.4.0 =
     178* Improved reliability of cookie consent settings before tracking starts.
     179* Improved loading speed for the cookie consent banner.
  • finsbury-media-cookie-consent/tags/1.4.0/uninstall.php

    r3339497 r3736319  
    77
    88// Delete plugin options
     9delete_transient('finsmeco_remote_config');
    910delete_option('finsmeco_license_key');
  • finsbury-media-cookie-consent/trunk/finsbury-media-cookie-consent.php

    r3734696 r3736319  
    33 * Plugin Name: Finsbury Media Cookie Consent
    44 * Description: Adds Google Consent Mode v2, Meta pixel consent mode, Microsoft UET & Clarity Consent Mode support to your site.
    5  * Version: 1.3.5
     5 * Version: 1.4.0
    66 * Author: Finsbury Media
    77 * Author URI: https://finsburymedia.com
    … …  
    1818define( 'FINSMECO_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    1919define( 'FINSMECO_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    20 define( 'FINSMECO_VERSION', '1.3.5' );
     20define( 'FINSMECO_VERSION', '1.4.0' );
     21
     22require_once FINSMECO_PLUGIN_DIR . 'configuration-loader.php';
    2123
    2224if (is_admin()) {
    … …  
    2426}
    2527
    26 require_once FINSMECO_PLUGIN_DIR . 'asset.php';
    27 
    2828function finsmeco_add_preload_tags() {
    29         $core_css_url = admin_url('admin-ajax.php?action=finsmeco_serve_asset&f=cc-core.css&ver=' . FINSMECO_VERSION);
    30         $setup_css_url = admin_url('admin-ajax.php?action=finsmeco_serve_asset&f=cc-setup.css&ver=' . FINSMECO_VERSION);
     29        $core_css_url = FINSMECO_PLUGIN_URL . 'assets/css/cc-core.css?ver=' . FINSMECO_VERSION;
     30        $setup_css_url = FINSMECO_PLUGIN_URL . 'assets/css/cc-setup.css?ver=' . FINSMECO_VERSION;
    3131       
    3232        echo '<link rel="preload" as="style" href="' . esc_url($core_css_url) . '" />' . "\n";
    … …  
    7070                        w.__updateMetaConsent=function(g){
    7171                                w.__metaConsentDefault=g?"grant":"revoke";
    72                                 if(w.__metaPixelConsentMode&&w.fbq&&w.fbq.callMethod) w.fbq("consent",w.__metaConsentDefault);
     72                                if(w.__metaPixelConsentMode && typeof w.fbq==="function") w.fbq("consent",w.__metaConsentDefault);
    7373                        };
    7474                }(window);
    … …  
    7676       
    7777        wp_add_inline_script('finsmeco-consent-defaults', $consent_defaults_js);
     78
     79        // Print this registered handle before later head callbacks add tracking scripts.
     80        wp_scripts()->do_items(['finsmeco-consent-defaults']);
    7881}
    7982
    8083function finsmeco_enqueue_scripts() {
     84        $config = finsmeco_get_config();
     85        if ($config === []) {
     86                return;
     87        }
     88
    8189        wp_enqueue_style(
    8290                'finsbury-media-cookie-consent-core-css',
    83                 admin_url('admin-ajax.php?action=finsmeco_serve_asset&f=cc-core.css'),
     91                FINSMECO_PLUGIN_URL . 'assets/css/cc-core.css',
    8492                [],
    8593                FINSMECO_VERSION,
    … …  
    8997        wp_enqueue_script(
    9098                'finsbury-media-cookie-consent-core-js',
    91                 admin_url('admin-ajax.php?action=finsmeco_serve_asset&f=cc-core.js'),
     99                FINSMECO_PLUGIN_URL . 'assets/js/cc-core.js',
    92100                [],
    93101                FINSMECO_VERSION,
    … …  
    97105        wp_enqueue_style(
    98106                'finsbury-media-cookie-consent-setup-css',
    99                 admin_url('admin-ajax.php?action=finsmeco_serve_asset&f=cc-setup.css'),
     107                FINSMECO_PLUGIN_URL . 'assets/css/cc-setup.css',
    100108                ['finsbury-media-cookie-consent-core-css'],
    101109                FINSMECO_VERSION,
    … …  
    105113        wp_enqueue_script(
    106114                'finsbury-media-cookie-consent-setup-js',
    107                 admin_url('admin-ajax.php?action=finsmeco_serve_asset&f=cc-setup.js'),
     115                FINSMECO_PLUGIN_URL . 'assets/js/cc-setup.js',
    108116                ['finsbury-media-cookie-consent-core-js'],
    109117                FINSMECO_VERSION,
    … …  
    111119        );
    112120       
    113         // load default config
    114         $config = file_get_contents(FINSMECO_PLUGIN_DIR . 'assets/json/cc-setup.json');
    115 
    116         $license_key = get_option('finsmeco_license_key', '');
    117         if ($license_key !== '') {
    118                 $url = sprintf('https://tracking.finsburymedia.co.uk/cookie-consent/%s/cc-setup.json', $license_key);
    119         $response = wp_remote_get($url);
    120 
    121         if (!is_wp_error($response) && wp_remote_retrieve_response_code($response) === 200) {
    122             // valid licence key, use customer specific config
    123             $config = wp_remote_retrieve_body($response);
    124         }
    125         }
    126 
    127121        wp_localize_script('finsbury-media-cookie-consent-setup-js', 'FINSMECO', [
    128                 'config' => json_decode($config, true),
     122                'config' => $config,
    129123        ]);
    130124       
    131         // Add consent defaults in header
    132         finsmeco_early_consent_defaults();
    133125}
    134126add_action('wp_enqueue_scripts', 'finsmeco_enqueue_scripts', 1);
     127add_action('wp_head', 'finsmeco_early_consent_defaults', -100);
    135128add_action('wp_head', 'finsmeco_add_preload_tags', 1);
  • finsbury-media-cookie-consent/trunk/readme.txt

    r3734696 r3736319  
    55Tested up to: 7.1
    66Requires PHP: 8.0
    7 Stable tag: 1.3.5
     7Stable tag: 1.4.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    105105- A customer ID (used in premium version only)
    106106
     107Custom banner settings are saved on your website for up to 30 minutes to help pages load faster. Changing or removing your license key clears the saved settings automatically. If custom settings cannot be loaded, the banner uses its standard settings and tries again on a later visit after one minute. Changes may take longer to appear if your website also saves copies of its pages.
     108
    107109In the premium version, and only if explicitly enabled, the plugin may also log anonymous consent events to the following endpoint:
    108110
    … …  
    172174= 1.3.5 =
    173175* **WordPress 7.1 Compatibility**: Tested and confirmed full compatibility with WordPress 7.1
     176
     177= 1.4.0 =
     178* Improved reliability of cookie consent settings before tracking starts.
     179* Improved loading speed for the cookie consent banner.
  • finsbury-media-cookie-consent/trunk/uninstall.php

    r3339497 r3736319  
    77
    88// Delete plugin options
     9delete_transient('finsmeco_remote_config');
    910delete_option('finsmeco_license_key');
Note: See TracChangeset for help on using the changeset viewer.