Cookiebot | GDPR Compliant Cookie Consent and Notice - Version 2.4.0

Version Description

Download this release

Release Info

Developer cookiebot
Plugin Icon 128x128 Cookiebot | GDPR Compliant Cookie Consent and Notice
Version 2.4.0
Comparing to
See all releases

Code changes from version 2.3.0 to 2.4.0

Files changed (41) hide show
  1. README.md +2 -1
  2. addons/controller/addons/add-to-any/add-to-any.php +11 -73
  3. addons/controller/addons/caos-host-analyticsjs-local/caos-host-analyticsjs-local.php +2 -22
  4. addons/controller/addons/cookiebot-addons-interface.php +0 -9
  5. addons/controller/addons/custom-facebook-feed-pro/custom-facebook-feed-pro.php +1 -25
  6. addons/controller/addons/custom-facebook-feed/custom-facebook-feed.php +1 -25
  7. addons/controller/addons/embed-autocorrect/embed-autocorrect.php +2 -33
  8. addons/controller/addons/facebook-for-woocommerce/facebook-for-woocommerce.php +5 -40
  9. addons/controller/addons/ga-google-analytics/ga-google-analytics.php +3 -27
  10. addons/controller/addons/gadwp/gadwp.php +1 -27
  11. addons/controller/addons/google-analyticator/google-analyticator.php +1 -21
  12. addons/controller/addons/google-analytics-plus/google-analytics-plus.php +4 -46
  13. addons/controller/addons/google-analytics/google-analytics.php +6 -47
  14. addons/controller/addons/hubspot-leadin/hubspot-leadin.php +4 -28
  15. addons/controller/addons/hubspot-tracking-code/hubspot-tracking-code.php +7 -31
  16. addons/controller/addons/instagram-feed/instagram-feed.php +1 -27
  17. addons/controller/addons/jetpack/jetpack.php +2 -22
  18. addons/controller/addons/jetpack/visitor-cookies.php +2 -23
  19. addons/controller/addons/jetpack/widget/facebook-widget.php +19 -18
  20. addons/controller/addons/jetpack/widget/goodreads-widget.php +19 -17
  21. addons/controller/addons/jetpack/widget/google-maps-widget.php +17 -19
  22. addons/controller/addons/jetpack/widget/googleplus-badge-widget.php +15 -15
  23. addons/controller/addons/jetpack/widget/internet-defense-league-widget.php +22 -41
  24. addons/controller/addons/jetpack/widget/twitter-timeline-widget.php +15 -14
  25. addons/controller/addons/ninja-forms/ninja-forms.php +16 -40
  26. addons/controller/addons/optinmonster/optinmonster.php +2 -26
  27. addons/controller/addons/pixel-caffeine/pixel-caffeine.php +9 -51
  28. addons/controller/addons/wd-google-analytics/wd-google-analytics.php +4 -46
  29. addons/controller/addons/wp-analytify/wp-analytify.php +1 -26
  30. addons/controller/addons/wp-piwik/wp-piwik.php +30 -28
  31. addons/controller/addons/wpforms/wpforms.php +1 -38
  32. addons/controller/plugin-controller.php +11 -1
  33. addons/cookiebot-addons-init.php +1 -1
  34. addons/lib/buffer/buffer-output.php +5 -4
  35. addons/lib/helper.php +27 -1
  36. addons/lib/settings-service-interface.php +0 -22
  37. addons/lib/settings-service.php +1 -50
  38. addons/view/admin/settings/available-addon-callback.php +0 -11
  39. addons/view/admin/settings/jetpack-addon-callback.php +0 -11
  40. cookiebot.php +2 -2
  41. readme.txt +6 -1
