Changeset 3265542
- Timestamp:
- 04/02/2025 09:59:25 AM (12 months ago)
- Location:
- cookiekit-gdpr-cookie-consent/trunk
- Files:
-
- 2 added
- 2 deleted
- 1 edited
-
assets/css/cookie-manager.50d5aa66.css (deleted)
-
assets/css/cookie-manager.fe7af268.css (added)
-
assets/js/cookie-manager.50d5aa66.js (deleted)
-
assets/js/cookie-manager.fe7af268.js (added)
-
cookiekit.php (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cookiekit-gdpr-cookie-consent/trunk/cookiekit.php
r3265199 r3265542 4 4 * Plugin URI: https://github.com/hypershiphq/react-cookie-manager 5 5 * Description: 🍪 Professional GDPR & CCPA compliant cookie consent solution. Beautiful design, automatic script blocking, and complete cookie compliance for WordPress. 6 * Version: 1. 8.06 * Version: 1.9.0 7 7 * Author: Hypership 8 8 * Author URI: https://github.com/hypershiphq … … 31 31 } 32 32 33 define('COOKIEKIT_VERSION', '1. 8.0');33 define('COOKIEKIT_VERSION', '1.9.0'); 34 34 define('COOKIEKIT_PLUGIN_DIR', plugin_dir_path(__FILE__)); 35 35 define('COOKIEKIT_PLUGIN_URL', plugin_dir_url(__FILE__)); … … 113 113 'defaultConsent' => array( 114 114 '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, 117 117 ), 118 'showFloatingButton' => isset($settings['show_floating_button']) ? (bool)$settings['show_floating_button'] : false, 118 119 'translations' => array( 119 120 'title' => isset($text_settings['title']) ? $text_settings['title'] : 'Would You Like A Cookie? 🍪', … … 146 147 'analyticsCategoryName' => isset($text_settings['analytics_category_name']) ? $text_settings['analytics_category_name'] : 'Analytics', 147 148 '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.', 152 153 ), 153 154 ); … … 325 326 'privacy_policy_url' => '', // Add default empty privacy policy URL 326 327 '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 329 331 'text_settings' => array( 330 332 'title' => 'Would You Like A Cookie? 🍪', … … 344 346 'analytics_category_name' => 'Analytics', 345 347 '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.', 350 352 ) 351 353 ), … … 375 377 $sanitized['privacy_policy_url'] = isset($input['privacy_policy_url']) ? esc_url_raw($input['privacy_policy_url']) : ''; 376 378 $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; 379 382 380 383 // Sanitize text settings 381 384 $sanitized['text_settings'] = array(); 382 385 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 388 387 'title' => 'Would You Like A Cookie? 🍪', 389 388 'message' => 'We use cookies to enhance your browsing experience and analyze our traffic.', … … 402 401 'analytics_category_name' => 'Analytics', 403 402 '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.', 408 407 ); 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; 409 414 } 410 415 … … 421 426 $settings = get_option('cookiekit_settings'); 422 427 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 423 452 // 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']); 447 458 } 448 459 … … 535 546 'cookiekit_id' => 'YOUR_COOKIEKIT_ID_HERE', 536 547 '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 537 552 'text_settings' => array( 538 553 'title' => 'Cookie Consent', … … 552 567 'analytics_category_name' => 'Analytics', 553 568 '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 558 573 ) 559 574 ); … … 740 755 </td> 741 756 </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> 742 768 </table> 743 769 … … 896 922 </tr> 897 923 898 <!-- MarketingCookies -->924 <!-- Social Cookies --> 899 925 <tr> 900 926 <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(' MarketingCookies', '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> 902 928 </th> 903 929 </tr> … … 906 932 <td> 907 933 <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')); ?>"> 910 936 </td> 911 937 </tr> … … 914 940 <td> 915 941 <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')); ?>"> 918 944 </td> 919 945 </tr> 920 946 921 <!-- PreferencesCookies -->947 <!-- Advertising Cookies --> 922 948 <tr> 923 949 <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(' PreferencesCookies', '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> 925 951 </th> 926 952 </tr> … … 929 955 <td> 930 956 <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')); ?>"> 933 959 </td> 934 960 </tr> … … 937 963 <td> 938 964 <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')); ?>"> 941 967 </td> 942 968 </tr> … … 970 996 </tr> 971 997 <tr> 972 <th scope="row"><?php esc_html_e(' MarketingCookies', 'cookiekit-gdpr-cookie-consent'); ?></th>998 <th scope="row"><?php esc_html_e('Social Cookies', 'cookiekit-gdpr-cookie-consent'); ?></th> 973 999 <td> 974 1000 <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 marketingcookies 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'); ?> 978 1004 </label> 979 <p class="description"><?php esc_html_e('If checked, marketingcookies 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(' PreferencesCookies', '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> 984 1010 <td> 985 1011 <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 preferencescookies 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'); ?> 989 1015 </label> 990 <p class="description"><?php esc_html_e('If checked, preferencescookies 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> 991 1017 </td> 992 1018 </tr> … … 1096 1122 'privacy_policy_url' => '', // Add default empty privacy policy URL 1097 1123 '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 1100 1127 'text_settings' => array( 1101 1128 'title' => 'Would You Like A Cookie? 🍪', … … 1115 1142 'analytics_category_name' => 'Analytics', 1116 1143 '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.', 1121 1148 ) 1122 1149 ));
Note: See TracChangeset
for help on using the changeset viewer.