PluginProbe
CookieAdmin – Cookie Consent Banner / 1.2.3
CookieAdmin – Cookie Consent Banner v1.2.3
1.2.3 1.2.2 1.2.1 1.2.0 1.1.9 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8
← All changes | includes/functions.php +85 -31 1.1.51.2.3 View file →
@@ -19,8 +19,16 @@
19 19 // No update required
20 20 if($current_version == COOKIEADMIN_VERSION){
21 21 return true;
22 22 }
23 +
24 + // We added a option to disable Script Delaying
25 + if($version < 120){
26 + $settings = get_option('cookieadmin_settings', []);
27 + $settings['block_scripts'] = true;
28 +
29 + update_option('cookieadmin_settings', $settings);
30 + }
23 31
24 32 // Save the new Version
25 33 update_option('cookieadmin_version', COOKIEADMIN_VERSION);
26 34
@@ -61,9 +69,13 @@
61 69
62 70 add_action('wp_enqueue_scripts', '\CookieAdmin\Enduser::enqueue_scripts');
63 71
64 72 // Insert Cookie blocker in the head.
65 - //add_action('send_headers', '\CookieAdmin\Enduser::cookieadmin_block_cookie_init_php', 100);
73 + add_action('send_headers', '\CookieAdmin\Enduser::cookieadmin_block_cookie_init_php', 100);
74 + add_filter( 'rest_pre_serve_request', function ( $served ) {
75 + \CookieAdmin\Enduser::cookieadmin_block_cookie_init_php();
76 + return $served;
77 + }, 999 );
66 78 // add_action('init', '\CookieAdmin\Enduser::cookieadmin_block_cookie_head_js', 0);
67 79
68 80 //add Cookie Banner to user page
69 81 if(!cookieadmin_is_editor_mode()){
@@ -69,9 +81,9 @@
69 81 if(!cookieadmin_is_editor_mode()){
70 82 add_action('wp_footer', '\CookieAdmin\Enduser::cookieadmin_show_banner');
71 83 }
72 84
73 - add_filter('script_loader_tag', '\CookieAdmin\Enduser::check_if_cookies_allowed', 10, 3);
85 + add_action('template_redirect', '\CookieAdmin\Enduser::block_scripts', 1);
74 86
75 87 }
76 88
77 89 function cookieadmin_load_plugin_admin(){
@@ -110,8 +122,18 @@
110 122 if (isset($_GET['pagelayer-live']) || isset($_GET['fl_builder'])) {
111 123 return true;
112 124 }
113 125
126 + // Avada builder
127 + if(isset($_GET['fb-edit']) || isset($_GET['builder']) || isset($_GET['builder_id'])){
128 + return true;
129 + }
130 +
131 + // Bricks Builder
132 + if(isset($_GET['bricks']) || isset($_GET['brickspreview'])){
133 + return true;
134 + }
135 +
114 136 if(isset($_GET['vc_action']) && $_GET['vc_action'] == 'vc_inline'){
115 137 return true;
116 138 }
117 139
@@ -118,8 +140,12 @@
118 140 if(isset($_GET['elementor-preview']) || (isset($_GET['action']) && $_GET['action'] == 'elementor')){
119 141 return true;
120 142 }
121 143
144 + if(isset($_GET['et_fb']) && ($_GET['et_fb'] == 1)){
145 + return true;
146 + }
147 +
122 148 return false;
123 149
124 150 }
125 151
@@ -138,9 +164,11 @@
138 164 'scan_cookies' => '\CookieAdmin\Admin\Scan::scan_cookies_ajax',
139 165 'cookieadmin-edit-cookie' => '\CookieAdmin\Admin\Scan::edit_cookies',
140 166 'cookieadmin-delete-cookie' => '\CookieAdmin\Admin\Scan::delete_cookies',
141 167 'close-update-notice' => '\CookieAdmin\Admin::close_plugin_update_notice',
142 - 'close-notice' => '\CookieAdmin\Admin::close_notices'
168 + 'close-notice' => '\CookieAdmin\Admin::close_notices',
169 + 'install_recommended_plugin' => '\CookieAdmin\Admin\Dashboard::install_recommended_plugin',
170 + 'activate_recommended_plugin' => '\CookieAdmin\Admin\Dashboard::activate_recommended_plugin',
143 171 );
144 172
145 173 $general_actions = array(
146 174 'categorize_cookies' => 'cookieadmin_categorize_cookies',
@@ -199,64 +227,86 @@
199 227
200 228 return array_replace_recursive($j_policy, $policy);
201 229 }
202 230
203 -function cookieadmin_load_strings(){
231 +function cookieadmin_load_strings($policy){
204 232
205 233 $cookieadmin_powered_by_html = '<div class="cookieadmin-poweredby"><a href="https://cookieadmin.net/?utm_source=wpplugin&utm_medium=footer" target="_blank"><span>[[powered_by]]</span> [[logo_svg]]</a></div>';
206 234
207 235 $cookieadmin_powered_by_html = apply_filters('cookieadmin_powered_by_html', $cookieadmin_powered_by_html);
236 + $privacy_policy_links = apply_filters('cookieadmin_privacy_policy_links', array(), $policy);
237 + $reconsent_icon_url = apply_filters('cookieadmin_reconsent_icon_url', '', $policy);
208 238
239 + $strings = [
240 + 'override_gpc' => apply_filters('cookieadmin_override_gpc_html', ''),
241 + 'powered_by_html' => $cookieadmin_powered_by_html,
242 + 'banner_policy_links' => !empty($privacy_policy_links['banner']) ? $privacy_policy_links['banner'] : '',
243 + 'modal_policy_links' => !empty($privacy_policy_links['modal']) ? $privacy_policy_links['modal'] : '',
244 + 'reconsent_icon_url' => esc_url($reconsent_icon_url),
245 + 'logo_svg' => cookieadmin_logo_svg(),
246 + 'plugin_url' => esc_url(COOKIEADMIN_PLUGIN_URL),
247 + 'powered_by' => __('Powered by', 'cookieadmin'),
248 + 'reconsent' => __('Re-consent', 'cookieadmin'),
249 + 'close' => __('Close', 'cookieadmin'),
250 + 'cookie_consent' => __('Cookie Consent', 'cookieadmin'),
251 + 'cookie_preferences' => __('Cookie Preferences', 'cookieadmin'),
252 + 'remark_standard' => __('Always Active', 'cookieadmin'),
253 + 'remark' => __('Remark', 'cookieadmin'),
254 + 'none' => __('None', 'cookieadmin'),
255 + 'necessary_cookies' => __('Necessary Cookies', 'cookieadmin'),
256 + 'necessary_cookies_desc' => __('Necessary cookies enable essential site features like secure log-ins and consent preference adjustments. They do not store personal data.', 'cookieadmin'),
257 + 'functional_cookies' => __('Functional Cookies', 'cookieadmin'),
258 + 'functional_cookies_desc' => __('Functional cookies support features like content sharing on social media, collecting feedback, and enabling third-party tools.', 'cookieadmin'),
259 + 'analytical_cookies' => __('Analytical Cookies', 'cookieadmin'),
260 + 'analytical_cookies_desc' => __('Analytical cookies track visitor interactions, providing insights on metrics like visitor count, bounce rate, and traffic sources.', 'cookieadmin'),
261 + 'advertisement_cookies' => __('Advertisement Cookies', 'cookieadmin'),
262 + 'advertisement_cookies_desc' => __('Advertisement cookies deliver personalized ads based on your previous visits and analyze the effectiveness of ad campaigns.', 'cookieadmin'),
263 + 'unclassified_cookies' => __('Unclassified Cookies', 'cookieadmin'),
264 + 'unclassified_cookies_desc' => __('Unclassified cookies are cookies that we are in the process of classifying, together with the providers of individual cookies.', 'cookieadmin'),
265 + ];
209 266
210 - return [
211 - 'powered_by_html' => $cookieadmin_powered_by_html,
212 - 'logo_svg' => cookieadmin_logo_svg(),
213 - 'plugin_url' => esc_url(COOKIEADMIN_PLUGIN_URL),
214 - 'powered_by' => __('Powered by', 'cookieadmin'),
215 - 'reconsent' => __('Re-consent', 'cookieadmin'),
216 - 'cookie_preferences' => __('Cookie Preferences', 'cookieadmin'),
217 - 'remark_standard' => __('Always Active', 'cookieadmin'),
218 - 'remark' => __('Remark', 'cookieadmin'),
219 - 'none' => __('None', 'cookieadmin'),
220 - 'necessary_cookies' => __('Necessary Cookies', 'cookieadmin'),
221 - 'necessary_cookies_desc' => __('Necessary cookies enable essential site features like secure log-ins and consent preference adjustments. They do not store personal data.', 'cookieadmin'),
222 - 'functional_cookies' => __('Functional Cookies', 'cookieadmin'),
223 - 'functional_cookies_desc' => __('Functional cookies support features like content sharing on social media, collecting feedback, and enabling third-party tools.', 'cookieadmin'),
224 - 'analytical_cookies' => __('Analytical Cookies', 'cookieadmin'),
225 - 'analytical_cookies_desc' => __('Analytical cookies track visitor interactions, providing insights on metrics like visitor count, bounce rate, and traffic sources.', 'cookieadmin'),
226 - 'advertisement_cookies' => __('Advertisement Cookies', 'cookieadmin'),
227 - 'advertisement_cookies_desc' => __('Advertisement cookies deliver personalized ads based on your previous visits and analyze the effectiveness of ad campaigns.', 'cookieadmin'),
228 - 'unclassified_cookies' => __('Unclassified Cookies', 'cookieadmin'),
229 - 'unclassified_cookies_desc' => __('Unclassified cookies are cookies that we are in the process of classifying, together with the providers of individual cookies.', 'cookieadmin'),
230 - ];
267 + return apply_filters('cookieadmin_default_strings', $strings);
231 268 }
232 269
233 270 //Loads consent data from file
234 271 function cookieadmin_load_consent_template($policy, $view){
235 272
273 + $template = array();
274 +
236 275 if(!file_exists(COOKIEADMIN_DIR.'assets/cookie/template.php')){
237 - return false;
276 + if(defined('WP_DEBUG') && WP_DEBUG){
277 + error_log('CookieAdmin: template file missing');
278 + }
279 + return $template;
238 280 }
239 281
240 282 include_once(COOKIEADMIN_DIR.'assets/cookie/template.php');
241 283
242 284 if(empty($content)){
243 - return false;
285 + if(defined('WP_DEBUG') && WP_DEBUG){
286 + error_log('CookieAdmin: Could not load template file');
287 + }
288 + return $template;
244 289 }
245 290
246 - $template = array();
247 291 $template[$view] = ($policy['cookieadmin_layout'] != 'popup') ? $content['cookieadmin_layout'][$policy['cookieadmin_layout']] : '';
248 292 $template[$view] .= $content['cookieadmin_modal'][$policy['cookieadmin_modal']];
249 - $template[$view] .= $content['cookieadmin_reconsent'];
250 293
251 - $cookieadmin_strings = cookieadmin_load_strings();
294 + global $cookieadmin_settings;
252 295
296 + // Show consent only if hide reconsent is not enabled
297 + if(defined('COOKIEADMIN_PRO_VERSION') && empty($cookieadmin_settings['hide_reconsent'])){
298 + $template[$view] .= $content['cookieadmin_reconsent'];
299 + }
300 +
301 + $cookieadmin_strings = cookieadmin_load_strings($policy);
302 +
253 303 foreach($cookieadmin_strings as $ck => $cv){
254 304 $template[$view] = str_replace('[['.$ck.']]', $cv, $template[$view]);
255 305 }
256 306
257 307 $template[$view] = apply_filters('cookieadmin_consent_banner_template', $template[$view]);
258 -
308 +
259 309 return $template;
260 310
261 311 }
262 312
@@ -443,11 +493,15 @@
443 493 'placeholder' => true,
444 494 );
445 495
446 496 $allowed_tags['defs'] = array();
497 +
498 + // aria-modal is not part of the wp_kses post-context globals
499 + $allowed_tags['div']['aria-modal'] = true;
447 500
448 501 $allowed_tags['a'] = array(
449 502 'href' => true,
503 + 'target' => true,
450 504 );
451 505
452 506 $allowed_tags['br'] = array();
453 507