| @@ -8,9 +8,9 @@ | ||
| 8 | 8 | |
| 9 | 9 | class Settings{ |
| 10 | 10 | |
| 11 | 11 | static function settings(){ |
| 12 | - global $cookieadmin_lang, $cookieadmin_error, $cookieadmin_msg, $cookieadmin_settings; | |
| 12 | + global $cookieadmin, $cookieadmin_lang, $cookieadmin_error, $cookieadmin_msg, $cookieadmin_settings; | |
| 13 | 13 | |
| 14 | 14 | $view = get_option('cookieadmin_law', 'cookieadmin_gdpr'); |
| 15 | 15 | $policy = cookieadmin_load_policy(); |
| 16 | 16 | |
| @@ -17,127 +17,282 @@ | ||
| 17 | 17 | $cookieadmin_requires_pro = \CookieAdmin\Admin::is_feature_available(1); |
| 18 | 18 | |
| 19 | 19 | \CookieAdmin\Admin::header_theme(__('Settings', 'cookieadmin')); |
| 20 | 20 | |
| 21 | + if(empty($cookieadmin_settings)){ | |
| 22 | + $cookieadmin_settings = get_option('cookieadmin_settings', []); | |
| 23 | + } | |
| 24 | + | |
| 21 | 25 | echo ' |
| 22 | 26 | <div class="cookieadmin_consent-wrap"> |
| 23 | 27 | <form action="" method="post" id="setting_submenu"> |
| 24 | 28 | |
| 25 | - <div class="cookieadmin_consent-contents"> | |
| 26 | - <div class="cookieadmin_consent_settings"> | |
| 27 | - <div class="cookieadmin-contents cookieadmin-settings"> | |
| 28 | - <div class="cookieadmin-setting setting-prior"> | |
| 29 | - <label class="cookieadmin-title">'.esc_html__('Load Cookies prior to consent', 'cookieadmin').' | |
| 30 | - <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Selected category of cookies will be loaded before user consent.', 'cookieadmin').'"></span> | |
| 29 | + <div class="cookieadmin-card"> | |
| 30 | + <div class="cookieadmin-card-header"> | |
| 31 | + <span class="cookieadmin-card-title"><span class="dashicons dashicons-download"></span> '.esc_html__('Cookie Loading', 'cookieadmin').'</span> | |
| 32 | + </div> | |
| 33 | + <div class="cookieadmin-card-body"> | |
| 34 | + <div class="cookieadmin-setting"> | |
| 35 | + <label class="cookieadmin-title">'.esc_html__('Load cookies prior to consent', 'cookieadmin').' | |
| 36 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Selected category of cookies will be loaded before user consent.', 'cookieadmin').'"></span> | |
| 37 | + </label> | |
| 38 | + <div class="cookieadmin-setting-contents"> | |
| 39 | + <label class="cookieadmin-horizontal" style="cursor:pointer; font-weight:400;"> | |
| 40 | + <input name="cookieadmin_preload[]" type="checkbox" value="necessary" checked disabled> | |
| 41 | + '.esc_html__('Necessary', 'cookieadmin').' | |
| 31 | 42 | </label> |
| 32 | - <div class="cookieadmin-setting-contents"> | |
| 33 | - | |
| 34 | - <input name="cookieadmin_preload[]" type="checkbox" id="necessary_preload" value="necessary" checked disabled> | |
| 35 | - <label class="cookieadmin-input" for="necessary_preload">'.esc_html__('Necessary', 'cookieadmin').'</label> | |
| 36 | - | |
| 43 | + <label class="cookieadmin-horizontal" style="cursor:pointer; font-weight:400;"> | |
| 37 | 44 | <input name="cookieadmin_preload[]" type="checkbox" id="functional_preload" value="functional" '.(!empty($policy[$view]['preload']) && in_array("functional", $policy[$view]['preload']) ? 'checked' : '').'> |
| 38 | - <label class="cookieadmin-input" for="functional_preload">'.esc_html__('Functional', 'cookieadmin').'</label> | |
| 39 | - | |
| 45 | + '.esc_html__('Functional', 'cookieadmin').' | |
| 46 | + </label> | |
| 47 | + <label class="cookieadmin-horizontal" style="cursor:pointer; font-weight:400;"> | |
| 40 | 48 | <input name="cookieadmin_preload[]" type="checkbox" id="analytics_preload" value="analytics" '.(!empty($policy[$view]['preload']) && in_array("analytics", $policy[$view]['preload']) ? 'checked' : '').'> |
| 41 | - <label class="cookieadmin-input" for="analytics_preload">'.esc_html__('Analytical', 'cookieadmin').'</label> | |
| 49 | + '.esc_html__('Analytical', 'cookieadmin').' | |
| 50 | + </label> | |
| 51 | + <label class="cookieadmin-horizontal" style="cursor:pointer; font-weight:400;"> | |
| 52 | + <input name="cookieadmin_preload[]" type="checkbox" id="marketing_preload" value="marketing" '.(!empty($policy[$view]['preload']) && in_array("marketing", $policy[$view]['preload']) ? 'checked' : '').'> | |
| 53 | + '.esc_html__('Advertisement', 'cookieadmin').' | |
| 54 | + </label> | |
| 55 | + | |
| 56 | + <div class="cookieadmin-collapsible-notice" style="display:'.(!empty($policy[$view]['preload'])? 'block':'none').'">'.esc_html__('Loading cookies prior to receiving user consent will make your website non-compliant with GDPR.', 'cookieadmin').'</div> | |
| 57 | + </div> | |
| 58 | + </div> | |
| 59 | + | |
| 60 | + <div class="cookieadmin-setting"> | |
| 61 | + <label class="cookieadmin-title" for="cookieadmin_reload_on_consent">'.esc_html__('Reload page on consent', 'cookieadmin').' | |
| 62 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Page will be loaded on user consent.', 'cookieadmin').'"></span> | |
| 63 | + </label> | |
| 64 | + <div class="cookieadmin-setting-contents"> | |
| 65 | + <label class="cookieadmin-toggle-wrap"> | |
| 66 | + <input name="cookieadmin_reload_on_consent" type="checkbox" id="cookieadmin_reload_on_consent" '.(!empty($policy[$view]['reload_on_consent']) ? 'checked' : '').'> | |
| 67 | + <div class="cookieadmin-toggle-track"> | |
| 68 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 69 | + </div> | |
| 70 | + </label> | |
| 71 | + </div> | |
| 72 | + </div> | |
| 73 | + </div> | |
| 74 | + </div>'; | |
| 75 | + | |
| 76 | + // Card: Resource blocking | |
| 77 | + echo ' | |
| 78 | + <div class="cookieadmin-card cookieadmin-mt-16"> | |
| 79 | + <div class="cookieadmin-card-header"> | |
| 80 | + <span class="cookieadmin-card-title"><span class="dashicons dashicons-media-document"></span> '.esc_html__('Resource Blocking', 'cookieadmin').'</span> | |
| 81 | + </div> | |
| 82 | + <div class="cookieadmin-card-body"> | |
| 83 | + <div class="cookieadmin-setting"> | |
| 84 | + <label class="cookieadmin-title" for="cookieadmin_block_scripts">'.esc_html__('Block scripts', 'cookieadmin').' | |
| 85 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('It blocks the scripts related to the scanned Cookies.', 'cookieadmin').'"></span> | |
| 86 | + </label> | |
| 87 | + <div class="cookieadmin-setting-contents"> | |
| 88 | + <label class="cookieadmin-toggle-wrap"> | |
| 89 | + <input name="cookieadmin_block_scripts" type="checkbox" id="cookieadmin_block_scripts" '.(!empty($cookieadmin_settings['block_scripts']) ? 'checked' : '').'> | |
| 90 | + <div class="cookieadmin-toggle-track"> | |
| 91 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 92 | + </div> | |
| 93 | + </label> | |
| 94 | + </div> | |
| 95 | + </div> | |
| 96 | + <div class="cookieadmin-setting setting-blocking" cookieadmin-pro-only="1"> | |
| 97 | + <label class="cookieadmin-title" for="cookieadmin_content_blocking">'.esc_html__('Content Blocking', 'cookieadmin').' | |
| 98 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Block third-party content which uses iframes to load cookies until user consent is given.', 'cookieadmin').'"></span> | |
| 99 | + </label> | |
| 100 | + <div class="cookieadmin-setting-contents"> | |
| 101 | + <label class="cookieadmin-toggle-wrap">'; | |
| 102 | + if(defined('COOKIEADMIN_PRO_VERSION')){ | |
| 103 | + echo '<input name="cookieadmin_content_blocking" type="checkbox" id="cookieadmin_content_blocking" '.(!empty($cookieadmin_settings['content_blocking']) && cookieadmin_is_pro() ? 'checked' : '').' />'; | |
| 104 | + } else { | |
| 105 | + echo '<input type="checkbox" id="cookieadmin_content_blocking" />'; | |
| 106 | + } | |
| 42 | 107 | |
| 43 | - <input name="cookieadmin_preload[]" type="checkbox" id="marketing_preload" value="marketing" '.(!empty($policy[$view]['preload']) && in_array("marketing", $policy[$view]['preload']) ? 'checked' : '').'> | |
| 44 | - <label for="marketing_preload">'.esc_html__('Advertisement', 'cookieadmin').'</label> | |
| 45 | - </div> | |
| 46 | - </div>'.(!empty($policy[$view]['preload']) ? '<p class="cookieadmin-collapsible-notice">'.esc_html__('Loading cookies prior to receiving user consent will make your website non-compliant with GDPR.', 'cookieadmin').'</p>' : '').' | |
| 47 | - | |
| 48 | - <div class="cookieadmin-setting setting-reload"> | |
| 49 | - <label class="cookieadmin-title" for="cookieadmin_reload_on_consent">'.esc_html__('Reload page on consent', 'cookieadmin').' | |
| 50 | - <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Page will be loaded on user consent.', 'cookieadmin').'"></span> | |
| 108 | + echo '<div class="cookieadmin-toggle-track"> | |
| 109 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 110 | + </div> | |
| 111 | + '.wp_kses_post($cookieadmin_requires_pro).' | |
| 51 | 112 | </label> |
| 52 | - <div class="cookieadmin-setting-contents"> | |
| 53 | - <label class="cookieadmin_toggle"> | |
| 54 | - <input name="cookieadmin_reload_on_consent" type="checkbox" id="cookieadmin_reload_on_consent" '.(!empty($policy[$view]['reload_on_consent']) ? 'checked' : '').'> | |
| 55 | - <span class="cookieadmin_slider"></span> | |
| 56 | - </label> | |
| 57 | - </div> | |
| 58 | 113 | </div> |
| 114 | + </div> | |
| 59 | 115 | |
| 60 | - <div class="coookieadmin-contents" cookieadmin-pro-only="1"> | |
| 61 | - <div class="cookieadmin-setting"> | |
| 62 | - <label class="cookieadmin-title" for="cookieadmin_google_consent_mode_v2">'.esc_html__('Google Consent Mode v2', 'cookieadmin').wp_kses_post($cookieadmin_requires_pro).' | |
| 63 | - <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Enable Google consent mode v2.', 'cookieadmin').'"></span> | |
| 64 | - </label> | |
| 65 | - <div class="cookieadmin-setting-contents"> | |
| 66 | - <label class="cookieadmin_toggle"> | |
| 67 | - <input name="cookieadmin_google_consent_mode_v2" type="checkbox" id="cookieadmin_google_consent_mode_v2" '.(!empty($cookieadmin_settings['google_consent_mode_v2']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 68 | - <span class="cookieadmin_slider"></span> | |
| 69 | - </label> | |
| 116 | + <div class="cookieadmin-content-blocking-options" style="display: '.(!empty($cookieadmin_settings['content_blocking']) ? 'block' : 'none').';"> | |
| 117 | + <div class="cookieadmin-cb-services"> | |
| 118 | + <label class="cookieadmin-title"><input type="checkbox" name="cookieadmin_content_blocking_services[]" value="youtube" '.(!empty($cookieadmin_settings['content_blocking_services']) && in_array('youtube', $cookieadmin_settings['content_blocking_services']) ? 'checked' : '').'> '.esc_html__('YouTube', 'cookieadmin').'</label> | |
| 119 | + <label class="cookieadmin-title"><input type="checkbox" name="cookieadmin_content_blocking_services[]" value="vimeo" '.(!empty($cookieadmin_settings['content_blocking_services']) && in_array('vimeo', $cookieadmin_settings['content_blocking_services']) ? 'checked' : '').'> '.esc_html__('Vimeo', 'cookieadmin').'</label> | |
| 120 | + <label class="cookieadmin-title"><input type="checkbox" name="cookieadmin_content_blocking_services[]" value="soundcloud" '.(!empty($cookieadmin_settings['content_blocking_services']) && in_array('soundcloud', $cookieadmin_settings['content_blocking_services']) ? 'checked' : '').'> '.esc_html__('SoundCloud', 'cookieadmin').'</label> | |
| 121 | + <label class="cookieadmin-title"><input type="checkbox" name="cookieadmin_content_blocking_services[]" value="dailymotion" '.(!empty($cookieadmin_settings['content_blocking_services']) && in_array('dailymotion', $cookieadmin_settings['content_blocking_services']) ? 'checked' : '').'> '.esc_html__('Dailymotion', 'cookieadmin').'</label> | |
| 122 | + <label class="cookieadmin-title"><input type="checkbox" name="cookieadmin_content_blocking_services[]" value="maps" '.(!empty($cookieadmin_settings['content_blocking_services']) && in_array('maps', $cookieadmin_settings['content_blocking_services']) ? 'checked' : '').'> '.esc_html__('Google Maps', 'cookieadmin').'</label> | |
| 123 | + </div> | |
| 124 | + </div> | |
| 125 | + </div> | |
| 126 | + </div>'; | |
| 127 | + | |
| 128 | + // Card: Advanced Features (PRO) | |
| 129 | + echo ' | |
| 130 | + <div class="cookieadmin-card cookieadmin-mt-16" cookieadmin-pro-only="1"> | |
| 131 | + <div class="cookieadmin-card-header"> | |
| 132 | + <span class="cookieadmin-card-title"><span class="dashicons dashicons-admin-generic"></span> '.esc_html__('Advanced Features', 'cookieadmin').wp_kses_post($cookieadmin_requires_pro).'</span> | |
| 133 | + </div> | |
| 134 | + <div class="cookieadmin-card-body"> | |
| 135 | + <div class="cookieadmin-setting"> | |
| 136 | + <label class="cookieadmin-title" for="cookieadmin_google_consent_mode_v2">'.esc_html__('Google Consent Mode v2', 'cookieadmin').' | |
| 137 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Enable Google consent mode v2.', 'cookieadmin').'"></span> | |
| 138 | + </label> | |
| 139 | + <div class="cookieadmin-setting-contents"> | |
| 140 | + <label class="cookieadmin-toggle-wrap"> | |
| 141 | + <input name="cookieadmin_google_consent_mode_v2" type="checkbox" id="cookieadmin_google_consent_mode_v2" '.(!empty($cookieadmin_settings['google_consent_mode_v2']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 142 | + <div class="cookieadmin-toggle-track"> | |
| 143 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 70 | 144 | </div> |
| 71 | - </div> | |
| 145 | + </label> | |
| 146 | + </div> | |
| 147 | + </div> | |
| 72 | 148 | |
| 73 | - <div class="cookieadmin-setting"> | |
| 74 | - <label class="cookieadmin-title" for="cookieadmin_hide_powered_by">'.esc_html__('Hide Powered by Link', 'cookieadmin').wp_kses_post($cookieadmin_requires_pro).' | |
| 75 | - <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Hide powered by CookieAdmin on banner.', 'cookieadmin').'"></span> | |
| 76 | - </label> | |
| 77 | - <div class="cookieadmin-setting-contents"> | |
| 78 | - <label class="cookieadmin_toggle"> | |
| 79 | - <input name="cookieadmin_hide_powered_by" type="checkbox" id="cookieadmin_hide_powered_by" '.(!empty($cookieadmin_settings['hide_powered_by']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 80 | - <span class="cookieadmin_slider"></span> | |
| 81 | - </label> | |
| 149 | + <div class="cookieadmin-setting"> | |
| 150 | + <label class="cookieadmin-title" for="cookieadmin_clarity_consent">'.esc_html__('Clarity Consent Mode V2', 'cookieadmin').' | |
| 151 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Enable Microsoft Clarity consent mode v2.', 'cookieadmin').'"></span> | |
| 152 | + </label> | |
| 153 | + <div class="cookieadmin-setting-contents"> | |
| 154 | + <label class="cookieadmin-toggle-wrap"> | |
| 155 | + <input name="cookieadmin_clarity_consent" type="checkbox" id="cookieadmin_clarity_consent" '.(!empty($cookieadmin_settings['clarity_consent']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 156 | + <div class="cookieadmin-toggle-track"> | |
| 157 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 82 | 158 | </div> |
| 83 | - </div> | |
| 159 | + </label> | |
| 160 | + </div> | |
| 161 | + </div> | |
| 84 | 162 | |
| 85 | - <div class="cookieadmin-setting"> | |
| 86 | - <label class="cookieadmin-title" for="cookieadmin_hide_reconsent">'.esc_html__('Hide Re-consent Icon', 'cookieadmin').wp_kses_post($cookieadmin_requires_pro).' | |
| 87 | - <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Hide reconsent icon after user consent.', 'cookieadmin').'"></span> | |
| 88 | - </label> | |
| 89 | - <div class="cookieadmin-setting-contents"> | |
| 90 | - <label class="cookieadmin_toggle"> | |
| 91 | - <input name="cookieadmin_hide_reconsent" type="checkbox" id="cookieadmin_hide_reconsent" '.(!empty($cookieadmin_settings['hide_reconsent']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 92 | - <span class="cookieadmin_slider"></span> | |
| 93 | - </label> | |
| 163 | + <div class="cookieadmin-setting"> | |
| 164 | + <label class="cookieadmin-title" for="cookieadmin_hide_powered_by">'.esc_html__('Hide Powered by Link', 'cookieadmin').' | |
| 165 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Hide powered by CookieAdmin on banner.', 'cookieadmin').'"></span> | |
| 166 | + </label> | |
| 167 | + <div class="cookieadmin-setting-contents"> | |
| 168 | + <label class="cookieadmin-toggle-wrap"> | |
| 169 | + <input name="cookieadmin_hide_powered_by" type="checkbox" id="cookieadmin_hide_powered_by" '.(!empty($cookieadmin_settings['hide_powered_by']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 170 | + <div class="cookieadmin-toggle-track"> | |
| 171 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 94 | 172 | </div> |
| 95 | - </div> | |
| 173 | + </label> | |
| 174 | + </div> | |
| 175 | + </div> | |
| 96 | 176 | |
| 97 | - <div class="cookieadmin-setting"> | |
| 98 | - <label class="cookieadmin-title" for="cookieadmin_auto_scan">'.esc_html__('Auto Cookies Scan', 'cookieadmin').wp_kses_post($cookieadmin_requires_pro).' | |
| 99 | - <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Monthly auto scan will detect cookies.', 'cookieadmin').'"></span> | |
| 100 | - </label> | |
| 101 | - <div class="cookieadmin-setting-contents"> | |
| 102 | - <label class="cookieadmin_toggle"> | |
| 103 | - <input name="cookieadmin_auto_scan" type="checkbox" id="cookieadmin_auto_scan" '.(!empty($cookieadmin_settings['cookieadmin_auto_scan']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 104 | - <span class="cookieadmin_slider"></span> | |
| 105 | - </label> | |
| 177 | + <div class="cookieadmin-setting"> | |
| 178 | + <label class="cookieadmin-title" for="cookieadmin_hide_reconsent">'.esc_html__('Hide Re-consent Icon', 'cookieadmin').' | |
| 179 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Hide reconsent icon after user consent.', 'cookieadmin').'"></span> | |
| 180 | + </label> | |
| 181 | + <div class="cookieadmin-setting-contents"> | |
| 182 | + <label class="cookieadmin-toggle-wrap"> | |
| 183 | + <input name="cookieadmin_hide_reconsent" type="checkbox" id="cookieadmin_hide_reconsent" '.(!empty($cookieadmin_settings['hide_reconsent']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 184 | + <div class="cookieadmin-toggle-track"> | |
| 185 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 106 | 186 | </div> |
| 107 | - </div> | |
| 187 | + </label> | |
| 188 | + </div> | |
| 189 | + </div> | |
| 108 | 190 | |
| 109 | - <div class="cookieadmin-setting"> | |
| 110 | - <label class="cookieadmin-title" for="cookieadmin_consent_logs_expiry">'.esc_html__('Consent Log Cleanup', 'cookieadmin').wp_kses_post($cookieadmin_requires_pro).' | |
| 111 | - <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Daily auto delete consent logs older than the set limit.', 'cookieadmin').'"></span> | |
| 112 | - </label> | |
| 113 | - <div class="cookieadmin-setting-contents cookieadmin-setting cookieadmin-setting-logs"> | |
| 114 | - <label class="cookieadmin_toggle"> | |
| 115 | - <input name="cookieadmin_consent_logs_expiry" type="checkbox" id="cookieadmin_consent_logs_expiry" '.(!empty($cookieadmin_settings['consent_logs_expiry']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 116 | - <span class="cookieadmin_slider"></span> | |
| 117 | - </label> | |
| 118 | - <input name="cookieadmin_consent_logs_expiry_days" class="cookieadmin-tooltip-box" id="cookieadmin_consent_logs_expiry_days" value="'.((!empty($cookieadmin_settings['consent_logs_expiry_days']) && cookieadmin_is_pro()) ? esc_attr($cookieadmin_settings['consent_logs_expiry_days']) : '365').'" data-tip="'.esc_html__('Keep consent logs for these many days', 'cookieadmin').'"> | |
| 119 | - <input type="button" class="button '.(cookieadmin_is_pro() ? ' cookieadmin-purge-consent-btn cookieadmin-tooltip-box' : '').'" data-tip="'.esc_html__('Delete consent logs older than the set limit (runs once)', 'cookieadmin').'" value="'.esc_html__('Delete Now', 'cookieadmin').'"/> | |
| 191 | + <div class="cookieadmin-setting"> | |
| 192 | + <label class="cookieadmin-title" for="cookieadmin_auto_scan">'.esc_html__('Auto Cookies Scan', 'cookieadmin').' | |
| 193 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Monthly auto scan will detect cookies.', 'cookieadmin').'"></span> | |
| 194 | + </label> | |
| 195 | + <div class="cookieadmin-setting-contents"> | |
| 196 | + <label class="cookieadmin-toggle-wrap"> | |
| 197 | + <input name="cookieadmin_auto_scan" type="checkbox" id="cookieadmin_auto_scan" '.(!empty($cookieadmin_settings['cookieadmin_auto_scan']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 198 | + <div class="cookieadmin-toggle-track"> | |
| 199 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 120 | 200 | </div> |
| 121 | - </div> | |
| 201 | + </label> | |
| 122 | 202 | </div> |
| 203 | + </div> | |
| 204 | + <div class="cookieadmin-setting"> | |
| 205 | + <label class="cookieadmin-title" for="cookieadmin_shared_subdomain_consent">'.esc_html__('Shared Subdomain Consent', 'cookieadmin').' | |
| 206 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Enable shared consent across subdomains.', 'cookieadmin').'"></span> | |
| 207 | + </label> | |
| 208 | + <div class="cookieadmin-setting-contents"> | |
| 209 | + <label class="cookieadmin-toggle-wrap"> | |
| 210 | + <input name="cookieadmin_shared_subdomain_consent" type="checkbox" id="cookieadmin_shared_subdomain_consent" '.(!empty($cookieadmin_settings['shared_subdomain_consent']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 211 | + <div class="cookieadmin-toggle-track"> | |
| 212 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 213 | + </div> | |
| 214 | + </label> | |
| 215 | + </div> | |
| 216 | + </div> | |
| 217 | + </div> | |
| 218 | + </div>'; | |
| 123 | 219 | |
| 124 | - <div class="cookieadmin-setting cookieadmin-save-settings"> | |
| 125 | - <div class="cookieadmin-setting-contents"> | |
| 126 | - <span><input type="submit" name="cookieadmin_save_settings" class="cookieadmin-btn cookieadmin-btn-primary" value="'.esc_html__('Save Settings', 'cookieadmin').'"></span> | |
| 127 | - </div> | |
| 220 | + // Card: Data Management (PRO) | |
| 221 | + echo ' | |
| 222 | + <div class="cookieadmin-card cookieadmin-mt-16" cookieadmin-pro-only="1"> | |
| 223 | + <div class="cookieadmin-card-header"> | |
| 224 | + <span class="cookieadmin-card-title"><span class="dashicons dashicons-database"></span> '.esc_html__('Data Management', 'cookieadmin').wp_kses_post($cookieadmin_requires_pro).'</span> | |
| 225 | + </div> | |
| 226 | + <div class="cookieadmin-card-body"> | |
| 227 | + <div class="cookieadmin-setting"> | |
| 228 | + <label class="cookieadmin-title" for="cookieadmin_consent_logs_expiry">'.esc_html__('Consent Log Cleanup', 'cookieadmin').' | |
| 229 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Daily auto delete consent logs older than the set limit.', 'cookieadmin').'"></span> | |
| 230 | + </label> | |
| 231 | + <div class="cookieadmin-setting-contents"> | |
| 232 | + <label class="cookieadmin-toggle-wrap"> | |
| 233 | + <input name="cookieadmin_consent_logs_expiry" type="checkbox" id="cookieadmin_consent_logs_expiry" '.(!empty($cookieadmin_settings['consent_logs_expiry']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 234 | + <div class="cookieadmin-toggle-track"> | |
| 235 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 236 | + </div> | |
| 237 | + </label> | |
| 238 | + <input name="cookieadmin_consent_logs_expiry_days" id="cookieadmin_consent_logs_expiry_days" class="cookieadmin-tooltip-box" value="'.((!empty($cookieadmin_settings['consent_logs_expiry_days']) && cookieadmin_is_pro()) ? esc_attr($cookieadmin_settings['consent_logs_expiry_days']) : '365').'" data-tip="'.esc_html__('Keep consent logs for these many days', 'cookieadmin').'" style="width:60px; text-align:center; margin:0 10px;"> | |
| 239 | + <input type="button" class="cookieadmin-btn cookieadmin-btn-sm '.((cookieadmin_is_pro()) ? ' cookieadmin-btn-danger cookieadmin-tooltip-box cookieadmin-purge-consent-btn' : '').'" data-tip="'.esc_html__('Delete consent logs older than the set limit (runs once)', 'cookieadmin').'" value="'.esc_html__('Delete Now', 'cookieadmin').'"/> | |
| 128 | 240 | </div> |
| 129 | 241 | </div> |
| 130 | - </div>'; | |
| 242 | + </div> | |
| 243 | + </div>'; | |
| 131 | 244 | |
| 132 | - wp_nonce_field('cookieadmin_admin_nonce', 'cookieadmin_security'); | |
| 133 | - echo ' | |
| 134 | - <br/> | |
| 135 | - <br/> | |
| 245 | + // Card: Global Privacy Control (PRO) | |
| 246 | + echo ' | |
| 247 | + <div class="cookieadmin-card cookieadmin-mt-16" cookieadmin-pro-only="1"> | |
| 248 | + <div class="cookieadmin-card-header"> | |
| 249 | + <span class="cookieadmin-card-title"><span class="dashicons dashicons-privacy"></span> '.esc_html__('Global Privacy Control', 'cookieadmin').wp_kses_post($cookieadmin_requires_pro).'</span> | |
| 250 | + </div> | |
| 251 | + <div class="cookieadmin-card-body"> | |
| 252 | + <div class="cookieadmin-setting"> | |
| 253 | + <label class="cookieadmin-title" for="cookieadmin_respect_gpc">'.esc_html__('Respect GPC', 'cookieadmin').' | |
| 254 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Automatically honor GPC signals from browsers. When enabled, users with GPC enabled will automatically have non-essential cookies rejected.', 'cookieadmin').'"></span> | |
| 255 | + </label> | |
| 256 | + <div class="cookieadmin-setting-contents"> | |
| 257 | + <label class="cookieadmin-toggle-wrap"> | |
| 258 | + <input name="cookieadmin_respect_gpc" type="checkbox" id="cookieadmin_respect_gpc" '.(!empty($cookieadmin_settings['respect_gpc']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 259 | + <div class="cookieadmin-toggle-track"> | |
| 260 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 261 | + </div> | |
| 262 | + </label> | |
| 263 | + </div> | |
| 264 | + </div> | |
| 265 | + | |
| 266 | + <div class="cookieadmin-setting"> | |
| 267 | + <label class="cookieadmin-title" for="cookieadmin_gpc_message">'.esc_html__('GPC Message', 'cookieadmin').' | |
| 268 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Custom message shown when GPC preference is honored.', 'cookieadmin').'"></span> | |
| 269 | + </label> | |
| 270 | + <div class="cookieadmin-setting-contents"> | |
| 271 | + <textarea name="cookieadmin_gpc_message" id="cookieadmin_gpc_message" rows="4" style="width:100%; max-width:500px;" '.(!cookieadmin_is_pro() ? 'disabled' : '').'>'.esc_textarea(!empty($cookieadmin_settings['gpc_message']) ? $cookieadmin_settings['gpc_message'] : (!empty($cookieadmin['gpc_message_default']) ? $cookieadmin['gpc_message_default'] : '')).'</textarea> | |
| 272 | + </div> | |
| 273 | + </div> | |
| 274 | + | |
| 275 | + <div class="cookieadmin-setting"> | |
| 276 | + <label class="cookieadmin-title" for="cookieadmin_gpc_override_warning">'.esc_html__('GPC Override Warning', 'cookieadmin').' | |
| 277 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Warning shown when user tries to enable cookies while GPC signal is active.', 'cookieadmin').'"></span> | |
| 278 | + </label> | |
| 279 | + <div class="cookieadmin-setting-contents"> | |
| 280 | + <textarea name="cookieadmin_gpc_override_warning" id="cookieadmin_gpc_override_warning" rows="4" style="width:100%; max-width:500px;" '.(!cookieadmin_is_pro() ? 'disabled' : '').'>'.esc_textarea(!empty($cookieadmin_settings['gpc_override_warning']) ? $cookieadmin_settings['gpc_override_warning'] : (!empty($cookieadmin['gpc_override_warning_default']) ? $cookieadmin['gpc_override_warning_default'] : '')).'</textarea> | |
| 281 | + </div> | |
| 282 | + </div> | |
| 283 | + </div> | |
| 284 | + </div>'; | |
| 285 | + wp_nonce_field('cookieadmin_admin_nonce', 'cookieadmin_security'); | |
| 286 | + | |
| 287 | + echo ' | |
| 288 | + <div class="cookieadmin-save-bar"> | |
| 289 | + <input type="submit" name="cookieadmin_save_settings" class="cookieadmin-btn cookieadmin-btn-primary" value="'.esc_html__('Save Settings', 'cookieadmin').'"> | |
| 136 | 290 | </div> |
| 291 | + | |
| 137 | 292 | </form> |
| 138 | 293 | </div>'; |
| 139 | - | |
| 294 | + | |
| 140 | 295 | \CookieAdmin\Admin::footer_theme(); |
| 141 | 296 | } |
| 142 | 297 | |
| 143 | 298 | static function save_settings(){ |
| @@ -153,8 +308,9 @@ | ||
| 153 | 308 | |
| 154 | 309 | $cookieadmin_settings = get_option('cookieadmin_settings', []); |
| 155 | 310 | |
| 156 | 311 | // Save cookieadmin_settings only on settings page |
| 312 | + $cookieadmin_settings['block_scripts'] = !empty($_REQUEST['cookieadmin_block_scripts']); | |
| 157 | 313 | $cookieadmin_settings['google_consent_mode_v2'] = (isset( $_REQUEST['cookieadmin_google_consent_mode_v2'] ) ? 1 : 0); |
| 158 | 314 | $cookieadmin_settings['hide_powered_by'] = (isset( $_REQUEST['cookieadmin_hide_powered_by'] ) ? 1 : 0); |
| 159 | 315 | $cookieadmin_settings['hide_reconsent'] = (isset( $_REQUEST['cookieadmin_hide_reconsent'] ) ? 1 : 0); |
| 160 | 316 | $cookieadmin_settings['cookieadmin_auto_scan'] = (isset( $_REQUEST['cookieadmin_auto_scan'] ) ? 1 : 0); |
| @@ -160,8 +316,16 @@ | ||
| 160 | 316 | $cookieadmin_settings['cookieadmin_auto_scan'] = (isset( $_REQUEST['cookieadmin_auto_scan'] ) ? 1 : 0); |
| 161 | 317 | $cookieadmin_settings['consent_logs_expiry'] = (isset( $_REQUEST['cookieadmin_consent_logs_expiry'] ) ? sanitize_text_field(wp_unslash($_REQUEST['cookieadmin_consent_logs_expiry'])) : 0); |
| 162 | 318 | $cookieadmin_settings['consent_logs_expiry_days'] = (isset( $_REQUEST['cookieadmin_consent_logs_expiry_days'] ) ? sanitize_text_field(wp_unslash($_REQUEST['cookieadmin_consent_logs_expiry_days'])) : 365); |
| 163 | 319 | |
| 320 | + $cookieadmin_settings['clarity_consent'] = !empty($_REQUEST['cookieadmin_clarity_consent']); | |
| 321 | + $cookieadmin_settings['shared_subdomain_consent'] = !empty($_REQUEST['cookieadmin_shared_subdomain_consent']); | |
| 322 | + $cookieadmin_settings['content_blocking'] = !empty($_REQUEST['cookieadmin_content_blocking']); | |
| 323 | + $cookieadmin_settings['content_blocking_services'] = []; | |
| 324 | + if(!empty($_REQUEST['cookieadmin_content_blocking_services'])){ | |
| 325 | + $cookieadmin_settings['content_blocking_services'] = array_map('sanitize_text_field', wp_unslash($_REQUEST['cookieadmin_content_blocking_services'])); | |
| 326 | + } | |
| 327 | + | |
| 164 | 328 | if(empty($cookieadmin_error)){ |
| 165 | 329 | update_option('cookieadmin_settings', $cookieadmin_settings); |
| 166 | 330 | } |
| 167 | 331 | |
| @@ -180,9 +344,20 @@ | ||
| 180 | 344 | |
| 181 | 345 | //set preload and consent field for "cookieadmin-settings" page |
| 182 | 346 | $policy[$law]['preload'] = !empty($_REQUEST['cookieadmin_preload']) ? array_map('sanitize_text_field', wp_unslash($_REQUEST['cookieadmin_preload'])) : []; |
| 183 | 347 | $policy[$law]['reload_on_consent'] = !empty($_REQUEST['cookieadmin_reload_on_consent']) ? sanitize_text_field(wp_unslash($_REQUEST['cookieadmin_reload_on_consent'])) : ''; |
| 348 | + | |
| 349 | + // Check for certain fields to be saved only if their values is not the same as default | |
| 350 | + $cookieadmin_check_changes = array('cookieadmin_notice_title', 'cookieadmin_notice', 'cookieadmin_preference_title', 'cookieadmin_preference', 'reConsent_title', 'cookieadmin_customize_btn', 'cookieadmin_reject_btn', 'cookieadmin_accept_btn', 'cookieadmin_save_btn'); | |
| 184 | 351 | |
| 352 | + foreach($cookieadmin_check_changes as $c_field){ | |
| 353 | + foreach($policy as $c_law => $c_val){ | |
| 354 | + if(!empty($c_val[$c_field]) && $c_val[$c_field] == $cookieadmin_policies[$c_law][$c_field]){ | |
| 355 | + unset($policy[$c_law][$c_field]); | |
| 356 | + } | |
| 357 | + } | |
| 358 | + } | |
| 359 | + | |
| 185 | 360 | update_option('cookieadmin_consent_settings', $policy); |
| 186 | 361 | |
| 187 | 362 | if(empty($cookieadmin_error)){ |
| 188 | 363 | $cookieadmin_msg = __('Settings saved successfully', 'cookieadmin'); |
| @@ -187,5 +362,5 @@ | ||
| 187 | 362 | if(empty($cookieadmin_error)){ |
| 188 | 363 | $cookieadmin_msg = __('Settings saved successfully', 'cookieadmin'); |
| 189 | 364 | } |
| 190 | 365 | } |
| 191 | -} | |
| 366 | +} | |