README.md CHANGED
@@ -9,7 +9,7 @@ https://core.trac.wordpress.org/ticket/44043
9
10
# Travis CI Status
11
12
- [![Build Status](https://travis-ci.org/CybotAS/CookiebotAddons.svg?branch=develop)](https://travis-ci.org/CybotAS/CookiebotAddons)
13
14
Table of contents
15
=================
@@ -69,6 +69,7 @@ Released and tested addons:
69
* [HubSpot – Free Marketing Plugin for WordPress](https://wordpress.org/plugins/leadin/)
70
* [Ninja forms](https://wordpress.org/plugins/ninja-forms/)
71
* [Popups by OptinMonster](https://wordpress.org/plugins/optinmonster/)
72
73
Following addons are in pipeline:
74
* To be continued..
9
10
# Travis CI Status
11
12
+ [![Build Status](https://travis-ci.org/CybotAS/CookiebotWP.svg?branch=master)](https://travis-ci.org/CybotAS/CookiebotWP)
13
14
Table of contents
15
=================
69
* [HubSpot – Free Marketing Plugin for WordPress](https://wordpress.org/plugins/leadin/)
70
* [Ninja forms](https://wordpress.org/plugins/ninja-forms/)
71
* [Popups by OptinMonster](https://wordpress.org/plugins/optinmonster/)
72
+ * [Google Analytics Dashboard for WP](https://wordpress.org/plugins/google-analytics-dashboard-for-wp/)
73
74
Following addons are in pipeline:
75
* To be continued..
addons/controller/addons/add-to-any/add-to-any.php CHANGED
@@ -29,7 +29,7 @@ class Add_To_Any implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.3.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -70,59 +70,18 @@ class Add_To_Any implements Cookiebot_Addons_Interface {
70
* @since 1.3.0
71
*/
72
public function cookiebot_addon_add_to_any() {
73
- // Check if Add To Any is loaded.
74
- if ( ! function_exists( 'A2A_SHARE_SAVE_init' ) ) {
75
- return;
76
- }
77
78
- // Check if Cookiebot is activated and active.
79
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
80
- return;
81
- }
82
83
- // consent is given
84
- if ( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
85
- return;
86
- }
87
-
88
- if ( $this->is_remove_tag_enabled() ) {
89
- add_filter( 'addtoany_script_disabled', '__return_true' );
90
-
91
- /**
92
- * Block head script
93
- */
94
- if ( has_action( 'wp_head', 'A2A_SHARE_SAVE_head_script' ) ) {
95
- remove_action( 'wp_head', 'A2A_SHARE_SAVE_head_script' );
96
- }
97
-
98
- /**
99
- * Block footer script
100
- */
101
- if ( has_action( 'wp_footer', 'A2A_SHARE_SAVE_footer_script' ) ) {
102
- remove_action( 'wp_footer', 'A2A_SHARE_SAVE_footer_script' );
103
- }
104
-
105
- /**
106
- * Block content addition
107
- */
108
- if ( has_action( 'pre_get_posts', 'A2A_SHARE_SAVE_pre_get_posts' ) ) {
109
- remove_action( 'pre_get_posts', 'A2A_SHARE_SAVE_pre_get_posts' );
110
- }
111
- } else {
112
- $this->buffer_output->add_tag( 'wp_head', 10, array(
113
- 'data-cfasync' => $this->get_cookie_types(),
114
- 'addtoany' => $this->get_cookie_types()
115
- ), false );
116
-
117
- $this->buffer_output->add_tag( 'wp_footer', 10, array(
118
- 'data-cfasync' => $this->get_cookie_types(),
119
- 'addtoany' => $this->get_cookie_types()
120
- ), false );
121
-
122
- $this->buffer_output->add_tag( 'pre_get_posts', 10, array(
123
- 'GoogleAnalyticsObject' => $this->get_cookie_types(),
124
- ), false );
125
- }
126
127
// External js, so manipulate attributes
128
if ( has_action( 'wp_enqueue_scripts', 'A2A_SHARE_SAVE_enqueue_script' ) ) {
@@ -314,27 +273,6 @@ class Add_To_Any implements Cookiebot_Addons_Interface {
314
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
315
}
316
317
- /**
318
- * Returns true if addon has an option to remove tag instead of adding attributes
319
- *
320
- * @return boolean
321
- *
322
- * @since 2.1.0
323
- */
324
- public function has_remove_tag_option() {
325
- return true;
326
- }
327
-
328
- /**
329
- * Return true if the remove tag option is enabled
330
- *
331
- * @return mixed
332
- *
333
- * @since 2.1.0
334
- */
335
- public function is_remove_tag_enabled() {
336
- return $this->settings->is_remove_tag_enabled( $this->get_option_name() );
337
- }
338
339
/**
340
* Returns parent class or false
29
*
30
* @since 1.3.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
70
* @since 1.3.0
71
*/
72
public function cookiebot_addon_add_to_any() {
73
+
74
+ $this->buffer_output->add_tag( 'wp_head', 10, array(
75
+ 'a2a_config' => $this->get_cookie_types()
76
+ ), false );
77
78
+ $this->buffer_output->add_tag( 'wp_footer', 10, array(
79
+ 'a2a_config' => $this->get_cookie_types()
80
+ ), false );
81
82
+ $this->buffer_output->add_tag( 'pre_get_posts', 10, array(
83
+ 'GoogleAnalyticsObject' => $this->get_cookie_types(),
84
+ ), false );
85
86
// External js, so manipulate attributes
87
if ( has_action( 'wp_enqueue_scripts', 'A2A_SHARE_SAVE_enqueue_script' ) ) {
273
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
274
}
275
276
277
/**
278
* Returns parent class or false
addons/controller/addons/caos-host-analyticsjs-local/caos-host-analyticsjs-local.php CHANGED
@@ -29,7 +29,7 @@ class CAOS_Host_Analyticsjs_Local implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.3.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -70,16 +70,7 @@ class CAOS_Host_Analyticsjs_Local implements Cookiebot_Addons_Interface {
70
* @since 1.3.0
71
*/
72
public function cookiebot_addon_host_analyticsjs_local() {
73
- // Check if Cookiebot is activated and active.
74
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
75
- return;
76
- }
77
-
78
- // consent is given
79
- if ( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
80
- return;
81
- }
82
-
83
/* Priority need to be more than 0 so we are able to hook in before output begins */
84
$scriptPriority = $this->cookiebot_addon_host_analyticsjs_local_priority();
85
if ( $scriptPriority <= 0 ) {
@@ -311,17 +302,6 @@ class CAOS_Host_Analyticsjs_Local implements Cookiebot_Addons_Interface {
311
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
312
}
313
314
- /**
315
- * Returns true if addon has an option to remove tag instead of adding attributes
316
- *
317
- * @return boolean
318
- *
319
- * @since 2.1.0
320
- */
321
- public function has_remove_tag_option() {
322
- return false;
323
- }
324
-
325
/**
326
* Returns parent class or false
327
*
29
*
30
* @since 1.3.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
70
* @since 1.3.0
71
*/
72
public function cookiebot_addon_host_analyticsjs_local() {
73
+
74
/* Priority need to be more than 0 so we are able to hook in before output begins */
75
$scriptPriority = $this->cookiebot_addon_host_analyticsjs_local_priority();
76
if ( $scriptPriority <= 0 ) {
302
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
303
}
304
305
/**
306
* Returns parent class or false
307
*
addons/controller/addons/cookiebot-addons-interface.php CHANGED
@@ -26,15 +26,6 @@ Interface Cookiebot_Addons_Interface {
26
*/
27
public function load_configuration();
28
29
- /**
30
- * Returns true if addon has an option to remove tag instead of adding attributes
31
- *
32
- * @return boolean
33
- *
34
- * @since 2.1.0
35
- */
36
- //public function has_remove_tag_option();
37
-
38
/**
39
* Return addon/plugin name
40
*
26
*/
27
public function load_configuration();
28
29
/**
30
* Return addon/plugin name
31
*
addons/controller/addons/custom-facebook-feed-pro/custom-facebook-feed-pro.php CHANGED
@@ -29,7 +29,7 @@ class Custom_Facebook_Feed_Pro implements Cookiebot_Addons_Interface {
29
*
30
* @since 2.1.4
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -74,19 +74,6 @@ class Custom_Facebook_Feed_Pro implements Cookiebot_Addons_Interface {
74
* @since 2.1.4
75
*/
76
public function cookiebot_addon_custom_facebook_feed() {
77
- //Check if Custom Facebook Feed is loaded.
78
- if ( ! shortcode_exists( 'custom-facebook-feed' ) ) {
79
- return;
80
- }
81
- //Check if Cookiebot is activated and active.
82
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
83
- return;
84
- }
85
-
86
- // consent is given
87
- if( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
88
- return;
89
- }
90
91
//Remove cff_js action and replace it with our own
92
if ( has_action( 'wp_footer', 'cff_js' ) ) {
@@ -289,17 +276,6 @@ class Custom_Facebook_Feed_Pro implements Cookiebot_Addons_Interface {
289
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
290
}
291
292
- /**
293
- * Returns true if addon has an option to remove tag instead of adding attributes
294
- *
295
- * @return boolean
296
- *
297
- * @since 2.1.4
298
- */
299
- public function has_remove_tag_option() {
300
- return false;
301
- }
302
-
303
/**
304
* Returns parent class or false
305
*
29
*
30
* @since 2.1.4
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
74
* @since 2.1.4
75
*/
76
public function cookiebot_addon_custom_facebook_feed() {
77
78
//Remove cff_js action and replace it with our own
79
if ( has_action( 'wp_footer', 'cff_js' ) ) {
276
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
277
}
278
279
/**
280
* Returns parent class or false
281
*
addons/controller/addons/custom-facebook-feed/custom-facebook-feed.php CHANGED
@@ -29,7 +29,7 @@ class Custom_Facebook_Feed implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.3.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -74,19 +74,6 @@ class Custom_Facebook_Feed implements Cookiebot_Addons_Interface {
74
* @since 1.1.0
75
*/
76
public function cookiebot_addon_custom_facebook_feed() {
77
- //Check if Custom Facebook Feed is loaded.
78
- if ( ! shortcode_exists( 'custom-facebook-feed' ) ) {
79
- return;
80
- }
81
- //Check if Cookiebot is activated and active.
82
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
83
- return;
84
- }
85
-
86
- // consent is given
87
- if( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
88
- return;
89
- }
90
91
//Remove cff_js action and replace it with our own
92
if ( has_action( 'wp_footer', 'cff_js' ) ) {
@@ -289,17 +276,6 @@ class Custom_Facebook_Feed implements Cookiebot_Addons_Interface {
289
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
290
}
291
292
- /**
293
- * Returns true if addon has an option to remove tag instead of adding attributes
294
- *
295
- * @return boolean
296
- *
297
- * @since 2.1.0
298
- */
299
- public function has_remove_tag_option() {
300
- return false;
301
- }
302
-
303
/**
304
* Returns parent class or false
305
*
29
*
30
* @since 1.3.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
74
* @since 1.1.0
75
*/
76
public function cookiebot_addon_custom_facebook_feed() {
77
78
//Remove cff_js action and replace it with our own
79
if ( has_action( 'wp_footer', 'cff_js' ) ) {
276
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
277
}
278
279
/**
280
* Returns parent class or false
281
*
addons/controller/addons/embed-autocorrect/embed-autocorrect.php CHANGED
@@ -29,7 +29,7 @@ class Embed_Autocorrect implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.3.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -74,16 +74,7 @@ class Embed_Autocorrect implements Cookiebot_Addons_Interface {
74
* @since 1.3.0
75
*/
76
public function cookiebot_addon_embed_autocorrect() {
77
- // Check if Cookiebot is activated and active.
78
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
79
- return;
80
- }
81
-
82
- // consent is given
83
- if ( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
84
- return;
85
- }
86
-
87
//add filters to handle autocorrection in content
88
add_filter( 'the_content', array(
89
$this,
@@ -477,28 +468,6 @@ class Embed_Autocorrect implements Cookiebot_Addons_Interface {
477
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%src - video source</li><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in the frontend</li></ul>';
478
}
479
480
- /**
481
- * Returns true if addon has an option to remove tag instead of adding attributes
482
- *
483
- * @return boolean
484
- *
485
- * @since 2.1.0
486
- */
487
- public function has_remove_tag_option() {
488
- return false;
489
- }
490
-
491
- /**
492
- * Return true if the remove tag option is enabled
493
- *
494
- * @return mixed
495
- *
496
- * @since 2.1.0
497
- */
498
- public function is_remove_tag_enabled() {
499
- return $this->settings->is_remove_tag_enabled( $this->get_option_name() );
500
- }
501
-
502
/**
503
* Returns parent class or false
504
*
29
*
30
* @since 1.3.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
74
* @since 1.3.0
75
*/
76
public function cookiebot_addon_embed_autocorrect() {
77
+
78
//add filters to handle autocorrection in content
79
add_filter( 'the_content', array(
80
$this,
468
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%src - video source</li><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in the frontend</li></ul>';
469
}
470
471
/**
472
* Returns parent class or false
473
*
addons/controller/addons/facebook-for-woocommerce/facebook-for-woocommerce.php CHANGED
@@ -28,7 +28,7 @@ class Facebook_For_Woocommerce implements Cookiebot_Addons_Interface {
28
*
29
* @since 1.3.0
30
*/
31
- protected $cookie_consent;
32
33
/**
34
* @var Buffer_Output_Interface
@@ -73,16 +73,6 @@ class Facebook_For_Woocommerce implements Cookiebot_Addons_Interface {
73
* @since 1.3.0
74
*/
75
public function cookiebot_addon_facebook_for_woocommerce_tracking_code() {
76
- //Check Facebook for Wooocommerce is active
77
- if ( ! class_exists( 'WC_Facebookcommerce' ) ) {
78
- return;
79
- }
80
-
81
- /** Check if consent is given */
82
- if( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
83
- return;
84
- }
85
-
86
87
$this->buffer_output->add_tag( 'woocommerce_after_single_product', 2, array(
88
'fbq(\'ViewContent\'' => $this->get_cookie_types()
@@ -126,14 +116,10 @@ class Facebook_For_Woocommerce implements Cookiebot_Addons_Interface {
126
//We always need to remove this untill consent is given - because we can force no execution before consent it given
127
cookiebot_addons_remove_class_action( 'wp_footer', 'WC_Facebookcommerce_EventsTracker', 'inject_base_pixel_noscript' );
128
129
- if( $this->is_remove_tag_enabled() ) {
130
- cookiebot_addons_remove_class_action( 'wp_head', 'WC_Facebookcommerce_EventsTracker', 'inject_base_pixel' );
131
- }
132
- else {
133
- $this->buffer_output->add_tag( 'wp_head', 10, array(
134
- 'fbq(\'track\',' => $this->get_cookie_types()
135
- ), false );
136
- }
137
}
138
139
/**
@@ -320,27 +306,6 @@ class Facebook_For_Woocommerce implements Cookiebot_Addons_Interface {
320
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
321
}
322
323
- /**
324
- * Returns true if addon has an option to remove tag instead of adding attributes
325
- *
326
- * @return boolean
327
- *
328
- * @since 2.1.0
329
- */
330
- public function has_remove_tag_option() {
331
- return true;
332
- }
333
-
334
- /**
335
- * Return true if the remove tag option is enabled
336
- *
337
- * @return mixed
338
- *
339
- * @since 2.1.0
340
- */
341
- public function is_remove_tag_enabled() {
342
- return $this->settings->is_remove_tag_enabled( $this->get_option_name() );
343
- }
344
345
/**
346
* Returns parent class or false
28
*
29
* @since 1.3.0
30
*/
31
+ public $cookie_consent;
32
33
/**
34
* @var Buffer_Output_Interface
73
* @since 1.3.0
74
*/
75
public function cookiebot_addon_facebook_for_woocommerce_tracking_code() {
76
77
$this->buffer_output->add_tag( 'woocommerce_after_single_product', 2, array(
78
'fbq(\'ViewContent\'' => $this->get_cookie_types()
116
//We always need to remove this untill consent is given - because we can force no execution before consent it given
117
cookiebot_addons_remove_class_action( 'wp_footer', 'WC_Facebookcommerce_EventsTracker', 'inject_base_pixel_noscript' );
118
119
+ $this->buffer_output->add_tag( 'wp_head', 10, array(
120
+ 'fbq(\'track\',' => $this->get_cookie_types()
121
+ ), false );
122
+
123
}
124
125
/**
306
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
307
}
308
309
310
/**
311
* Returns parent class or false
addons/controller/addons/ga-google-analytics/ga-google-analytics.php CHANGED
@@ -29,7 +29,7 @@ class Ga_Google_Analytics implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.3.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -75,24 +75,11 @@ class Ga_Google_Analytics implements Cookiebot_Addons_Interface {
75
* @since 1.1.0
76
*/
77
public function cookiebot_addon_ga_google_analytics() {
78
- //Check if GA Google Analytics is loaded.
79
- if ( ! function_exists( 'ga_google_analytics_init' ) ) {
80
- return;
81
- }
82
- //Check if Cookiebot is activated and active.
83
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
84
- return;
85
- }
86
-
87
- // consent is given
88
- if( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
89
- return;
90
- }
91
92
//Remove GA Google action and replace it with our own
93
if ( has_action( 'wp_head', 'ga_google_analytics_tracking_code' ) ) {
94
$this->buffer_output->add_tag( 'wp_head', 10, array(
95
- 'gtag' => $this->get_cookie_types(),
96
'google-analytics' => $this->get_cookie_types(),
97
'_gaq' => $this->get_cookie_types(),
98
'www.googletagmanager.com/gtag/js?id=' => $this->get_cookie_types()
@@ -103,7 +90,7 @@ class Ga_Google_Analytics implements Cookiebot_Addons_Interface {
103
* Consent not given - no cache
104
*/
105
$this->buffer_output->add_tag( 'wp_footer', 10, array(
106
- 'gtag' => $this->get_cookie_types(),
107
'google-analytics' => $this->get_cookie_types(),
108
'_gaq' => $this->get_cookie_types(),
109
'www.googletagmanager.com/gtag/js?id=' => $this->get_cookie_types()
@@ -295,17 +282,6 @@ class Ga_Google_Analytics implements Cookiebot_Addons_Interface {
295
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
296
}
297
298
- /**
299
- * Returns true if addon has an option to remove tag instead of adding attributes
300
- *
301
- * @return boolean
302
- *
303
- * @since 2.1.0
304
- */
305
- public function has_remove_tag_option() {
306
- return false;
307
- }
308
-
309
/**
310
* Returns parent class or false
311
*
29
*
30
* @since 1.3.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
75
* @since 1.1.0
76
*/
77
public function cookiebot_addon_ga_google_analytics() {
78
79
//Remove GA Google action and replace it with our own
80
if ( has_action( 'wp_head', 'ga_google_analytics_tracking_code' ) ) {
81
$this->buffer_output->add_tag( 'wp_head', 10, array(
82
+ 'gtag(' => $this->get_cookie_types(),
83
'google-analytics' => $this->get_cookie_types(),
84
'_gaq' => $this->get_cookie_types(),
85
'www.googletagmanager.com/gtag/js?id=' => $this->get_cookie_types()
90
* Consent not given - no cache
91
*/
92
$this->buffer_output->add_tag( 'wp_footer', 10, array(
93
+ 'gtag(' => $this->get_cookie_types(),
94
'google-analytics' => $this->get_cookie_types(),
95
'_gaq' => $this->get_cookie_types(),
96
'www.googletagmanager.com/gtag/js?id=' => $this->get_cookie_types()
282
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
283
}
284
285
/**
286
* Returns parent class or false
287
*
addons/controller/addons/gadwp/gadwp.php CHANGED
@@ -29,7 +29,7 @@ class Gadwp implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.3.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -80,21 +80,6 @@ class Gadwp implements Cookiebot_Addons_Interface {
80
* @since 1.1.0
81
*/
82
public function cookiebot_addon_ga_google_analytics() {
83
- //Check if GA Google Analytics is loaded.
84
- if ( ! class_exists( 'GADWP_Manager' ) ) {
85
- return;
86
- }
87
-
88
- //Check if Cookiebot is activated and active.
89
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
90
- return;
91
- }
92
-
93
- // consent is given
94
- if ( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
95
- return;
96
- }
97
-
98
$this->script_loader_tag->add_tag( 'gadwp-nprogress', $this->get_cookie_types() );
99
$this->script_loader_tag->add_tag( 'gadwp-frontend-item-reports', $this->get_cookie_types() );
100
@@ -310,17 +295,6 @@ class Gadwp implements Cookiebot_Addons_Interface {
310
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
311
}
312
313
- /**
314
- * Returns true if addon has an option to remove tag instead of adding attributes
315
- *
316
- * @return boolean
317
- *
318
- * @since 2.1.0
319
- */
320
- public function has_remove_tag_option() {
321
- return false;
322
- }
323
-
324
/**
325
* Returns parent class or false
326
*
29
*
30
* @since 1.3.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
80
* @since 1.1.0
81
*/
82
public function cookiebot_addon_ga_google_analytics() {
83
$this->script_loader_tag->add_tag( 'gadwp-nprogress', $this->get_cookie_types() );
84
$this->script_loader_tag->add_tag( 'gadwp-frontend-item-reports', $this->get_cookie_types() );
85
295
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
296
}
297
298
/**
299
* Returns parent class or false
300
*
addons/controller/addons/google-analyticator/google-analyticator.php CHANGED
@@ -29,7 +29,7 @@ class Google_Analyticator implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.3.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -70,16 +70,6 @@ class Google_Analyticator implements Cookiebot_Addons_Interface {
70
* @since 1.3.0
71
*/
72
public function cookiebot_addon_google_analyticator() {
73
- // Check if Cookiebot is activated and active.
74
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
75
- return;
76
- }
77
-
78
- // consent is given
79
- if( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
80
- return;
81
- }
82
-
83
/**
84
* ga scripts are loaded in wp_head priority set to 99
85
*/
@@ -307,16 +297,6 @@ class Google_Analyticator implements Cookiebot_Addons_Interface {
307
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
308
}
309
310
- /**
311
- * Returns true if addon has an option to remove tag instead of adding attributes
312
- *
313
- * @return boolean
314
- *
315
- * @since 2.1.0
316
- */
317
- public function has_remove_tag_option() {
318
- return false;
319
- }
320
321
/**
322
* Returns parent class or false
29
*
30
* @since 1.3.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
70
* @since 1.3.0
71
*/
72
public function cookiebot_addon_google_analyticator() {
73
/**
74
* ga scripts are loaded in wp_head priority set to 99
75
*/
297
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
298
}
299
300
301
/**
302
* Returns parent class or false
addons/controller/addons/google-analytics-plus/google-analytics-plus.php CHANGED
@@ -29,7 +29,7 @@ class Google_Analytics_Plus implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.5.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -70,31 +70,10 @@ class Google_Analytics_Plus implements Cookiebot_Addons_Interface {
70
* @since 1.5.0
71
*/
72
public function cookiebot_addon_google_analytics_async() {
73
- // Check if Analytify is loaded.
74
- if ( ! class_exists( 'Google_Analytics_Async' ) ) {
75
- return;
76
- }
77
-
78
- // Check if Cookiebot is activated and active.
79
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
80
- return;
81
- }
82
-
83
- // consent is given
84
- if( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
85
- return;
86
- }
87
-
88
-
89
// Disable Analytify if cookie consent not allowed
90
- if( $this->is_remove_tag_enabled() ) {
91
- cookiebot_addons_remove_class_action( 'wp_head', 'Google_Analytics_Async', 'tracking_code_output' );
92
- }
93
- else {
94
- $this->buffer_output->add_tag( 'wp_head', 10, array(
95
- 'GoogleAnalyticsObject' => $this->get_cookie_types(),
96
- ), false );
97
- }
98
}
99
100
/**
@@ -281,27 +260,6 @@ class Google_Analytics_Plus implements Cookiebot_Addons_Interface {
281
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
282
}
283
284
- /**
285
- * Returns true if addon has an option to remove tag instead of adding attributes
286
- *
287
- * @return boolean
288
- *
289
- * @since 2.1.0
290
- */
291
- public function has_remove_tag_option() {
292
- return true;
293
- }
294
-
295
- /**
296
- * Return true if the remove tag option is enabled
297
- *
298
- * @return mixed
299
- *
300
- * @since 2.1.0
301
- */
302
- public function is_remove_tag_enabled() {
303
- return $this->settings->is_remove_tag_enabled( $this->get_option_name() );
304
- }
305
306
/**
307
* Returns parent class or false
29
*
30
* @since 1.5.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
70
* @since 1.5.0
71
*/
72
public function cookiebot_addon_google_analytics_async() {
73
// Disable Analytify if cookie consent not allowed
74
+ $this->buffer_output->add_tag( 'wp_head', 10, array(
75
+ 'GoogleAnalyticsObject' => $this->get_cookie_types(),
76
+ ), false );
77
}
78
79
/**
260
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
261
}
262
263
264
/**
265
* Returns parent class or false
addons/controller/addons/google-analytics/google-analytics.php CHANGED
@@ -29,7 +29,7 @@ class Google_Analytics implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.3.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -70,35 +70,15 @@ class Google_Analytics implements Cookiebot_Addons_Interface {
70
* @since 1.3.0
71
*/
72
public function cookiebot_addon_google_analyticator() {
73
- // Check if Cookiebot is activated and active.
74
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
75
- return;
76
- }
77
78
- // consent is given
79
- if ( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
80
- return;
81
- }
82
83
- if ( !$this->is_addon_enabled() ) {
84
- return;
85
}
86
87
- if( $this->is_remove_tag_enabled() ) {
88
- // disable scripts
89
- remove_action( 'wp_enqueue_scripts', 'Ga_Frontend::platform_sharethis' );
90
- remove_action( 'wp_footer', 'Ga_Frontend::insert_ga_script' );
91
- }
92
- else {
93
- $this->buffer_output->add_tag( 'wp_footer', 10, array(
94
- 'googleanalytics_get_script' => $this->get_cookie_types(),
95
- ), false );
96
-
97
- if(has_action( 'wp_enqueue_scripts', 'Ga_Frontend::platform_sharethis' )) {
98
- $this->script_loader_tag->add_tag( GA_NAME . '-platform-sharethis', $this->get_cookie_types() );
99
- }
100
-
101
- }
102
}
103
104
/**
@@ -285,27 +265,6 @@ class Google_Analytics implements Cookiebot_Addons_Interface {
285
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
286
}
287
288
- /**
289
- * Returns true if addon has an option to remove tag instead of adding attributes
290
- *
291
- * @return boolean
292
- *
293
- * @since 2.1.0
294
- */
295
- public function has_remove_tag_option() {
296
- return true;
297
- }
298
-
299
- /**
300
- * Return true if the remove tag option is enabled
301
- *
302
- * @return mixed
303
- *
304
- * @since 2.1.0
305
- */
306
- public function is_remove_tag_enabled() {
307
- return $this->settings->is_remove_tag_enabled( $this->get_option_name() );
308
- }
309
310
/**
311
* Returns parent class or false
29
*
30
* @since 1.3.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
70
* @since 1.3.0
71
*/
72
public function cookiebot_addon_google_analyticator() {
73
74
+ $this->buffer_output->add_tag( 'wp_footer', 10, array(
75
+ 'googleanalytics_get_script' => $this->get_cookie_types(),
76
+ ), false );
77
78
+ if(has_action( 'wp_enqueue_scripts', 'Ga_Frontend::platform_sharethis' )) {
79
+ $this->script_loader_tag->add_tag( GA_NAME . '-platform-sharethis', $this->get_cookie_types() );
80
}
81
82
}
83
84
/**
265
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
266
}
267
268
269
/**
270
* Returns parent class or false
addons/controller/addons/hubspot-leadin/hubspot-leadin.php CHANGED
@@ -29,7 +29,7 @@ class Hubspot_Leadin implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.3.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -74,22 +74,9 @@ class Hubspot_Leadin implements Cookiebot_Addons_Interface {
74
* @since 1.3.0
75
*/
76
public function cookiebot_addon_hubspot_tracking_code() {
77
- // Check if Cookiebot is activated and active.
78
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
79
- return;
80
- }
81
-
82
- // consent is given
83
- if ( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
84
- return;
85
- }
86
-
87
- if ( $this->is_addon_enabled() && $this->is_addon_activated() ) {
88
- if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
89
- // block the script untill the consent is given
90
- $this->script_loader_tag->add_tag( 'leadin-scriptloader-js', $this->get_cookie_types() );
91
- }
92
- }
93
}
94
95
/**
@@ -277,17 +264,6 @@ class Hubspot_Leadin implements Cookiebot_Addons_Interface {
277
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
278
}
279
280
- /**
281
- * Returns true if addon has an option to remove tag instead of adding attributes
282
- *
283
- * @return boolean
284
- *
285
- * @since 2.1.0
286
- */
287
- public function has_remove_tag_option() {
288
- return false;
289
- }
290
-
291
/**
292
* Returns parent class or false
293
*
29
*
30
* @since 1.3.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
74
* @since 1.3.0
75
*/
76
public function cookiebot_addon_hubspot_tracking_code() {
77
+
78
+ // block the script untill the consent is given
79
+ $this->script_loader_tag->add_tag( 'leadin-scriptloader-js', $this->get_cookie_types() );
80
}
81
82
/**
264
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
265
}
266
267
/**
268
* Returns parent class or false
269
*
addons/controller/addons/hubspot-tracking-code/hubspot-tracking-code.php CHANGED
@@ -31,7 +31,7 @@ class Hubspot_Tracking_Code implements Cookiebot_Addons_Interface {
31
*
32
* @since 1.3.0
33
*/
34
- protected $cookie_consent;
35
36
/**
37
* @var Buffer_Output_Interface
@@ -82,28 +82,15 @@ class Hubspot_Tracking_Code implements Cookiebot_Addons_Interface {
82
return;
83
}
84
85
- // Check if Cookiebot is activated and active.
86
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
87
- return;
88
- }
89
-
90
- // consent is given
91
- if( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
92
- return;
93
- }
94
-
95
// Replace original HubSpot Tracking Code with own one and delete cookie if
96
// it was perviously set.
97
- if ( is_plugin_active( 'hubspot-tracking-code/hubspot-tracking-code.php' ) ) {
98
- /**
99
- * Consent not given - no cache
100
- */
101
- $this->buffer_output->add_tag( 'wp_footer', 10, array( 'hs-script-loader' => $this->get_cookie_types() ), false );
102
-
103
- if ( ! $this->cookie_consent->is_cookie_state_accepted( 'marketing' ) && isset( $_COOKIE['hubspotutk'] ) ) {
104
- unset( $_COOKIE['hubspotutk'] );
105
- }
106
}
107
}
108
109
/**
@@ -290,17 +277,6 @@ class Hubspot_Tracking_Code implements Cookiebot_Addons_Interface {
290
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
291
}
292
293
- /**
294
- * Returns true if addon has an option to remove tag instead of adding attributes
295
- *
296
- * @return boolean
297
- *
298
- * @since 2.1.0
299
- */
300
- public function has_remove_tag_option() {
301
- return false;
302
- }
303
-
304
/**
305
* Returns parent class or false
306
*
31
*
32
* @since 1.3.0
33
*/
34
+ public $cookie_consent;
35
36
/**
37
* @var Buffer_Output_Interface
82
return;
83
}
84
85
// Replace original HubSpot Tracking Code with own one and delete cookie if
86
// it was perviously set.
87
+
88
+ $this->buffer_output->add_tag( 'wp_footer', 10, array( 'hs-script-loader' => $this->get_cookie_types() ), false );
89
+
90
+ if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) && isset( $_COOKIE['hubspotutk'] ) ) {
91
+ unset( $_COOKIE['hubspotutk'] );
92
}
93
+
94
}
95
96
/**
277
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
278
}
279
280
/**
281
* Returns parent class or false
282
*
addons/controller/addons/instagram-feed/instagram-feed.php CHANGED
@@ -29,7 +29,7 @@ class Instagram_Feed implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.3.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -70,21 +70,6 @@ class Instagram_Feed implements Cookiebot_Addons_Interface {
70
* @since 1.3.0
71
*/
72
public function cookiebot_addon_sb_instagram() {
73
- // Check if instagram feed is loaded.
74
- if ( ! defined( 'SBIVER' ) ) {
75
- return;
76
- }
77
-
78
- // Check if Cookiebot is activated and active.
79
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
80
- return;
81
- }
82
-
83
- // consent is given
84
- if( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
85
- return;
86
- }
87
-
88
// External js, so manipulate attributes
89
if ( has_action( 'wp_enqueue_scripts', 'sb_instagram_scripts_enqueue' ) ) {
90
$this->script_loader_tag->add_tag( 'sb_instagram_scripts', $this->get_cookie_types() );
@@ -275,17 +260,6 @@ class Instagram_Feed implements Cookiebot_Addons_Interface {
275
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
276
}
277
278
- /**
279
- * Returns true if addon has an option to remove tag instead of adding attributes
280
- *
281
- * @return boolean
282
- *
283
- * @since 2.1.0
284
- */
285
- public function has_remove_tag_option() {
286
- return false;
287
- }
288
-
289
/**
290
* Returns parent class or false
291
*
29
*
30
* @since 1.3.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
70
* @since 1.3.0
71
*/
72
public function cookiebot_addon_sb_instagram() {
73
// External js, so manipulate attributes
74
if ( has_action( 'wp_enqueue_scripts', 'sb_instagram_scripts_enqueue' ) ) {
75
$this->script_loader_tag->add_tag( 'sb_instagram_scripts', $this->get_cookie_types() );
260
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
261
}
262
263
/**
264
* Returns parent class or false
265
*
addons/controller/addons/jetpack/jetpack.php CHANGED
@@ -43,7 +43,7 @@ class Jetpack implements Cookiebot_Addons_Interface {
43
*
44
* @since 1.3.0
45
*/
46
- protected $cookie_consent;
47
48
/**
49
* @var Buffer_Output_Interface
@@ -80,16 +80,6 @@ class Jetpack implements Cookiebot_Addons_Interface {
80
* @since 1.3.0
81
*/
82
public function load_configuration() {
83
- // Check if Cookiebot is activated and active.
84
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
85
- return;
86
- }
87
-
88
- // consent is given
89
- if ( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
90
- return;
91
- }
92
-
93
// load widgets
94
$this->load_widgets();
95
}
@@ -147,7 +137,7 @@ class Jetpack implements Cookiebot_Addons_Interface {
147
*
148
* @since 2.2.1
149
*/
150
- if( $this->is_addon_installed() && version_compare($this->get_addon_version(), '7', '<' ) ) {
151
/**
152
* Load configuration for googleplus badge widget
153
*
@@ -374,16 +364,6 @@ class Jetpack implements Cookiebot_Addons_Interface {
374
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
375
}
376
377
- /**
378
- * Returns true if addon has an option to remove tag instead of adding attributes
379
- *
380
- * @return boolean
381
- *
382
- * @since 2.1.0
383
- */
384
- public function has_remove_tag_option() {
385
- return false;
386
- }
387
388
/**
389
* Returns parent class or false
43
*
44
* @since 1.3.0
45
*/
46
+ public $cookie_consent;
47
48
/**
49
* @var Buffer_Output_Interface
80
* @since 1.3.0
81
*/
82
public function load_configuration() {
83
// load widgets
84
$this->load_widgets();
85
}
137
*
138
* @since 2.2.1
139
*/
140
+ if( version_compare($this->get_addon_version(), '7', '<' ) ) {
141
/**
142
* Load configuration for googleplus badge widget
143
*
364
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
365
}
366
367
368
/**
369
* Returns parent class or false
addons/controller/addons/jetpack/visitor-cookies.php CHANGED
@@ -74,10 +74,10 @@ class Visitor_Cookies implements Jetpack_Widget_Interface {
74
75
public function load_configuration() {
76
/**
77
- * When preferences consent is not given
78
* Then disable comment cookies
79
*/
80
- if ( ! $this->cookie_consent->is_cookie_state_accepted( 'preferences' ) ) {
81
$this->disable_comment_cookies();
82
$this->do_not_save_mobile_or_web_view();
83
$this->disable_eu_cookie_law();
@@ -278,25 +278,4 @@ class Visitor_Cookies implements Jetpack_Widget_Interface {
278
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
279
}
280
281
- /**
282
- * Returns true if addon has an option to remove tag instead of adding attributes
283
- *
284
- * @return boolean
285
- *
286
- * @since 2.1.0
287
- */
288
- public function has_remove_tag_option() {
289
- return true;
290
- }
291
-
292
- /**
293
- * Return true if the remove tag option is enabled
294
- *
295
- * @return mixed
296
- *
297
- * @since 2.1.0
298
- */
299
- public function is_widget_remove_tag_enabled() {
300
- return $this->settings->is_widget_remove_tag_enabled( $this->widget_option, $this->get_widget_option_name() );
301
- }
302
}
74
75
public function load_configuration() {
76
/**
77
+ * When consent is not given
78
* Then disable comment cookies
79
*/
80
+ if ( ! $this->cookie_consent->is_cookie_state_accepted( $this->get_widget_cookie_types() ) ) {
81
$this->disable_comment_cookies();
82
$this->do_not_save_mobile_or_web_view();
83
$this->disable_eu_cookie_law();
278
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
279
}
280
281
}
addons/controller/addons/jetpack/widget/facebook-widget.php CHANGED
@@ -77,18 +77,29 @@ class Facebook_Widget {
77
}
78
79
public function load_configuration() {
80
if ( is_active_widget( false, false, 'facebook-likebox', true ) ) {
81
if ( $this->is_widget_enabled() ) {
82
/**
83
- * Manipulate script attribute
84
*/
85
- $this->add_consent_attribute_to_facebook_embed_javascript();
86
-
87
- /**
88
- * Display placeholder if allowed in the backend settings
89
- */
90
- if ( $this->is_widget_placeholder_enabled() ) {
91
- add_action( 'jetpack_stats_extra', array( $this, 'cookie_consent_div' ), 10, 2 );
92
}
93
}
94
}
@@ -233,14 +244,4 @@ class Facebook_Widget {
233
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
234
}
235
236
- /**
237
- * Returns true if addon has an option to remove tag instead of adding attributes
238
- *
239
- * @return boolean
240
- *
241
- * @since 2.1.0
242
- */
243
- public function has_remove_tag_option() {
244
- return false;
245
- }
246
}
77
}
78
79
public function load_configuration() {
80
+ /**
81
+ * The widget is active
82
+ */
83
if ( is_active_widget( false, false, 'facebook-likebox', true ) ) {
84
+ /**
85
+ * The widget is enabled in Prior consent
86
+ */
87
if ( $this->is_widget_enabled() ) {
88
/**
89
+ * The visitor didn't check the required cookie types
90
*/
91
+ if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_widget_cookie_types() ) ) {
92
+ /**
93
+ * Manipulate script attribute
94
+ */
95
+ $this->add_consent_attribute_to_facebook_embed_javascript();
96
+
97
+ /**
98
+ * Display placeholder if allowed in the backend settings
99
+ */
100
+ if ( $this->is_widget_placeholder_enabled() ) {
101
+ add_action( 'jetpack_stats_extra', array( $this, 'cookie_consent_div' ), 10, 2 );
102
+ }
103
}
104
}
105
}
244
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
245
}
246
247
}
addons/controller/addons/jetpack/widget/goodreads-widget.php CHANGED
@@ -78,17 +78,29 @@ class Goodreads_Widget implements Jetpack_Widget_Interface {
78
}
79
80
public function load_configuration() {
81
if ( is_active_widget( false, false, 'wpcom-goodreads', true ) ) {
82
if ( $this->is_widget_enabled() ) {
83
- if ( $this->is_widget_placeholder_enabled() ) {
84
- add_action( 'jetpack_stats_extra', array( $this, 'cookie_consent_div' ), 10, 2 );
85
- }
86
87
- $this->transient_name = 'wpcom-goodreads';
88
89
- $this->keywords = array( 'www.goodreads.com' => $this->get_widget_cookie_types() );
90
- $this->block_javascript_file();
91
- $this->output_manipulated();
92
}
93
}
94
}
@@ -288,14 +300,4 @@ class Goodreads_Widget implements Jetpack_Widget_Interface {
288
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
289
}
290
291
- /**
292
- * Returns true if addon has an option to remove tag instead of adding attributes
293
- *
294
- * @return boolean
295
- *
296
- * @since 2.1.0
297
- */
298
- public function has_remove_tag_option() {
299
- return false;
300
- }
301
}
78
}
79
80
public function load_configuration() {
81
+ /**
82
+ * The widget is active
83
+ */
84
if ( is_active_widget( false, false, 'wpcom-goodreads', true ) ) {
85
+ /**
86
+ * The widget is enabled in Prior consent
87
+ */
88
if ( $this->is_widget_enabled() ) {
89
+ /**
90
+ * The visitor didn't check the required cookie types
91
+ */
92
+ if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_widget_cookie_types() ) ) {
93
+
94
+ if ( $this->is_widget_placeholder_enabled() ) {
95
+ add_action( 'jetpack_stats_extra', array( $this, 'cookie_consent_div' ), 10, 2 );
96
+ }
97
98
+ $this->transient_name = 'wpcom-goodreads';
99
100
+ $this->keywords = array( 'www.goodreads.com' => $this->get_widget_cookie_types() );
101
+ $this->block_javascript_file();
102
+ $this->output_manipulated();
103
+ }
104
}
105
}
106
}
300
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
301
}
302
303
}
addons/controller/addons/jetpack/widget/google-maps-widget.php CHANGED
@@ -74,21 +74,29 @@ class Google_Maps_Widget implements Jetpack_Widget_Interface {
74
}
75
76
public function load_configuration() {
77
if ( is_active_widget( false, false, 'widget_contact_info', true ) ) {
78
/**
79
- * Widget is disabled in the backend
80
*/
81
if ( $this->is_widget_enabled() ) {
82
- $this->cookie_types = $this->get_widget_cookie_types();
83
-
84
/**
85
- * Replace attributes of the google maps widget iframe
86
*/
87
- add_action( 'jetpack_contact_info_widget_start', array( $this, 'start_buffer' ) );
88
- add_action( 'jetpack_contact_info_widget_end', array( $this, 'stop_buffer' ) );
89
-
90
- if ( $this->is_widget_placeholder_enabled() ) {
91
- add_action( 'jetpack_stats_extra', array( $this, 'cookie_consent_div' ), 10, 2 );
92
}
93
}
94
}
@@ -289,14 +297,4 @@ class Google_Maps_Widget implements Jetpack_Widget_Interface {
289
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
290
}
291
292
- /**
293
- * Returns true if addon has an option to remove tag instead of adding attributes
294
- *
295
- * @return boolean
296
- *
297
- * @since 2.1.0
298
- */
299
- public function has_remove_tag_option() {
300
- return false;
301
- }
302
}
74
}
75
76
public function load_configuration() {
77
+ /**
78
+ * The widget is active
79
+ */
80
if ( is_active_widget( false, false, 'widget_contact_info', true ) ) {
81
/**
82
+ * The widget is enabled in Prior consent
83
*/
84
if ( $this->is_widget_enabled() ) {
85
/**
86
+ * Cookie types are not selected
87
*/
88
+ if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_widget_cookie_types() ) ) {
89
+ $this->cookie_types = $this->get_widget_cookie_types();
90
+
91
+ /**
92
+ * Replace attributes of the google maps widget iframe
93
+ */
94
+ add_action( 'jetpack_contact_info_widget_start', array( $this, 'start_buffer' ) );
95
+ add_action( 'jetpack_contact_info_widget_end', array( $this, 'stop_buffer' ) );
96
+
97
+ if ( $this->is_widget_placeholder_enabled() ) {
98
+ add_action( 'jetpack_stats_extra', array( $this, 'cookie_consent_div' ), 10, 2 );
99
+ }
100
}
101
}
102
}
297
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
298
}
299
300
}
addons/controller/addons/jetpack/widget/googleplus-badge-widget.php CHANGED
@@ -75,15 +75,25 @@ class Googleplus_Badge_Widget {
75
* Load configuration
76
*/
77
public function load_configuration() {
78
if ( is_active_widget( false, false, 'googleplus-badge', true ) ) {
79
-
80
if ( $this->is_widget_enabled() ) {
81
- $this->cookie_types = $this->get_widget_cookie_types();
82
83
- $this->disable_javascript_file();
84
85
- if ( $this->is_widget_placeholder_enabled() ) {
86
- add_action( 'jetpack_stats_extra', array( $this, 'display_div_message_to_go_to_consent_settings' ), 10, 2 );
87
}
88
}
89
}
@@ -226,14 +236,4 @@ class Googleplus_Badge_Widget {
226
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
227
}
228
229
- /**
230
- * Returns true if addon has an option to remove tag instead of adding attributes
231
- *
232
- * @return boolean
233
- *
234
- * @since 2.1.0
235
- */
236
- public function has_remove_tag_option() {
237
- return false;
238
- }
239
}
75
* Load configuration
76
*/
77
public function load_configuration() {
78
+ /**
79
+ * The widget is active
80
+ */
81
if ( is_active_widget( false, false, 'googleplus-badge', true ) ) {
82
+ /**
83
+ * The widget is enabled in Prior consent
84
+ */
85
if ( $this->is_widget_enabled() ) {
86
+ /**
87
+ * The visitor didn't check the required cookie types
88
+ */
89
+ if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_widget_cookie_types() ) ) {
90
+ $this->cookie_types = $this->get_widget_cookie_types();
91
92
+ $this->disable_javascript_file();
93
94
+ if ( $this->is_widget_placeholder_enabled() ) {
95
+ add_action( 'jetpack_stats_extra', array( $this, 'display_div_message_to_go_to_consent_settings' ), 10, 2 );
96
+ }
97
}
98
}
99
}
236
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
237
}
238
239
}
addons/controller/addons/jetpack/widget/internet-defense-league-widget.php CHANGED
@@ -71,31 +71,33 @@ class Internet_Defense_league_Widget implements Jetpack_Widget_Interface {
71
}
72
73
public function load_configuration() {
74
if ( is_active_widget( false, false, 'internet_defense_league_widget', true ) ) {
75
-
76
if ( $this->is_widget_enabled() ) {
77
-
78
/**
79
- * Remove wp_footer script when the cookieconsent for marketing is not given
80
- *
81
- * @since 1.2.0
82
*/
83
if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_widget_cookie_types() ) ) {
84
- if( $this->is_widget_remove_tag_enabled() ) {
85
- cookiebot_addons_remove_class_action( 'wp_footer', 'Jetpack_Internet_Defense_League_Widget', 'footer_script' );
86
}
87
- else {
88
- $this->buffer_output->add_tag( 'wp_footer', 10, array(
89
- 'window._idl' => $this->get_widget_cookie_types(),
90
- ), false );
91
- }
92
- }
93
-
94
- /**
95
- * Display placeholder if allowed in the backend settings
96
- */
97
- if ( $this->is_widget_placeholder_enabled() ) {
98
- add_action( 'jetpack_stats_extra', array( $this, 'cookie_consent_div' ), 10, 2 );
99
}
100
}
101
}
@@ -230,25 +232,4 @@ class Internet_Defense_league_Widget implements Jetpack_Widget_Interface {
230
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
231
}
232
233
- /**
234
- * Returns true if addon has an option to remove tag instead of adding attributes
235
- *
236
- * @return boolean
237
- *
238
- * @since 2.1.0
239
- */
240
- public function has_remove_tag_option() {
241
- return true;
242
- }
243
-
244
- /**
245
- * Return true if the remove tag option is enabled
246
- *
247
- * @return mixed
248
- *
249
- * @since 2.1.0
250
- */
251
- public function is_widget_remove_tag_enabled() {
252
- return $this->settings->is_widget_remove_tag_enabled( $this->widget_option, $this->get_widget_option_name() );
253
- }
254
- }
71
}
72
73
public function load_configuration() {
74
+ /**
75
+ * The widget is active
76
+ */
77
if ( is_active_widget( false, false, 'internet_defense_league_widget', true ) ) {
78
+ /**
79
+ * The widget is enabled in Prior consent
80
+ */
81
if ( $this->is_widget_enabled() ) {
82
/**
83
+ * The visitor didn't check the required cookie types
84
*/
85
if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_widget_cookie_types() ) ) {
86
+ /**
87
+ * Remove wp_footer script when the cookieconsent for marketing is not given
88
+ *
89
+ * @since 1.2.0
90
+ */
91
+ $this->buffer_output->add_tag( 'wp_footer', 10, array(
92
+ 'window._idl' => $this->get_widget_cookie_types(),
93
+ ), false );
94
+
95
+ /**
96
+ * Display placeholder if allowed in the backend settings
97
+ */
98
+ if ( $this->is_widget_placeholder_enabled() ) {
99
+ add_action( 'jetpack_stats_extra', array( $this, 'cookie_consent_div' ), 10, 2 );
100
}
101
}
102
}
103
}
232
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
233
}
234
235
+ }
addons/controller/addons/jetpack/widget/twitter-timeline-widget.php CHANGED
@@ -71,14 +71,25 @@ class Twitter_Timeline_Widget {
71
}
72
73
public function load_configuration() {
74
if ( is_active_widget( false, false, 'twitter_timeline', true ) ) {
75
if ( $this->is_widget_enabled() ) {
76
- $this->cookie_types = $this->get_widget_cookie_types();
77
78
- $this->disable_javascript_file();
79
80
- if ( $this->is_widget_placeholder_enabled() ) {
81
- add_action( 'jetpack_stats_extra', array( $this, 'display_div_message_to_go_to_consent_settings' ), 10, 2 );
82
}
83
}
84
}
@@ -220,14 +231,4 @@ class Twitter_Timeline_Widget {
220
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
221
}
222
223
- /**
224
- * Returns true if addon has an option to remove tag instead of adding attributes
225
- *
226
- * @return boolean
227
- *
228
- * @since 2.1.0
229
- */
230
- public function has_remove_tag_option() {
231
- return false;
232
- }
233
}
71
}
72
73
public function load_configuration() {
74
+ /**
75
+ * The widget is active
76
+ */
77
if ( is_active_widget( false, false, 'twitter_timeline', true ) ) {
78
+ /**
79
+ * The widget is enabled in Prior consent
80
+ */
81
if ( $this->is_widget_enabled() ) {
82
+ /**
83
+ * The visitor didn't check the required cookie types
84
+ */
85
+ if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_widget_cookie_types() ) ) {
86
+ $this->cookie_types = $this->get_widget_cookie_types();
87
88
+ $this->disable_javascript_file();
89
90
+ if ( $this->is_widget_placeholder_enabled() ) {
91
+ add_action( 'jetpack_stats_extra', array( $this, 'display_div_message_to_go_to_consent_settings' ), 10, 2 );
92
+ }
93
}
94
}
95
}
231
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
232
}
233
234
}
addons/controller/addons/ninja-forms/ninja-forms.php CHANGED
@@ -29,7 +29,7 @@ class Ninja_Forms implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.3.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -74,36 +74,23 @@ class Ninja_Forms implements Cookiebot_Addons_Interface {
74
* @since 1.3.0
75
*/
76
public function cookiebot_addon_ninja_forms() {
77
- // Check if Cookiebot is activated and active.
78
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
79
- return;
80
- }
81
-
82
- // consent is given
83
- if ( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
84
- return;
85
- }
86
87
- if ( $this->is_addon_enabled() && $this->is_addon_activated() ) {
88
- /**
89
- * block google captcha script
90
- */
91
- $this->script_loader_tag->add_tag( 'nf-google-recaptcha', $this->get_cookie_types() );
92
-
93
- /**
94
- * Display placeholder message
95
- */
96
- if ( $this->is_placeholder_enabled() ) {
97
- add_filter( 'ninja_forms_display_fields', function ( $fields ) {
98
- foreach ( $fields as $key => $field ) {
99
- if ( $field['type'] == 'recaptcha' ) {
100
- $fields[ $key ]['afterField'] = $this->get_placeholder();
101
- }
102
}
103
-
104
- return $fields;
105
- }, 10, 1 );
106
- }
107
}
108
}
109
@@ -292,17 +279,6 @@ class Ninja_Forms implements Cookiebot_Addons_Interface {
292
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
293
}
294
295
- /**
296
- * Returns true if addon has an option to remove tag instead of adding attributes
297
- *
298
- * @return boolean
299
- *
300
- * @since 2.1.0
301
- */
302
- public function has_remove_tag_option() {
303
- return false;
304
- }
305
-
306
/**
307
* Returns parent class or false
308
*
29
*
30
* @since 1.3.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
74
* @since 1.3.0
75
*/
76
public function cookiebot_addon_ninja_forms() {
77
+ /**
78
+ * block google captcha script
79
+ */
80
+ $this->script_loader_tag->add_tag( 'nf-google-recaptcha', $this->get_cookie_types() );
81
82
+ /**
83
+ * Display placeholder message
84
+ */
85
+ if ( $this->is_placeholder_enabled() ) {
86
+ add_filter( 'ninja_forms_display_fields', function ( $fields ) {
87
+ foreach ( $fields as $key => $field ) {
88
+ if ( $field['type'] == 'recaptcha' ) {
89
+ $fields[ $key ]['afterField'] = $this->get_placeholder();
90
}
91
+ }
92
+ return $fields;
93
+ }, 10, 1 );
94
}
95
}
96
279
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
280
}
281
282
/**
283
* Returns parent class or false
284
*
addons/controller/addons/optinmonster/optinmonster.php CHANGED
@@ -29,7 +29,7 @@ class Optinmonster implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.3.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -70,21 +70,7 @@ class Optinmonster implements Cookiebot_Addons_Interface {
70
* @since 1.3.0
71
*/
72
public function cookiebot_addon_optinmonster() {
73
- // Check if Cookiebot is activated and active.
74
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
75
- return;
76
- }
77
-
78
- // consent is given
79
- if ( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
80
- return;
81
- }
82
-
83
- if ( $this->is_addon_enabled() ) {
84
- if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
85
- $this->script_loader_tag->add_tag( 'optinmonster-api-script', $this->get_cookie_types() );
86
- }
87
- }
88
}
89
90
/**
@@ -271,16 +257,6 @@ class Optinmonster implements Cookiebot_Addons_Interface {
271
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
272
}
273
274
- /**
275
- * Returns true if addon has an option to remove tag instead of adding attributes
276
- *
277
- * @return boolean
278
- *
279
- * @since 2.1.0
280
- */
281
- public function has_remove_tag_option() {
282
- return false;
283
- }
284
285
/**
286
* Returns parent class or false
29
*
30
* @since 1.3.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
70
* @since 1.3.0
71
*/
72
public function cookiebot_addon_optinmonster() {
73
+ $this->script_loader_tag->add_tag( 'optinmonster-api-script', $this->get_cookie_types() );
74
}
75
76
/**
257
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
258
}
259
260
261
/**
262
* Returns parent class or false
addons/controller/addons/pixel-caffeine/pixel-caffeine.php CHANGED
@@ -29,7 +29,7 @@ class Pixel_Caffeine implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.4.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -70,36 +70,16 @@ class Pixel_Caffeine implements Cookiebot_Addons_Interface {
70
* @since 1.4.0
71
*/
72
public function cookiebot_addon_pixel_caffeine() {
73
- // Check if Pixel Caffeine is loaded.
74
- if ( ! defined( 'AEPC_PLUGIN_FILE' ) ) {
75
- return;
76
- }
77
-
78
- // Check if Cookiebot is activated and active.
79
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
80
- return;
81
- }
82
-
83
- // consent is given
84
- if( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
85
- return;
86
- }
87
-
88
$this->script_loader_tag->add_tag( 'aepc-pixel-events', array( 'facebook' => $this->get_cookie_types() ) );
89
90
- if( $this->is_remove_tag_enabled() ) {
91
- cookiebot_addons_remove_class_action( 'wp_head', 'AEPC_Pixel_Scripts', 'pixel_init', 99 );
92
- cookiebot_addons_remove_class_action( 'wp_footer', 'AEPC_Pixel_Scripts', 'pixel_init', 1 );
93
- }
94
- else {
95
- $this->buffer_output->add_tag( 'wp_head', 99, array(
96
- 'aepc_pixel' => $this->get_cookie_types(),
97
- ), false );
98
-
99
- $this->buffer_output->add_tag( 'wp_footer', 1, array(
100
- 'aepc_pixel' => $this->get_cookie_types(),
101
- ), false );
102
- }
103
}
104
105
/**
@@ -286,28 +266,6 @@ class Pixel_Caffeine implements Cookiebot_Addons_Interface {
286
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
287
}
288
289
- /**
290
- * Returns true if addon has an option to remove tag instead of adding attributes
291
- *
292
- * @return boolean
293
- *
294
- * @since 2.1.0
295
- */
296
- public function has_remove_tag_option() {
297
- return true;
298
- }
299
-
300
- /**
301
- * Return true if the remove tag option is enabled
302
- *
303
- * @return mixed
304
- *
305
- * @since 2.1.0
306
- */
307
- public function is_remove_tag_enabled() {
308
- return $this->settings->is_remove_tag_enabled( $this->get_option_name() );
309
- }
310
-
311
/**
312
* Returns parent class or false
313
*
29
*
30
* @since 1.4.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
70
* @since 1.4.0
71
*/
72
public function cookiebot_addon_pixel_caffeine() {
73
$this->script_loader_tag->add_tag( 'aepc-pixel-events', array( 'facebook' => $this->get_cookie_types() ) );
74
75
+ $this->buffer_output->add_tag( 'wp_head', 99, array(
76
+ 'aepc_pixel' => $this->get_cookie_types(),
77
+ ), false );
78
+
79
+ $this->buffer_output->add_tag( 'wp_footer', 1, array(
80
+ 'aepc_pixel' => $this->get_cookie_types(),
81
+ ), false );
82
+
83
}
84
85
/**
266
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
267
}
268
269
/**
270
* Returns parent class or false
271
*
addons/controller/addons/wd-google-analytics/wd-google-analytics.php CHANGED
@@ -29,7 +29,7 @@ class Wd_Google_Analytics implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.3.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -70,29 +70,9 @@ class Wd_Google_Analytics implements Cookiebot_Addons_Interface {
70
* @since 1.3.0
71
*/
72
public function disable_cookies() {
73
- // Check if WD google analytics is loaded.
74
- if ( ! defined( 'GWD_NAME' ) ) {
75
- return;
76
- }
77
-
78
- // Check if Cookiebot is activated and active.
79
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
80
- return;
81
- }
82
-
83
- // consent is given
84
- if ( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
85
- return;
86
- }
87
-
88
- if ( $this->is_remove_tag_enabled() ) {
89
- // Disable WD google analytics wp_head hook if consent not given
90
- cookiebot_addons_remove_class_action( 'wp_head', 'GAWD', 'gawd_tracking_code', 99 );
91
- } else {
92
- $this->buffer_output->add_tag( 'wp_head', 99, array(
93
- 'GoogleAnalyticsObject' => $this->get_cookie_types(),
94
- ), false );
95
- }
96
97
}
98
@@ -280,28 +260,6 @@ class Wd_Google_Analytics implements Cookiebot_Addons_Interface {
280
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
281
}
282
283
- /**
284
- * Returns true if addon has an option to remove tag instead of adding attributes
285
- *
286
- * @return boolean
287
- *
288
- * @since 2.1.0
289
- */
290
- public function has_remove_tag_option() {
291
- return true;
292
- }
293
-
294
- /**
295
- * Return true if the remove tag option is enabled
296
- *
297
- * @return mixed
298
- *
299
- * @since 2.1.0
300
- */
301
- public function is_remove_tag_enabled() {
302
- return $this->settings->is_remove_tag_enabled( $this->get_option_name() );
303
- }
304
-
305
/**
306
* Returns parent class or false
307
*
29
*
30
* @since 1.3.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
70
* @since 1.3.0
71
*/
72
public function disable_cookies() {
73
+ $this->buffer_output->add_tag( 'wp_head', 99, array(
74
+ 'GoogleAnalyticsObject' => $this->get_cookie_types(),
75
+ ), false );
76
77
}
78
260
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
261
}
262
263
/**
264
* Returns parent class or false
265
*
addons/controller/addons/wp-analytify/wp-analytify.php CHANGED
@@ -29,7 +29,7 @@ class Wp_Analytify implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.5.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -70,21 +70,6 @@ class Wp_Analytify implements Cookiebot_Addons_Interface {
70
* @since 1.5.0
71
*/
72
public function cookiebot_addon_analytify() {
73
- // Check if Analytify is loaded.
74
- if ( ! class_exists( 'WP_Analytify' ) ) {
75
- return;
76
- }
77
-
78
- // Check if Cookiebot is activated and active.
79
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
80
- return;
81
- }
82
-
83
- // consent is given
84
- if( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
85
- return;
86
- }
87
-
88
// Disable Analytify if cookie consent not allowed
89
cookiebot_addons_remove_class_action( 'wp_head', 'WP_Analytify', 'analytify_add_analytics_code' );
90
}
@@ -273,16 +258,6 @@ class Wp_Analytify implements Cookiebot_Addons_Interface {
273
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
274
}
275
276
- /**
277
- * Returns true if addon has an option to remove tag instead of adding attributes
278
- *
279
- * @return boolean
280
- *
281
- * @since 2.1.0
282
- */
283
- public function has_remove_tag_option() {
284
- return false;
285
- }
286
287
/**
288
* Returns parent class or false
29
*
30
* @since 1.5.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
70
* @since 1.5.0
71
*/
72
public function cookiebot_addon_analytify() {
73
// Disable Analytify if cookie consent not allowed
74
cookiebot_addons_remove_class_action( 'wp_head', 'WP_Analytify', 'analytify_add_analytics_code' );
75
}
258
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
259
}
260
261
262
/**
263
* Returns parent class or false
addons/controller/addons/wp-piwik/wp-piwik.php CHANGED
@@ -32,7 +32,7 @@ class Wp_Piwik implements Cookiebot_Addons_Interface {
32
*
33
* @since 1.3.0
34
*/
35
- protected $cookie_consent;
36
37
/**
38
* @var Buffer_Output_Interface
@@ -51,11 +51,16 @@ class Wp_Piwik implements Cookiebot_Addons_Interface {
51
*
52
* @since 1.3.0
53
*/
54
- public function __construct( Settings_Service_Interface $settings, Script_Loader_Tag_Interface $script_loader_tag, Cookie_Consent_Interface $cookie_consent, Buffer_Output_Interface $buffer_output ) {
55
- $this->settings = $settings;
56
$this->script_loader_tag = $script_loader_tag;
57
- $this->cookie_consent = $cookie_consent;
58
- $this->buffer_output = $buffer_output;
59
}
60
61
/**
@@ -76,18 +81,22 @@ class Wp_Piwik implements Cookiebot_Addons_Interface {
76
* @since 1.3.0
77
*/
78
public function cookiebot_addon_wp_piwik() {
79
- // Check if Cookiebot is activated and active.
80
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
81
- return;
82
- }
83
-
84
- //If plugin activated and no consent block wp-piwik global option.
85
- if ( is_plugin_active( 'wp-piwik/wp-piwik.php' ) ) {
86
- if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
87
- update_option( 'wp-piwik_global-disable_cookies', 1 );
88
- }else{
89
- update_option( 'wp-piwik_global-disable_cookies', 0 );
90
- }
91
}
92
}
93
@@ -206,7 +215,10 @@ class Wp_Piwik implements Cookiebot_Addons_Interface {
206
* @since 1.8.0
207
*/
208
public function get_placeholder( $src = '' ) {
209
- return $this->settings->get_placeholder( $this->get_option_name(), $this->get_default_placeholder(), cookiebot_addons_output_cookie_types( $this->get_cookie_types() ), $src );
210
}
211
212
/**
@@ -275,16 +287,6 @@ class Wp_Piwik implements Cookiebot_Addons_Interface {
275
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
276
}
277
278
- /**
279
- * Returns true if addon has an option to remove tag instead of adding attributes
280
- *
281
- * @return boolean
282
- *
283
- * @since 2.1.0
284
- */
285
- public function has_remove_tag_option() {
286
- return false;
287
- }
288
289
/**
290
* Returns parent class or false
32
*
33
* @since 1.3.0
34
*/
35
+ public $cookie_consent;
36
37
/**
38
* @var Buffer_Output_Interface
51
*
52
* @since 1.3.0
53
*/
54
+ public function __construct(
55
+ Settings_Service_Interface $settings,
56
+ Script_Loader_Tag_Interface $script_loader_tag,
57
+ Cookie_Consent_Interface $cookie_consent,
58
+ Buffer_Output_Interface $buffer_output
59
+ ) {
60
+ $this->settings = $settings;
61
$this->script_loader_tag = $script_loader_tag;
62
+ $this->cookie_consent = $cookie_consent;
63
+ $this->buffer_output = $buffer_output;
64
}
65
66
/**
81
* @since 1.3.0
82
*/
83
public function cookiebot_addon_wp_piwik() {
84
+ if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
85
+ // wp_footer
86
+ $this->buffer_output->add_tag( 'wp_footer',
87
+ 10,
88
+ array(
89
+ 'matomo' => $this->get_cookie_types(),
90
+ ),
91
+ false );
92
+
93
+ // wp_head
94
+ $this->buffer_output->add_tag( 'wp_head',
95
+ 10,
96
+ array(
97
+ 'matomo' => $this->get_cookie_types(),
98
+ ),
99
+ false );
100
}
101
}
102
215
* @since 1.8.0
216
*/
217
public function get_placeholder( $src = '' ) {
218
+ return $this->settings->get_placeholder( $this->get_option_name(),
219
+ $this->get_default_placeholder(),
220
+ cookiebot_addons_output_cookie_types( $this->get_cookie_types() ),
221
+ $src );
222
}
223
224
/**
287
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
288
}
289
290
291
/**
292
* Returns parent class or false
addons/controller/addons/wpforms/wpforms.php CHANGED
@@ -29,7 +29,7 @@ class Wpforms implements Cookiebot_Addons_Interface {
29
*
30
* @since 1.3.0
31
*/
32
- protected $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
@@ -70,21 +70,6 @@ class Wpforms implements Cookiebot_Addons_Interface {
70
* @since 1.3.0
71
*/
72
public function cookiebot_addon_wpforms() {
73
- // Check if Add To Any is loaded.
74
- if ( ! function_exists( 'wpforms' ) ) {
75
- return;
76
- }
77
-
78
- // Check if Cookiebot is activated and active.
79
- if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
80
- return;
81
- }
82
-
83
- // consent is given
84
- if ( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
85
- return;
86
- }
87
-
88
add_filter( 'wpforms_disable_entry_user_ip', array( $this, 'gdpr_consent_is_given' ) );
89
add_action( 'wp_footer', array( $this, 'enqueue_script_for_adding_the_cookie_after_the_consent' ), 18 );
90
}
@@ -308,28 +293,6 @@ class Wpforms implements Cookiebot_Addons_Interface {
308
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
309
}
310
311
- /**
312
- * Returns true if addon has an option to remove tag instead of adding attributes
313
- *
314
- * @return boolean
315
- *
316
- * @since 2.1.0
317
- */
318
- public function has_remove_tag_option() {
319
- return false;
320
- }
321
-
322
- /**
323
- * Return true if the remove tag option is enabled
324
- *
325
- * @return mixed
326
- *
327
- * @since 2.1.0
328
- */
329
- public function is_remove_tag_enabled() {
330
- return $this->settings->is_remove_tag_enabled( $this->get_option_name() );
331
- }
332
-
333
/**
334
* Returns parent class or false
335
*
29
*
30
* @since 1.3.0
31
*/
32
+ public $cookie_consent;
33
34
/**
35
* @var Buffer_Output_Interface
70
* @since 1.3.0
71
*/
72
public function cookiebot_addon_wpforms() {
73
add_filter( 'wpforms_disable_entry_user_ip', array( $this, 'gdpr_consent_is_given' ) );
74
add_action( 'wp_footer', array( $this, 'enqueue_script_for_adding_the_cookie_after_the_consent' ), 18 );
75
}
293
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
294
}
295
296
/**
297
* Returns parent class or false
298
*
addons/controller/plugin-controller.php CHANGED
@@ -53,13 +53,23 @@ class Plugin_Controller {
53
* @since 1.2.0
54
*/
55
public function load_active_addons() {
56
/**
57
* Check plugins one by one and load configuration if it is active
58
*
59
* @var $plugin Cookiebot_Addons_Interface
60
*/
61
foreach ( $this->settings_service->get_active_addons() as $plugin ) {
62
- $plugin->load_configuration();
63
}
64
65
/**
53
* @since 1.2.0
54
*/
55
public function load_active_addons() {
56
+ /**
57
+ * Check if Cookiebot is activated and active. Return if cookiebot is inactive
58
+ */
59
+ if ( ! function_exists( 'cookiebot_active' ) || ! cookiebot_active() ) {
60
+ return;
61
+ }
62
+
63
/**
64
* Check plugins one by one and load configuration if it is active
65
*
66
* @var $plugin Cookiebot_Addons_Interface
67
*/
68
foreach ( $this->settings_service->get_active_addons() as $plugin ) {
69
+ if ( ! $plugin->cookie_consent->are_cookie_states_accepted( $plugin->get_cookie_types() )
70
+ || cookiebot_addons_enabled_cache_plugin() ) {
71
+ $plugin->load_configuration();
72
+ }
73
}
74
75
/**
addons/cookiebot-addons-init.php CHANGED
@@ -23,7 +23,7 @@ define( 'COOKIEBOT_ADDONS_BASE_NAME', dirname( plugin_basename( __FILE__ ) ) );
23
/**
24
* Same version as the CookiebotWP
25
*/
26
- define( 'COOKIEBOT_ADDONS_VERSION', '2.1.5' );
27
28
/**
29
* Register autoloader to load files/classes dynamically
23
/**
24
* Same version as the CookiebotWP
25
*/
26
+ define( 'COOKIEBOT_ADDONS_VERSION', '2.4.0' );
27
28
/**
29
* Register autoloader to load files/classes dynamically
addons/lib/buffer/buffer-output.php CHANGED
@@ -29,11 +29,12 @@ class Buffer_Output implements Buffer_Output_Interface {
29
* If tag_name and priority exists
30
* Then merge the keywords
31
*/
32
- if ( in_array( $unique_id, $this->tags ) ) {
33
- $tag->merge_keywords( $keywords );
34
}
35
-
36
- $this->tags[ $unique_id ] = $tag;
37
}
38
39
/**
29
* If tag_name and priority exists
30
* Then merge the keywords
31
*/
32
+ if ( isset( $this->tags[ $unique_id ] ) ) {
33
+ $this->tags[ $unique_id ]->merge_keywords( $keywords );
34
+ }
35
+ else {
36
+ $this->tags[ $unique_id ] = $tag;
37
}
38
}
39
40
/**
addons/lib/helper.php CHANGED
@@ -1,4 +1,30 @@
1
<?php