Plugin Directory

Changeset 3265542


Ignore:
Timestamp:
04/02/2025 09:59:25 AM (12 months ago)
Author:
cookiekit
Message:

Replace old cookie-manager assets with updated fe7af268 versions

Location:
cookiekit-gdpr-cookie-consent/trunk
Files:
2 added
2 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • cookiekit-gdpr-cookie-consent/trunk/cookiekit.php

    r3265199 r3265542  
    44 * Plugin URI: https://github.com/hypershiphq/react-cookie-manager
    55 * Description: 🍪 Professional GDPR & CCPA compliant cookie consent solution. Beautiful design, automatic script blocking, and complete cookie compliance for WordPress.
    6  * Version: 1.8.0
     6 * Version: 1.9.0
    77 * Author: Hypership
    88 * Author URI: https://github.com/hypershiphq
     
    3131}
    3232
    33 define('COOKIEKIT_VERSION', '1.8.0');
     33define('COOKIEKIT_VERSION', '1.9.0');
    3434define('COOKIEKIT_PLUGIN_DIR', plugin_dir_path(__FILE__));
    3535define('COOKIEKIT_PLUGIN_URL', plugin_dir_url(__FILE__));
     
    113113        'defaultConsent' => array(
    114114            'analytics' => isset($settings['analytics_default_enabled']) ? (bool)$settings['analytics_default_enabled'] : false,
    115             'marketing' => isset($settings['marketing_default_enabled']) ? (bool)$settings['marketing_default_enabled'] : false,
    116             'preferences' => isset($settings['preferences_default_enabled']) ? (bool)$settings['preferences_default_enabled'] : false,
     115            'social' => isset($settings['social_default_enabled']) ? (bool)$settings['social_default_enabled'] : false,
     116            'advertising' => isset($settings['advertising_default_enabled']) ? (bool)$settings['advertising_default_enabled'] : false,
    117117        ),
     118        'showFloatingButton' => isset($settings['show_floating_button']) ? (bool)$settings['show_floating_button'] : false,
    118119        'translations' => array(
    119120            'title' => isset($text_settings['title']) ? $text_settings['title'] : 'Would You Like A Cookie? 🍪',
     
    146147            'analyticsCategoryName' => isset($text_settings['analytics_category_name']) ? $text_settings['analytics_category_name'] : 'Analytics',
    147148            'analyticsCategoryDescription' => isset($text_settings['analytics_category_description']) ? $text_settings['analytics_category_description'] : 'Help us understand how visitors interact with our website.',
    148             'marketingCategoryName' => isset($text_settings['marketing_category_name']) ? $text_settings['marketing_category_name'] : 'Marketing',
    149             'marketingCategoryDescription' => isset($text_settings['marketing_category_description']) ? $text_settings['marketing_category_description'] : 'Allow us to personalize the marketing content you see.',
    150             'preferencesCategoryName' => isset($text_settings['preferences_category_name']) ? $text_settings['preferences_category_name'] : 'Preferences',
    151             'preferencesCategoryDescription' => isset($text_settings['preferences_category_description']) ? $text_settings['preferences_category_description'] : 'Remember your settings and provide enhanced functionality.',
     149            'socialCategoryName' => isset($text_settings['social_category_name']) ? $text_settings['social_category_name'] : 'Social',
     150            'socialCategoryDescription' => isset($text_settings['social_category_description']) ? $text_settings['social_category_description'] : 'Enable social media features and sharing.',
     151            'advertisingCategoryName' => isset($text_settings['advertising_category_name']) ? $text_settings['advertising_category_name'] : 'Advertising',
     152            'advertisingCategoryDescription' => isset($text_settings['advertising_category_description']) ? $text_settings['advertising_category_description'] : 'Personalize advertisements and measure their performance.',
    152153        ),
    153154    );
     
    325326            'privacy_policy_url' => '', // Add default empty privacy policy URL
    326327            'analytics_default_enabled' => false,
    327             'marketing_default_enabled' => false,
    328             'preferences_default_enabled' => false,
     328            'social_default_enabled' => false,
     329            'advertising_default_enabled' => false,
     330            'show_floating_button' => false, // Floating button off by default
    329331            'text_settings' => array(
    330332                'title' => 'Would You Like A Cookie? 🍪',
     
    344346                'analytics_category_name' => 'Analytics',
    345347                'analytics_category_description' => 'Help us understand how visitors interact with our website.',
    346                 'marketing_category_name' => 'Marketing',
    347                 'marketing_category_description' => 'Allow us to personalize the marketing content you see.',
    348                 'preferences_category_name' => 'Preferences',
    349                 'preferences_category_description' => 'Remember your settings and provide enhanced functionality.',
     348                'social_category_name' => 'Social',
     349                'social_category_description' => 'Enable social media features and sharing.',
     350                'advertising_category_name' => 'Advertising',
     351                'advertising_category_description' => 'Personalize advertisements and measure their performance.',
    350352            )
    351353        ),
     
    375377    $sanitized['privacy_policy_url'] = isset($input['privacy_policy_url']) ? esc_url_raw($input['privacy_policy_url']) : '';
    376378    $sanitized['analytics_default_enabled'] = isset($input['analytics_default_enabled']) ? (bool)$input['analytics_default_enabled'] : false;
    377     $sanitized['marketing_default_enabled'] = isset($input['marketing_default_enabled']) ? (bool)$input['marketing_default_enabled'] : false;
    378     $sanitized['preferences_default_enabled'] = isset($input['preferences_default_enabled']) ? (bool)$input['preferences_default_enabled'] : false;
     379    $sanitized['social_default_enabled'] = isset($input['social_default_enabled']) ? (bool)$input['social_default_enabled'] : false;
     380    $sanitized['advertising_default_enabled'] = isset($input['advertising_default_enabled']) ? (bool)$input['advertising_default_enabled'] : false;
     381    $sanitized['show_floating_button'] = isset($input['show_floating_button']) ? (bool)$input['show_floating_button'] : false;
    379382   
    380383    // Sanitize text settings
    381384    $sanitized['text_settings'] = array();
    382385    if (isset($input['text_settings']) && is_array($input['text_settings'])) {
    383         foreach ($input['text_settings'] as $key => $value) {
    384             $sanitized['text_settings'][$key] = sanitize_text_field($value);
    385         }
    386     } else {
    387         $sanitized['text_settings'] = array(
     386        $default_text_settings = array( // Define defaults here
    388387            'title' => 'Would You Like A Cookie? 🍪',
    389388            'message' => 'We use cookies to enhance your browsing experience and analyze our traffic.',
     
    402401            'analytics_category_name' => 'Analytics',
    403402            'analytics_category_description' => 'Help us understand how visitors interact with our website.',
    404             'marketing_category_name' => 'Marketing',
    405             'marketing_category_description' => 'Allow us to personalize the marketing content you see.',
    406             'preferences_category_name' => 'Preferences',
    407             'preferences_category_description' => 'Remember your settings and provide enhanced functionality.',
     403            'social_category_name' => 'Social',
     404            'social_category_description' => 'Enable social media features and sharing.',
     405            'advertising_category_name' => 'Advertising',
     406            'advertising_category_description' => 'Personalize advertisements and measure their performance.',
    408407        );
     408        foreach ($default_text_settings as $key => $default_value) {
     409            $sanitized['text_settings'][$key] = isset($input['text_settings'][$key]) ? sanitize_text_field($input['text_settings'][$key]) : $default_value;
     410        }
     411    } else {
     412        // Fallback if text_settings is not an array
     413        $sanitized['text_settings'] = $default_text_settings;
    409414    }
    410415   
     
    421426    $settings = get_option('cookiekit_settings');
    422427
     428    // Define default text settings
     429    $default_text_settings = array(
     430        'title' => 'Would You Like A Cookie? 🍪',
     431        'message' => 'We use cookies to enhance your browsing experience and analyze our traffic.',
     432        'accept_button' => 'Accept All',
     433        'decline_button' => 'Decline All',
     434        'customize_button' => 'Customize',
     435        'privacy_policy_text' => 'Privacy Policy',
     436        'modal_title' => 'Cookie Preferences',
     437        'modal_message' => 'Choose which cookies you want to accept.',
     438        'save_preferences' => 'Save Preferences',
     439        'cancel' => 'Cancel',
     440        'essential_category_name' => 'Essential',
     441        'essential_category_description' => 'Required for the website to function properly.',
     442        'essential_category_always_enabled' => 'Always enabled',
     443        'essential_category_required' => 'Required',
     444        'analytics_category_name' => 'Analytics',
     445        'analytics_category_description' => 'Help us understand how visitors interact with our website.',
     446        'social_category_name' => 'Social',
     447        'social_category_description' => 'Enable social media features and sharing.',
     448        'advertising_category_name' => 'Advertising',
     449        'advertising_category_description' => 'Personalize advertisements and measure their performance.',
     450    );
     451
    423452    // Ensure text settings exist with defaults
    424     if (!isset($settings['text_settings'])) {
    425         $settings['text_settings'] = array(
    426             'title' => 'Would You Like A Cookie? 🍪',
    427             'message' => 'We use cookies to enhance your browsing experience and analyze our traffic.',
    428             'accept_button' => 'Accept All',
    429             'decline_button' => 'Decline All',
    430             'customize_button' => 'Customize',
    431             'privacy_policy_text' => 'Privacy Policy',
    432             'modal_title' => 'Cookie Preferences',
    433             'modal_message' => 'Choose which cookies you want to accept.',
    434             'save_preferences' => 'Save Preferences',
    435             'cancel' => 'Cancel',
    436             'essential_category_name' => 'Essential',
    437             'essential_category_description' => 'Required for the website to function properly.',
    438             'essential_category_always_enabled' => 'Always enabled',
    439             'essential_category_required' => 'Required',
    440             'analytics_category_name' => 'Analytics',
    441             'analytics_category_description' => 'Help us understand how visitors interact with our website.',
    442             'marketing_category_name' => 'Marketing',
    443             'marketing_category_description' => 'Allow us to personalize the marketing content you see.',
    444             'preferences_category_name' => 'Preferences',
    445             'preferences_category_description' => 'Remember your settings and provide enhanced functionality.',
    446         );
     453    if (!isset($settings['text_settings']) || !is_array($settings['text_settings'])) {
     454        $settings['text_settings'] = $default_text_settings;
     455    } else {
     456        // Ensure all keys exist, using defaults if missing
     457        $settings['text_settings'] = array_merge($default_text_settings, $settings['text_settings']);
    447458    }
    448459
     
    535546                'cookiekit_id' => 'YOUR_COOKIEKIT_ID_HERE',
    536547                'allowed_domains' => "example.com\napi.example.com",
     548                'privacy_policy_url' => 'https://example.com/privacy', // Added privacy policy url to sample
     549                'analytics_default_enabled' => false, // Added default toggles to sample
     550                'social_default_enabled' => false,     // Changed from marketing
     551                'advertising_default_enabled' => false, // Changed from preferences
    537552                'text_settings' => array(
    538553                    'title' => 'Cookie Consent',
     
    552567                    'analytics_category_name' => 'Analytics',
    553568                    'analytics_category_description' => 'Help us understand how visitors interact with our website.',
    554                     'marketing_category_name' => 'Marketing',
    555                     'marketing_category_description' => 'Allow us to personalize the marketing content you see.',
    556                     'preferences_category_name' => 'Preferences',
    557                     'preferences_category_description' => 'Remember your settings and provide enhanced functionality.',
     569                    'social_category_name' => 'Social', // Changed from marketing
     570                    'social_category_description' => 'Enable social media features and sharing.', // Changed from marketing
     571                    'advertising_category_name' => 'Advertising', // Changed from preferences
     572                    'advertising_category_description' => 'Personalize advertisements and measure their performance.', // Changed from preferences
    558573                )
    559574            );
     
    740755                    </td>
    741756                </tr>
     757                <tr>
     758                    <th scope="row"><?php esc_html_e('Show Preferences Button', 'cookiekit-gdpr-cookie-consent'); ?></th>
     759                    <td>
     760                        <label>
     761                            <input type="checkbox" name="cookiekit_settings[show_floating_button]"
     762                                value="1" <?php checked(isset($settings['show_floating_button']) && $settings['show_floating_button']); ?>>
     763                            <?php esc_html_e('Show a floating cookie settings button after consent is given', 'cookiekit-gdpr-cookie-consent'); ?>
     764                        </label>
     765                        <p class="description"><?php esc_html_e('If enabled, a small floating button will appear in the bottom left corner after the user has given their consent, allowing them to access cookie preferences at any time.', 'cookiekit-gdpr-cookie-consent'); ?></p>
     766                    </td>
     767                </tr>
    742768            </table>
    743769
     
    896922                </tr>
    897923               
    898                 <!-- Marketing Cookies -->
     924                <!-- Social Cookies -->
    899925                <tr>
    900926                    <th scope="row" colspan="2">
    901                         <h3 style="margin: 1.5em 0 0; padding: 10px; background: #f0f6ff; border-left: 4px solid #2271b1;"><?php esc_html_e('Marketing Cookies', 'cookiekit-gdpr-cookie-consent'); ?></h3>
     927                        <h3 style="margin: 1.5em 0 0; padding: 10px; background: #f0f6ff; border-left: 4px solid #2271b1;"><?php esc_html_e('Social Cookies', 'cookiekit-gdpr-cookie-consent'); ?></h3>
    902928                    </th>
    903929                </tr>
     
    906932                    <td>
    907933                        <input type="text"
    908                                name="cookiekit_settings[text_settings][marketing_category_name]"
    909                                value="<?php echo esc_attr(isset($settings['text_settings']['marketing_category_name']) ? $settings['text_settings']['marketing_category_name'] : __('Marketing', 'cookiekit-gdpr-cookie-consent')); ?>">
     934                               name="cookiekit_settings[text_settings][social_category_name]"
     935                               value="<?php echo esc_attr(isset($settings['text_settings']['social_category_name']) ? $settings['text_settings']['social_category_name'] : __('Social', 'cookiekit-gdpr-cookie-consent')); ?>">
    910936                    </td>
    911937                </tr>
     
    914940                    <td>
    915941                        <input type="text" class="large-text"
    916                                name="cookiekit_settings[text_settings][marketing_category_description]"
    917                                value="<?php echo esc_attr(isset($settings['text_settings']['marketing_category_description']) ? $settings['text_settings']['marketing_category_description'] : __('Allow us to personalize the marketing content you see.', 'cookiekit-gdpr-cookie-consent')); ?>">
     942                               name="cookiekit_settings[text_settings][social_category_description]"
     943                               value="<?php echo esc_attr(isset($settings['text_settings']['social_category_description']) ? $settings['text_settings']['social_category_description'] : __('Enable social media features and sharing.', 'cookiekit-gdpr-cookie-consent')); ?>">
    918944                    </td>
    919945                </tr>
    920946               
    921                 <!-- Preferences Cookies -->
     947                <!-- Advertising Cookies -->
    922948                <tr>
    923949                    <th scope="row" colspan="2">
    924                         <h3 style="margin: 1.5em 0 0; padding: 10px; background: #f0f6ff; border-left: 4px solid #2271b1;"><?php esc_html_e('Preferences Cookies', 'cookiekit-gdpr-cookie-consent'); ?></h3>
     950                        <h3 style="margin: 1.5em 0 0; padding: 10px; background: #f0f6ff; border-left: 4px solid #2271b1;"><?php esc_html_e('Advertising Cookies', 'cookiekit-gdpr-cookie-consent'); ?></h3>
    925951                    </th>
    926952                </tr>
     
    929955                    <td>
    930956                        <input type="text"
    931                                name="cookiekit_settings[text_settings][preferences_category_name]"
    932                                value="<?php echo esc_attr(isset($settings['text_settings']['preferences_category_name']) ? $settings['text_settings']['preferences_category_name'] : __('Preferences', 'cookiekit-gdpr-cookie-consent')); ?>">
     957                               name="cookiekit_settings[text_settings][advertising_category_name]"
     958                               value="<?php echo esc_attr(isset($settings['text_settings']['advertising_category_name']) ? $settings['text_settings']['advertising_category_name'] : __('Advertising', 'cookiekit-gdpr-cookie-consent')); ?>">
    933959                    </td>
    934960                </tr>
     
    937963                    <td>
    938964                        <input type="text" class="large-text"
    939                                name="cookiekit_settings[text_settings][preferences_category_description]"
    940                                value="<?php echo esc_attr(isset($settings['text_settings']['preferences_category_description']) ? $settings['text_settings']['preferences_category_description'] : __('Remember your settings and provide enhanced functionality.', 'cookiekit-gdpr-cookie-consent')); ?>">
     965                               name="cookiekit_settings[text_settings][advertising_category_description]"
     966                               value="<?php echo esc_attr(isset($settings['text_settings']['advertising_category_description']) ? $settings['text_settings']['advertising_category_description'] : __('Personalize advertisements and measure their performance.', 'cookiekit-gdpr-cookie-consent')); ?>">
    941967                    </td>
    942968                </tr>
     
    970996                </tr>
    971997                <tr>
    972                     <th scope="row"><?php esc_html_e('Marketing Cookies', 'cookiekit-gdpr-cookie-consent'); ?></th>
     998                    <th scope="row"><?php esc_html_e('Social Cookies', 'cookiekit-gdpr-cookie-consent'); ?></th>
    973999                    <td>
    9741000                        <label>
    975                             <input type="checkbox" name="cookiekit_settings[marketing_default_enabled]"
    976                                 value="1" <?php checked(isset($settings['marketing_default_enabled']) && $settings['marketing_default_enabled']); ?>>
    977                             <?php esc_html_e('Enable marketing cookies by default', 'cookiekit-gdpr-cookie-consent'); ?>
     1001                            <input type="checkbox" name="cookiekit_settings[social_default_enabled]"
     1002                                value="1" <?php checked(isset($settings['social_default_enabled']) && $settings['social_default_enabled']); ?>>
     1003                            <?php esc_html_e('Enable social cookies by default', 'cookiekit-gdpr-cookie-consent'); ?>
    9781004                        </label>
    979                         <p class="description"><?php esc_html_e('If checked, marketing cookies will be enabled by default in the preferences modal.', 'cookiekit-gdpr-cookie-consent'); ?></p>
    980                     </td>
    981                 </tr>
    982                 <tr>
    983                     <th scope="row"><?php esc_html_e('Preferences Cookies', 'cookiekit-gdpr-cookie-consent'); ?></th>
     1005                        <p class="description"><?php esc_html_e('If checked, social cookies will be enabled by default in the preferences modal.', 'cookiekit-gdpr-cookie-consent'); ?></p>
     1006                    </td>
     1007                </tr>
     1008                <tr>
     1009                    <th scope="row"><?php esc_html_e('Advertising Cookies', 'cookiekit-gdpr-cookie-consent'); ?></th>
    9841010                    <td>
    9851011                        <label>
    986                             <input type="checkbox" name="cookiekit_settings[preferences_default_enabled]"
    987                                 value="1" <?php checked(isset($settings['preferences_default_enabled']) && $settings['preferences_default_enabled']); ?>>
    988                             <?php esc_html_e('Enable preferences cookies by default', 'cookiekit-gdpr-cookie-consent'); ?>
     1012                            <input type="checkbox" name="cookiekit_settings[advertising_default_enabled]"
     1013                                value="1" <?php checked(isset($settings['advertising_default_enabled']) && $settings['advertising_default_enabled']); ?>>
     1014                            <?php esc_html_e('Enable advertising cookies by default', 'cookiekit-gdpr-cookie-consent'); ?>
    9891015                        </label>
    990                         <p class="description"><?php esc_html_e('If checked, preferences cookies will be enabled by default in the preferences modal.', 'cookiekit-gdpr-cookie-consent'); ?></p>
     1016                        <p class="description"><?php esc_html_e('If checked, advertising cookies will be enabled by default in the preferences modal.', 'cookiekit-gdpr-cookie-consent'); ?></p>
    9911017                    </td>
    9921018                </tr>
     
    10961122            'privacy_policy_url' => '', // Add default empty privacy policy URL
    10971123            'analytics_default_enabled' => false,
    1098             'marketing_default_enabled' => false,
    1099             'preferences_default_enabled' => false,
     1124            'social_default_enabled' => false,
     1125            'advertising_default_enabled' => false,
     1126            'show_floating_button' => false, // Floating button off by default
    11001127            'text_settings' => array(
    11011128                'title' => 'Would You Like A Cookie? 🍪',
     
    11151142                'analytics_category_name' => 'Analytics',
    11161143                'analytics_category_description' => 'Help us understand how visitors interact with our website.',
    1117                 'marketing_category_name' => 'Marketing',
    1118                 'marketing_category_description' => 'Allow us to personalize the marketing content you see.',
    1119                 'preferences_category_name' => 'Preferences',
    1120                 'preferences_category_description' => 'Remember your settings and provide enhanced functionality.',
     1144                'social_category_name' => 'Social',
     1145                'social_category_description' => 'Enable social media features and sharing.',
     1146                'advertising_category_name' => 'Advertising',
     1147                'advertising_category_description' => 'Personalize advertisements and measure their performance.',
    11211148            )
    11221149        ));
Note: See TracChangeset for help on using the changeset viewer.