| @@ -17,157 +17,296 @@ | ||
| 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_google_advance_consent_mode">'.esc_html__('Load Google tags before consent', 'cookieadmin').' | |
| 151 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Google tags will fire immediately on the page load before consent.', 'cookieadmin').'"></span> | |
| 152 | + </label> | |
| 153 | + <div class="cookieadmin-setting-contents"> | |
| 154 | + <label class="cookieadmin-toggle-wrap"> | |
| 155 | + <input name="cookieadmin_google_advance_consent_mode" type="checkbox" id="cookieadmin_google_advance_consent_mode" '.(!empty($cookieadmin_settings['cookieadmin_google_advance_consent_mode']) && 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_clarity_consent">'.esc_html__('Clarity Consent Mode V2', 'cookieadmin').' | |
| 165 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Enable Microsoft Clarity consent mode v2.', 'cookieadmin').'"></span> | |
| 166 | + </label> | |
| 167 | + <div class="cookieadmin-setting-contents"> | |
| 168 | + <label class="cookieadmin-toggle-wrap"> | |
| 169 | + <input name="cookieadmin_clarity_consent" type="checkbox" id="cookieadmin_clarity_consent" '.(!empty($cookieadmin_settings['clarity_consent']) && 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_powered_by">'.esc_html__('Hide Powered by Link', 'cookieadmin').' | |
| 179 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Hide powered by CookieAdmin on banner.', 'cookieadmin').'"></span> | |
| 180 | + </label> | |
| 181 | + <div class="cookieadmin-setting-contents"> | |
| 182 | + <label class="cookieadmin-toggle-wrap"> | |
| 183 | + <input name="cookieadmin_hide_powered_by" type="checkbox" id="cookieadmin_hide_powered_by" '.(!empty($cookieadmin_settings['hide_powered_by']) && 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_hide_reconsent">'.esc_html__('Hide Re-consent Icon', 'cookieadmin').' | |
| 193 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Hide reconsent icon after user consent.', 'cookieadmin').'"></span> | |
| 194 | + </label> | |
| 195 | + <div class="cookieadmin-setting-contents"> | |
| 196 | + <label class="cookieadmin-toggle-wrap"> | |
| 197 | + <input name="cookieadmin_hide_reconsent" type="checkbox" id="cookieadmin_hide_reconsent" '.(!empty($cookieadmin_settings['hide_reconsent']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 198 | + <div class="cookieadmin-toggle-track"> | |
| 199 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 120 | 200 | </div> |
| 121 | - </div> | |
| 201 | + </label> | |
| 202 | + </div> | |
| 203 | + </div> | |
| 122 | 204 | |
| 123 | - <div class="cookieadmin-setting"> | |
| 124 | - <label class="cookieadmin-title" for="cookieadmin_respect_gpc">'.esc_html__('Respect Global Privacy Control', 'cookieadmin').wp_kses_post($cookieadmin_requires_pro).' | |
| 125 | - <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> | |
| 126 | - </label> | |
| 127 | - <div class="cookieadmin-setting-contents"> | |
| 128 | - <label class="cookieadmin_toggle"> | |
| 129 | - <input name="cookieadmin_respect_gpc" type="checkbox" id="cookieadmin_respect_gpc" '.(!empty($cookieadmin_settings['respect_gpc']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 130 | - <span class="cookieadmin_slider"></span> | |
| 131 | - </label> | |
| 205 | + <div class="cookieadmin-setting"> | |
| 206 | + <label class="cookieadmin-title" for="cookieadmin_auto_scan">'.esc_html__('Auto Cookies Scan', 'cookieadmin').' | |
| 207 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Monthly auto scan will detect cookies.', 'cookieadmin').'"></span> | |
| 208 | + </label> | |
| 209 | + <div class="cookieadmin-setting-contents"> | |
| 210 | + <label class="cookieadmin-toggle-wrap"> | |
| 211 | + <input name="cookieadmin_auto_scan" type="checkbox" id="cookieadmin_auto_scan" '.(!empty($cookieadmin_settings['cookieadmin_auto_scan']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 212 | + <div class="cookieadmin-toggle-track"> | |
| 213 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 132 | 214 | </div> |
| 133 | - </div> | |
| 215 | + </label> | |
| 216 | + </div> | |
| 217 | + </div> | |
| 218 | + <div class="cookieadmin-setting"> | |
| 219 | + <label class="cookieadmin-title" for="cookieadmin_shared_subdomain_consent">'.esc_html__('Shared Subdomain Consent', 'cookieadmin').' | |
| 220 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Enable shared consent across subdomains.', 'cookieadmin').'"></span> | |
| 221 | + </label> | |
| 222 | + <div class="cookieadmin-setting-contents"> | |
| 223 | + <label class="cookieadmin-toggle-wrap"> | |
| 224 | + <input name="cookieadmin_shared_subdomain_consent" type="checkbox" id="cookieadmin_shared_subdomain_consent" '.(!empty($cookieadmin_settings['shared_subdomain_consent']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 225 | + <div class="cookieadmin-toggle-track"> | |
| 226 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 227 | + </div> | |
| 228 | + </label> | |
| 229 | + </div> | |
| 230 | + </div> | |
| 231 | + </div> | |
| 232 | + </div>'; | |
| 134 | 233 | |
| 135 | - <div class="cookieadmin-setting"> | |
| 136 | - <label class="cookieadmin-title" for="cookieadmin_gpc_message">'.esc_html__('GPC Message', 'cookieadmin').wp_kses_post($cookieadmin_requires_pro).' | |
| 137 | - <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Custom message shown when GPC preference is honored.', 'cookieadmin').'"></span> | |
| 138 | - </label> | |
| 139 | - <div class="cookieadmin-setting-contents"> | |
| 140 | - <textarea name="cookieadmin_gpc_message" id="cookieadmin_gpc_message" rows="5" cols="50" '.(!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> | |
| 234 | + // Card: Data Management (PRO) | |
| 235 | + echo ' | |
| 236 | + <div class="cookieadmin-card cookieadmin-mt-16" cookieadmin-pro-only="1"> | |
| 237 | + <div class="cookieadmin-card-header"> | |
| 238 | + <span class="cookieadmin-card-title"><span class="dashicons dashicons-database"></span> '.esc_html__('Data Management', 'cookieadmin').wp_kses_post($cookieadmin_requires_pro).'</span> | |
| 239 | + </div> | |
| 240 | + <div class="cookieadmin-card-body"> | |
| 241 | + <div class="cookieadmin-setting"> | |
| 242 | + <label class="cookieadmin-title" for="cookieadmin_consent_logs_expiry">'.esc_html__('Consent Log Cleanup', 'cookieadmin').' | |
| 243 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Daily auto delete consent logs older than the set limit.', 'cookieadmin').'"></span> | |
| 244 | + </label> | |
| 245 | + <div class="cookieadmin-setting-contents"> | |
| 246 | + <label class="cookieadmin-toggle-wrap"> | |
| 247 | + <input name="cookieadmin_consent_logs_expiry" type="checkbox" id="cookieadmin_consent_logs_expiry" '.(!empty($cookieadmin_settings['consent_logs_expiry']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 248 | + <div class="cookieadmin-toggle-track"> | |
| 249 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 141 | 250 | </div> |
| 142 | - </div> | |
| 251 | + </label> | |
| 252 | + <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;"> | |
| 253 | + <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').'"/> | |
| 254 | + </div> | |
| 255 | + </div> | |
| 256 | + </div> | |
| 257 | + </div>'; | |
| 143 | 258 | |
| 144 | - <div class="cookieadmin-setting"> | |
| 145 | - <label class="cookieadmin-title" for="cookieadmin_gpc_override_warning">'.esc_html__('GPC Override Warning', 'cookieadmin').wp_kses_post($cookieadmin_requires_pro).' | |
| 146 | - <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> | |
| 147 | - </label> | |
| 148 | - <div class="cookieadmin-setting-contents"> | |
| 149 | - <textarea name="cookieadmin_gpc_override_warning" id="cookieadmin_gpc_override_warning" rows="5" cols="50" '.(!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> | |
| 259 | + // Card: Global Privacy Control (PRO) | |
| 260 | + echo ' | |
| 261 | + <div class="cookieadmin-card cookieadmin-mt-16" cookieadmin-pro-only="1"> | |
| 262 | + <div class="cookieadmin-card-header"> | |
| 263 | + <span class="cookieadmin-card-title"><span class="dashicons dashicons-privacy"></span> '.esc_html__('Global Privacy Control', 'cookieadmin').wp_kses_post($cookieadmin_requires_pro).'</span> | |
| 264 | + </div> | |
| 265 | + <div class="cookieadmin-card-body"> | |
| 266 | + <div class="cookieadmin-setting"> | |
| 267 | + <label class="cookieadmin-title" for="cookieadmin_respect_gpc">'.esc_html__('Respect GPC', 'cookieadmin').' | |
| 268 | + <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> | |
| 269 | + </label> | |
| 270 | + <div class="cookieadmin-setting-contents"> | |
| 271 | + <label class="cookieadmin-toggle-wrap"> | |
| 272 | + <input name="cookieadmin_respect_gpc" type="checkbox" id="cookieadmin_respect_gpc" '.(!empty($cookieadmin_settings['respect_gpc']) && cookieadmin_is_pro() ? 'checked' : '').'> | |
| 273 | + <div class="cookieadmin-toggle-track"> | |
| 274 | + <div class="cookieadmin-toggle-thumb"></div> | |
| 150 | 275 | </div> |
| 151 | - </div> | |
| 276 | + </label> | |
| 152 | 277 | </div> |
| 278 | + </div> | |
| 153 | 279 | |
| 154 | - <div class="cookieadmin-setting cookieadmin-save-settings"> | |
| 155 | - <div class="cookieadmin-setting-contents"> | |
| 156 | - <span><input type="submit" name="cookieadmin_save_settings" class="cookieadmin-btn cookieadmin-btn-primary" value="'.esc_html__('Save Settings', 'cookieadmin').'"></span> | |
| 157 | - </div> | |
| 280 | + <div class="cookieadmin-setting"> | |
| 281 | + <label class="cookieadmin-title" for="cookieadmin_gpc_message">'.esc_html__('GPC Message', 'cookieadmin').' | |
| 282 | + <span class="dashicons dashicons-info cookieadmin-tooltip-box" data-tip="'.esc_html__('Custom message shown when GPC preference is honored.', 'cookieadmin').'"></span> | |
| 283 | + </label> | |
| 284 | + <div class="cookieadmin-setting-contents"> | |
| 285 | + <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> | |
| 158 | 286 | </div> |
| 159 | 287 | </div> |
| 160 | - </div>'; | |
| 161 | 288 | |
| 162 | - wp_nonce_field('cookieadmin_admin_nonce', 'cookieadmin_security'); | |
| 163 | - echo ' | |
| 164 | - <br/> | |
| 165 | - <br/> | |
| 289 | + <div class="cookieadmin-setting"> | |
| 290 | + <label class="cookieadmin-title" for="cookieadmin_gpc_override_warning">'.esc_html__('GPC Override Warning', 'cookieadmin').' | |
| 291 | + <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> | |
| 292 | + </label> | |
| 293 | + <div class="cookieadmin-setting-contents"> | |
| 294 | + <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> | |
| 295 | + </div> | |
| 296 | + </div> | |
| 297 | + </div> | |
| 298 | + </div>'; | |
| 299 | + wp_nonce_field('cookieadmin_admin_nonce', 'cookieadmin_security'); | |
| 300 | + | |
| 301 | + echo ' | |
| 302 | + <div class="cookieadmin-save-bar"> | |
| 303 | + <input type="submit" name="cookieadmin_save_settings" class="cookieadmin-btn cookieadmin-btn-primary" value="'.esc_html__('Save Settings', 'cookieadmin').'"> | |
| 166 | 304 | </div> |
| 305 | + | |
| 167 | 306 | </form> |
| 168 | 307 | </div>'; |
| 169 | - | |
| 308 | + | |
| 170 | 309 | \CookieAdmin\Admin::footer_theme(); |
| 171 | 310 | } |
| 172 | 311 | |
| 173 | 312 | static function save_settings(){ |
| @@ -183,8 +322,9 @@ | ||
| 183 | 322 | |
| 184 | 323 | $cookieadmin_settings = get_option('cookieadmin_settings', []); |
| 185 | 324 | |
| 186 | 325 | // Save cookieadmin_settings only on settings page |
| 326 | + $cookieadmin_settings['block_scripts'] = !empty($_REQUEST['cookieadmin_block_scripts']); | |
| 187 | 327 | $cookieadmin_settings['google_consent_mode_v2'] = (isset( $_REQUEST['cookieadmin_google_consent_mode_v2'] ) ? 1 : 0); |
| 188 | 328 | $cookieadmin_settings['hide_powered_by'] = (isset( $_REQUEST['cookieadmin_hide_powered_by'] ) ? 1 : 0); |
| 189 | 329 | $cookieadmin_settings['hide_reconsent'] = (isset( $_REQUEST['cookieadmin_hide_reconsent'] ) ? 1 : 0); |
| 190 | 330 | $cookieadmin_settings['cookieadmin_auto_scan'] = (isset( $_REQUEST['cookieadmin_auto_scan'] ) ? 1 : 0); |
| @@ -190,8 +330,19 @@ | ||
| 190 | 330 | $cookieadmin_settings['cookieadmin_auto_scan'] = (isset( $_REQUEST['cookieadmin_auto_scan'] ) ? 1 : 0); |
| 191 | 331 | $cookieadmin_settings['consent_logs_expiry'] = (isset( $_REQUEST['cookieadmin_consent_logs_expiry'] ) ? sanitize_text_field(wp_unslash($_REQUEST['cookieadmin_consent_logs_expiry'])) : 0); |
| 192 | 332 | $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); |
| 193 | 333 | |
| 334 | + $cookieadmin_settings['clarity_consent'] = !empty($_REQUEST['cookieadmin_clarity_consent']); | |
| 335 | + $cookieadmin_settings['shared_subdomain_consent'] = !empty($_REQUEST['cookieadmin_shared_subdomain_consent']); | |
| 336 | + $cookieadmin_settings['content_blocking'] = !empty($_REQUEST['cookieadmin_content_blocking']); | |
| 337 | + $cookieadmin_settings['content_blocking_services'] = []; | |
| 338 | + if(!empty($_REQUEST['cookieadmin_content_blocking_services'])){ | |
| 339 | + $cookieadmin_settings['content_blocking_services'] = array_map('sanitize_text_field', wp_unslash($_REQUEST['cookieadmin_content_blocking_services'])); | |
| 340 | + } | |
| 341 | + | |
| 342 | + // Google's advance consent mode (Google tags will be loaded on page load is enabled) | |
| 343 | + $cookieadmin_settings['cookieadmin_google_advance_consent_mode'] = (isset( $_REQUEST['cookieadmin_google_advance_consent_mode'] ) ? 1 : 0); | |
| 344 | + | |
| 194 | 345 | if(empty($cookieadmin_error)){ |
| 195 | 346 | update_option('cookieadmin_settings', $cookieadmin_settings); |
| 196 | 347 | } |
| 197 | 348 | |
| @@ -210,9 +361,20 @@ | ||
| 210 | 361 | |
| 211 | 362 | //set preload and consent field for "cookieadmin-settings" page |
| 212 | 363 | $policy[$law]['preload'] = !empty($_REQUEST['cookieadmin_preload']) ? array_map('sanitize_text_field', wp_unslash($_REQUEST['cookieadmin_preload'])) : []; |
| 213 | 364 | $policy[$law]['reload_on_consent'] = !empty($_REQUEST['cookieadmin_reload_on_consent']) ? sanitize_text_field(wp_unslash($_REQUEST['cookieadmin_reload_on_consent'])) : ''; |
| 365 | + | |
| 366 | + // Check for certain fields to be saved only if their values is not the same as default | |
| 367 | + $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'); | |
| 214 | 368 | |
| 369 | + foreach($cookieadmin_check_changes as $c_field){ | |
| 370 | + foreach($policy as $c_law => $c_val){ | |
| 371 | + if(!empty($c_val[$c_field]) && $c_val[$c_field] == $cookieadmin_policies[$c_law][$c_field]){ | |
| 372 | + unset($policy[$c_law][$c_field]); | |
| 373 | + } | |
| 374 | + } | |
| 375 | + } | |
| 376 | + | |
| 215 | 377 | update_option('cookieadmin_consent_settings', $policy); |
| 216 | 378 | |
| 217 | 379 | if(empty($cookieadmin_error)){ |
| 218 | 380 | $cookieadmin_msg = __('Settings saved successfully', 'cookieadmin'); |
| @@ -217,5 +379,5 @@ | ||
| 217 | 379 | if(empty($cookieadmin_error)){ |
| 218 | 380 | $cookieadmin_msg = __('Settings saved successfully', 'cookieadmin'); |
| 219 | 381 | } |
| 220 | 382 | } |
| 221 | -} | |
| 383 | +} | |