Cookiebot | GDPR Compliant Cookie Consent and Notice - Version 3.6.5

Version Description

Download this release

Release Info

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

Code changes from version 3.6.2 to 3.6.5

Files changed (35) hide show
  1. addons/controller/addons/add-to-any/add-to-any.php +26 -0
  2. addons/controller/addons/addthis/addthis.php +26 -0
  3. addons/controller/addons/caos-host-analyticsjs-local/caos-host-analyticsjs-local.php +26 -0
  4. addons/controller/addons/cookiebot-addons-interface.php +18 -0
  5. addons/controller/addons/custom-facebook-feed-pro/custom-facebook-feed-pro.php +26 -0
  6. addons/controller/addons/custom-facebook-feed/custom-facebook-feed.php +26 -0
  7. addons/controller/addons/embed-autocorrect/embed-autocorrect.php +639 -638
  8. addons/controller/addons/facebook-for-woocommerce/facebook-for-woocommerce.php +44 -5
  9. addons/controller/addons/ga-google-analytics/ga-google-analytics.php +26 -0
  10. addons/controller/addons/gadwp/gadwp.php +26 -0
  11. addons/controller/addons/google-analyticator/google-analyticator.php +26 -0
  12. addons/controller/addons/google-analytics-plus/google-analytics-plus.php +26 -0
  13. addons/controller/addons/google-analytics/google-analytics.php +26 -0
  14. addons/controller/addons/hubspot-leadin/hubspot-leadin.php +26 -0
  15. addons/controller/addons/hubspot-tracking-code/hubspot-tracking-code.php +26 -0
  16. addons/controller/addons/instagram-feed/instagram-feed.php +26 -0
  17. addons/controller/addons/jetpack/jetpack.php +26 -0
  18. addons/controller/addons/ninja-forms/ninja-forms.php +26 -0
  19. addons/controller/addons/optinmonster/optinmonster.php +26 -0
  20. addons/controller/addons/pixel-caffeine/pixel-caffeine.php +26 -0
  21. addons/controller/addons/wd-google-analytics/wd-google-analytics.php +26 -0
  22. addons/controller/addons/wp-analytify/wp-analytify.php +26 -0
  23. addons/controller/addons/wp-mautic/wp-mautic.php +26 -0
  24. addons/controller/addons/wp-piwik/wp-piwik.php +26 -0
  25. addons/controller/addons/wp-rocket/wp-rocket.php +31 -3
  26. addons/controller/addons/wpforms/wpforms.php +26 -0
  27. addons/cookiebot-addons-init.php +13 -2
  28. addons/lib/helper.php +10 -0
  29. addons/lib/settings-service-interface.php +7 -0
  30. addons/lib/settings-service.php +32 -8
  31. addons/tests/integration/addons/test-facebook-for-woocommerce.php +3 -12
  32. addons/tests/unit/test-addon-file-name.php +1 -1
  33. addons/tests/unit/test-get-option-name.php +1 -1
  34. cookiebot.php +53 -26
  35. readme.txt +11 -3
addons/controller/addons/add-to-any/add-to-any.php CHANGED
@@ -311,4 +311,30 @@ class Add_To_Any implements Cookiebot_Addons_Interface {
311
  public function extra_available_addon_option() {
312
  //do nothing
313
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
314
  }
311
  public function extra_available_addon_option() {
312
  //do nothing
313
  }
314
+
315
+ /**
316
+ * Returns boolean to enable/disable plugin by default
317
+ *
318
+ * @return bool
319
+ *
320
+ * @since 3.6.3
321
+ */
322
+ public function enable_by_default() {
323
+ return false;
324
+ }
325
+
326
+ /**
327
+ * Sets default settings for this addon
328
+ *
329
+ * @return array
330
+ *
331
+ * @since 3.6.3
332
+ */
333
+ public function get_default_enable_setting() {
334
+ return array(
335
+ 'enabled' => 1,
336
+ 'cookie_type' => $this->get_default_cookie_types(),
337
+ 'placeholder' => $this->get_default_placeholder(),
338
+ );
339
+ }
340
  }
addons/controller/addons/addthis/addthis.php CHANGED
@@ -308,4 +308,30 @@ class Addthis implements Cookiebot_Addons_Interface {
308
  public function extra_available_addon_option() {
309
  //do nothing
310
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  }
308
  public function extra_available_addon_option() {
309
  //do nothing
310
  }
311
+
312
+ /**
313
+ * Returns boolean to enable/disable plugin by default
314
+ *
315
+ * @return bool
316
+ *
317
+ * @since 3.6.3
318
+ */
319
+ public function enable_by_default() {
320
+ return false;
321
+ }
322
+
323
+ /**
324
+ * Sets default settings for this addon
325
+ *
326
+ * @return array
327
+ *
328
+ * @since 3.6.3
329
+ */
330
+ public function get_default_enable_setting() {
331
+ return array(
332
+ 'enabled' => 1,
333
+ 'cookie_type' => $this->get_default_cookie_types(),
334
+ 'placeholder' => $this->get_default_placeholder(),
335
+ );
336
+ }
337
  }
addons/controller/addons/caos-host-analyticsjs-local/caos-host-analyticsjs-local.php CHANGED
@@ -345,4 +345,30 @@ class CAOS_Host_Analyticsjs_Local implements Cookiebot_Addons_Interface {
345
  public function extra_available_addon_option() {
346
  //do nothing
347
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
348
  }
345
  public function extra_available_addon_option() {
346
  //do nothing
347
  }
348
+
349
+ /**
350
+ * Returns boolean to enable/disable plugin by default
351
+ *
352
+ * @return bool
353
+ *
354
+ * @since 3.6.3
355
+ */
356
+ public function enable_by_default() {
357
+ return false;
358
+ }
359
+
360
+ /**
361
+ * Sets default settings for this addon
362
+ *
363
+ * @return array
364
+ *
365
+ * @since 3.6.3
366
+ */
367
+ public function get_default_enable_setting() {
368
+ return array(
369
+ 'enabled' => 1,
370
+ 'cookie_type' => $this->get_default_cookie_types(),
371
+ 'placeholder' => $this->get_default_placeholder(),
372
+ );
373
+ }
374
  }
addons/controller/addons/cookiebot-addons-interface.php CHANGED
@@ -196,4 +196,22 @@ Interface Cookiebot_Addons_Interface {
196
  * @since 2.4.5
197
  */
198
  public function extra_available_addon_option();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  }
196
  * @since 2.4.5
197
  */
198
  public function extra_available_addon_option();
199
+
200
+ /**
201
+ * Returns boolean to enable/disable plugin by default
202
+ *
203
+ * @return bool
204
+ *
205
+ * @since 3.6.3
206
+ */
207
+ public function enable_by_default();
208
+
209
+ /**
210
+ * Sets default settings for this addon
211
+ *
212
+ * @return array
213
+ *
214
+ * @since 3.6.3
215
+ */
216
+ public function get_default_enable_setting();
217
  }
addons/controller/addons/custom-facebook-feed-pro/custom-facebook-feed-pro.php CHANGED
@@ -313,4 +313,30 @@ class Custom_Facebook_Feed_Pro implements Cookiebot_Addons_Interface {
313
  public function extra_available_addon_option() {
314
  //do nothing
315
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
  }
313
  public function extra_available_addon_option() {
314
  //do nothing
315
  }
316
+
317
+ /**
318
+ * Returns boolean to enable/disable plugin by default
319
+ *
320
+ * @return bool
321
+ *
322
+ * @since 3.6.3
323
+ */
324
+ public function enable_by_default() {
325
+ return false;
326
+ }
327
+
328
+ /**
329
+ * Sets default settings for this addon
330
+ *
331
+ * @return array
332
+ *
333
+ * @since 3.6.3
334
+ */
335
+ public function get_default_enable_setting() {
336
+ return array(
337
+ 'enabled' => 1,
338
+ 'cookie_type' => $this->get_default_cookie_types(),
339
+ 'placeholder' => $this->get_default_placeholder(),
340
+ );
341
+ }
342
  }
addons/controller/addons/custom-facebook-feed/custom-facebook-feed.php CHANGED
@@ -312,4 +312,30 @@ class Custom_Facebook_Feed implements Cookiebot_Addons_Interface {
312
  public function extra_available_addon_option() {
313
  //do nothing
314
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  }
312
  public function extra_available_addon_option() {
313
  //do nothing
314
  }
315
+
316
+ /**
317
+ * Returns boolean to enable/disable plugin by default
318
+ *
319
+ * @return bool
320
+ *
321
+ * @since 3.6.3
322
+ */
323
+ public function enable_by_default() {
324
+ return false;
325
+ }
326
+
327
+ /**
328
+ * Sets default settings for this addon
329
+ *
330
+ * @return array
331
+ *
332
+ * @since 3.6.3
333
+ */
334
+ public function get_default_enable_setting() {
335
+ return array(
336
+ 'enabled' => 1,
337
+ 'cookie_type' => $this->get_default_cookie_types(),
338
+ 'placeholder' => $this->get_default_placeholder(),
339
+ );
340
+ }
341
  }
addons/controller/addons/embed-autocorrect/embed-autocorrect.php CHANGED
@@ -8,674 +8,675 @@ use cookiebot_addons\lib\script_loader_tag\Script_Loader_Tag_Interface;
8
  use cookiebot_addons\lib\Cookie_Consent_Interface;
9
  use cookiebot_addons\lib\Settings_Service_Interface;
10
 
11
- class Embed_Autocorrect implements Cookiebot_Addons_Interface
12
- {
13
-
14
- /**
15
- * @var Settings_Service_Interface
16
- *
17
- * @since 1.3.0
18
- */
19
- protected $settings;
20
-
21
- /**
22
- * @var Script_Loader_Tag_Interface
23
- *
24
- * @since 1.3.0
25
- */
26
- protected $script_loader_tag;
27
-
28
- /**
29
- * @var Cookie_Consent_Interface
30
- *
31
- * @since 1.3.0
32
- */
33
- public $cookie_consent;
34
-
35
- /**
36
- * @var Buffer_Output_Interface
37
- *
38
- * @since 1.3.0
39
- */
40
- protected $buffer_output;
41
-
42
- /**
43
- * Jetpack constructor.
44
- *
45
- * @param $settings Settings_Service_Interface
46
- * @param $script_loader_tag Script_Loader_Tag_Interface
47
- * @param $cookie_consent Cookie_Consent_Interface
48
- * @param $buffer_output Buffer_Output_Interface
49
- *
50
- * @since 1.2.0
51
- */
52
- public function __construct(
53
- Settings_Service_Interface $settings,
54
- Script_Loader_Tag_Interface $script_loader_tag,
55
- Cookie_Consent_Interface $cookie_consent,
56
- Buffer_Output_Interface $buffer_output
57
- ) {
58
- $this->settings = $settings;
59
- $this->script_loader_tag = $script_loader_tag;
60
- $this->cookie_consent = $cookie_consent;
61
- $this->buffer_output = $buffer_output;
62
- }
63
-
64
- /**
65
- * Loads addon configuration
66
- *
67
- * @since 1.3.0
68
- */
69
- public function load_configuration()
70
- {
71
- /**
72
- * We add the action after wp_loaded and replace the original GA Google
73
- * Analytics action with our own adjusted version.
74
- */
75
- add_action('wp_loaded', array($this, 'cookiebot_addon_embed_autocorrect'));
76
- }
77
-
78
- /**
79
- * Check for embed autocorrect action hooks
80
- *
81
- * @since 1.3.0
82
- */
83
- public function cookiebot_addon_embed_autocorrect()
84
- {
85
-
86
- //add filters to handle autocorrection in content
87
- add_filter('the_content', array(
88
- $this,
89
- 'cookiebot_addon_embed_autocorrect_content',
90
- ), 1000); //Ensure it is executed as the last filter
91
-
92
- //add filters to handle autocorrection in widget text
93
- add_filter('widget_text', array(
94
- $this,
95
- 'cookiebot_addon_embed_autocorrect_content',
96
- ), 1000); //Ensure it is executed as the last filter
97
-
98
-
99
- //add fitler to handle video shortcodes
100
- add_filter('wp_video_shortcode', array(
101
- $this,
102
- 'cookiebot_addon_embed_autocorrect_handle_video',
103
- ), 1000);
104
-
105
- //add fitler to handle audio shortcodes
106
- add_filter('wp_audio_shortcode', array(
107
- $this,
108
- 'cookiebot_addon_embed_autocorrect_handle_audio',
109
- ), 1000);
110
-
111
- add_action('wp_head', array(
112
- $this,
113
- 'cookiebot_addon_embed_autocorrect_javascript',
114
- ));
115
- }
116
-
117
- /**
118
- * Add javascript to handle videos as loaded
119
- *
120
- * @since 1.1.0
121
- */
122
- public function cookiebot_addon_embed_autocorrect_javascript()
123
- {
124
- $library = apply_filters('wp_video_shortcode_library', 'mediaelement');
125
- if ($library === 'mediaelement') {
126
- ?>
127
  <style type="text/css">video.wp-video-shortcode__disabled, audio.wp-audio-shortcode__disabled {
128
  display: none;
129
  }</style>
130
  <script>
131
  window.addEventListener( 'CookiebotOnTagsExecuted', function ( e ) {
132
- if (<?php echo 'Cookiebot.consent.'.implode(' && Cookiebot.consent.',
133
- $this->get_cookie_types()); ?>) {
134
  jQuery( '.wp-video-shortcode__disabled' ).addClass( 'wp-video-shortcode' ).removeClass( 'wp-video-shortcode__disabled' );
135
  jQuery( '.wp-audio-shortcode__disabled' ).addClass( 'wp-audio-shortcode' ).removeClass( 'wp-audio-shortcode__disabled' );
136
  window.wp.mediaelement.initialize();
137
  }
138
  }, false );
139
  </script><?php
140
- }
141
- }
142
-
143
-
144
- /**
145
- * Autocorrection of Vimeo and Youtube tags to make them GDPR compatible
146
- *
147
- * @since 1.1.0
148
- */
149
- public function cookiebot_addon_embed_autocorrect_content($content)
150
- {
151
- //Make sure Cookiebot is active and the user has enabled autocorrection
152
-
153
- preg_match_all('|<div[^>]*id=\"fb-root\">.*?</blockquote>|si', $content, $matches);
154
- foreach ($matches[0] as $match) {
155
- //Find src.
156
- preg_match('|<a href=\"([^\"]*)\">([^<]*)</a></p></blockquote>|', $match, $matchSrc);
157
- $src = $matchSrc[1];
158
-
159
- //Replace - and add cookie consent notice.
160
- $adjusted = str_replace('<script>',
161
- '<script type="text/plain" data-cookieconsent="'.cookiebot_addons_output_cookie_types($this->get_cookie_types()).'">',
162
- $match);
163
-
164
- /**
165
- * Generate placeholder
166
- */
167
- $placeholder = $this->generate_placeholder_with_src(apply_filters('cookiebot_addons_embed_source',
168
- $src));
169
-
170
- /**
171
- * Modify placeholder by Filter
172
- *
173
- * @param $placeholder string Current placeholder text
174
- * @param $src string Source attribute from the embedded video
175
- * @param $this array Array of required cookie types
176
- */
177
- $placeholder = apply_filters('cookiebot_addons_embed_placeholder', $placeholder, $src,
178
- $this->get_cookie_types());
179
-
180
- $adjusted .= $placeholder;
181
- $content = str_replace($match, $adjusted, $content);
182
-
183
- }
184
- unset($matches);
185
-
186
- preg_match_all('|<blockquote[^>]*class=\"twitter-tweet\"[^>]*>.*?</script>|si', $content, $matches);
187
- foreach ($matches[0] as $match) {
188
- //Find src.
189
- preg_match('|<a href=\"([^\"]*)\">([^<]*)</a></blockquote>|', $match, $matchSrc);
190
-
191
- if( empty( $matchSrc )) {
192
- continue;
193
- }
194
-
195
- $src = $matchSrc[1];
196
-
197
- //Replace - and add cookie consent notice.
198
- $adjusted = str_replace('<script ',
199
- '<script type="text/plain" data-cookieconsent="'.cookiebot_addons_output_cookie_types($this->get_cookie_types()).'" ',
200
- $match);
201
-
202
- /**
203
- * Generate placeholder
204
- */
205
- $placeholder = $this->generate_placeholder_with_src(apply_filters('cookiebot_addons_embed_source',
206
- $src));
207
-
208
- /**
209
- * Modify placeholder by Filter
210
- *
211
- * @param $placeholder string Current placeholder text
212
- * @param $src string Source attribute from the embedded video
213
- * @param $this array Array of required cookie types
214
- */
215
- $placeholder = apply_filters('cookiebot_addons_embed_placeholder', $placeholder, $src,
216
- $this->get_cookie_types());
217
-
218
- $adjusted .= $placeholder;
219
- $content = str_replace($match, $adjusted, $content);
220
-
221
- }
222
- unset($matches);
223
-
224
-
225
- //Match all speakerdeck, slideshare, screencast, reverbnation, mixcloud, kickstarter,
226
- // dailymoition, collegehumor, cloudup, animoto, videopress, youtube, vimeo and facebook iframes.
227
- preg_match_all($this->get_regex(),
228
- $content, $matches);
229
-
230
- foreach ($matches[0] as $x => $match) {
231
- /** Get the source attribute value */
232
- $start = strpos($match, ' src=') + 6;
233
- $end = strpos($match, $matches[1][$x], $start);
234
- $src = substr($match, $start, $end - $start);
235
-
236
- /** Skip the matched iframe if the data-cookieconsent attribute exists */
237
- if (strpos($match, 'data-cookieconsent') !== false) {
238
- continue;
239
- }
240
-
241
- /** Replace - and add cookie consent notice. */
242
- $adjusted = str_replace(' src=',
243
- ' data-cookieconsent="'.cookiebot_addons_output_cookie_types($this->get_cookie_types()).'" data-src=',
244
- $match);
245
-
246
- /** Generate placeholder */
247
- $placeholder = $this->generate_placeholder_with_src(apply_filters('cookiebot_addons_embed_source',
248
- $src));
249
-
250
- /**
251
- * Modify placeholder by Filter
252
- *
253
- * @param $placeholder string Current placeholder text
254
- * @param $src string Source attribute from the embedded video
255
- * @param $this array Array of required cookie types
256
- */
257
- $placeholder = apply_filters('cookiebot_addons_embed_placeholder', $placeholder, $src,
258
- $this->get_cookie_types());
259
-
260
- $adjusted .= $placeholder;
261
- $content = str_replace($match, $adjusted, $content);
262
- }
263
-
264
- unset($matches);
265
- preg_match_all('/<script.*(instagram|issuu|imgur|polldaddy|tumblr)+.*<\/script>/mi', $content, $matches);
266
- foreach ($matches[0] as $x => $match) {
267
- //Replace - and add cookie consent notice.
268
- $adjusted = str_replace(' src=',
269
- ' data-cookieconsent="'.cookiebot_addons_output_cookie_types($this->get_cookie_types()).'" data-src=',
270
- $match);
271
- /**
272
- * Generate placeholder
273
- */
274
- $placeholder = $this->generate_placeholder_with_src(apply_filters('cookiebot_addons_embed_source',
275
- $src));
276
- /**
277
- * Modify placeholder by Filter
278
- *
279
- * @param $placeholder string Current placeholder text
280
- * @param $src string Source attribute from the embedded video
281
- * @param $this array Array of required cookie types
282
- */
283
- $placeholder = apply_filters('cookiebot_addons_embed_placeholder', $placeholder, $src,
284
- $this->get_cookie_types());
285
- $adjusted .= $placeholder;
286
- $content = str_replace($match, $adjusted, $content);
287
- }
288
- unset($matches);
289
-
290
-
291
- return $content;
292
- }
293
-
294
- /**
295
- * Implementation of filter wp_video_shortcode - fixing code for cookiebot.
296
- */
297
- public function cookiebot_addon_embed_autocorrect_handle_video(
298
- $output,
299
- $atts = array(),
300
- $video = '',
301
- $post_id = null,
302
- $library = ''
303
- ) {
304
- /* Find src in markup */
305
- preg_match('| src=\"([^\"]*)\"|', $output, $match);
306
- $src = $match[1];
307
-
308
- /**
309
- * Generate placeholder
310
- */
311
- $placeholder = $this->generate_placeholder_with_src(apply_filters('cookiebot_addons_embed_source', $src));
312
- $placeholder = apply_filters('cookiebot_addons_embed_placeholder', $placeholder, $src,
313
- $this->get_cookie_types());
314
-
315
- $output = str_replace('wp-video-shortcode', 'wp-video-shortcode__disabled', $output);
316
- $output = str_replace(' src=',
317
- ' data-cookieconsent="'.cookiebot_addons_output_cookie_types($this->get_cookie_types()).'" data-src=',
318
- $output);
319
- $output .= $placeholder;
320
-
321
- return $output;
322
- }
323
-
324
- /**
325
- * Implementation of filter wp_audio_shortcode - fixing code for cookiebot.
326
- */
327
- public function cookiebot_addon_embed_autocorrect_handle_audio(
328
- $output,
329
- $atts = array(),
330
- $video = '',
331
- $post_id = null,
332
- $library = ''
333
- ) {
334
- /* Find src in markup */
335
- preg_match('| src=\"([^\"]*)\"|', $output, $match);
336
- $src = $match[1];
337
-
338
- /**
339
- * Generate placeholder
340
- */
341
- $placeholder = $this->generate_placeholder_with_src(apply_filters('cookiebot_addons_embed_source', $src));
342
- $placeholder = apply_filters('cookiebot_addons_embed_placeholder', $placeholder, $src,
343
- $this->get_cookie_types());
344
-
345
- $output = str_replace('wp-audio-shortcode', 'wp-audio-shortcode__disabled', $output);
346
- $output = str_replace(' src=',
347
- ' data-cookieconsent="'.cookiebot_addons_output_cookie_types($this->get_cookie_types()).'" data-src=',
348
- $output);
349
- $output .= $placeholder;
350
-
351
- return $output;
352
- }
353
-
354
- /**
355
- * Generates placeholder for given source
356
- *
357
- * @param $src
358
- *
359
- * @return string
360
- */
361
- public function generate_placeholder_with_src($src = '')
362
- {
363
- $cookieContentNotice = '<div class="cookieconsent-optout-'.cookiebot_addons_get_one_cookie_type($this->get_cookie_types()).'">';
364
- $cookieContentNotice .= $this->get_placeholder($src);
365
- $cookieContentNotice .= '</div>';
366
-
367
- return $cookieContentNotice;
368
- }
369
-
370
- /**
371
- * Return addon/plugin name
372
- *
373
- * @return string
374
- *
375
- * @since 1.3.0
376
- */
377
- public function get_addon_name()
378
- {
379
- return 'Embed autocorrect';
380
- }
381
-
382
- /**
383
- * Option name in the database
384
- *
385
- * @return string
386
- *
387
- * @since 1.3.0
388
- */
389
- public function get_option_name()
390
- {
391
- return 'embed_autocorrect';
392
- }
393
-
394
- /**
395
- * Plugin file path
396
- *
397
- * @return string
398
- *
399
- * @since 1.3.0
400
- */
401
- public function get_plugin_file()
402
- {
403
- return false;
404
- }
405
-
406
- /**
407
- * Returns checked cookie types
408
- * @return mixed
409
- *
410
- * @since 1.3.0
411
- */
412
- public function get_cookie_types()
413
- {
414
- return $this->settings->get_cookie_types($this->get_option_name(), $this->get_default_cookie_types());
415
- }
416
-
417
- /**
418
- * Returns default cookie types
419
- * @return array
420
- *
421
- * @since 1.5.0
422
- */
423
- public function get_default_cookie_types()
424
- {
425
- return array('marketing', 'statistics');
426
- }
427
-
428
- /**
429
- * Check if plugin is activated and checked in the backend
430
- *
431
- * @since 1.3.0
432
- */
433
- public function is_addon_enabled()
434
- {
435
- return $this->settings->is_addon_enabled($this->get_option_name());
436
- }
437
-
438
- /**
439
- * Checks if addon is installed
440
- *
441
- * @since 1.3.0
442
- */
443
- public function is_addon_installed()
444
- {
445
- return $this->settings->is_addon_installed($this->get_plugin_file());
446
- }
447
-
448
- /**
449
- * Checks if addon is activated
450
- *
451
- * @since 1.3.0
452
- */
453
- public function is_addon_activated()
454
- {
455
- return $this->settings->is_addon_activated($this->get_plugin_file());
456
- }
457
-
458
- /**
459
- * Retrieves current installed version of the addon
460
- *
461
- * @return bool
462
- *
463
- * @since 2.2.1
464
- */
465
- public function get_addon_version()
466
- {
467
- return false;
468
- }
469
-
470
- /**
471
- * Default placeholder content
472
- *
473
- * @return string
474
- *
475
- * @since 1.8.0
476
- */
477
- public function get_default_placeholder()
478
- {
479
- return 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to watch this video.';
480
- }
481
-
482
- /**
483
- * Get placeholder content
484
- *
485
- * This function will check following features:
486
- * - Current language
487
- *
488
- * @param $src
489
- *
490
- * @return bool|mixed
491
- *
492
- * @since 1.8.0
493
- */
494
- public function get_placeholder($src = '')
495
- {
496
- return $this->settings->get_placeholder($this->get_option_name(), $this->get_default_placeholder(),
497
- cookiebot_addons_output_cookie_types($this->get_cookie_types()), $src);
498
- }
499
-
500
- /**
501
- * Checks if it does have custom placeholder content
502
- *
503
- * @return mixed
504
- *
505
- * @since 1.8.0
506
- */
507
- public function has_placeholder()
508
- {
509
- return $this->settings->has_placeholder($this->get_option_name());
510
- }
511
-
512
- /**
513
- * returns all placeholder contents
514
- *
515
- * @return mixed
516
- *
517
- * @since 1.8.0
518
- */
519
- public function get_placeholders()
520
- {
521
- return $this->settings->get_placeholders($this->get_option_name());
522
- }
523
-
524
- /**
525
- * Return true if the placeholder is enabled
526
- *
527
- * @return mixed
528
- *
529
- * @since 1.8.0
530
- */
531
- public function is_placeholder_enabled()
532
- {
533
- return $this->settings->is_placeholder_enabled($this->get_option_name());
534
- }
535
-
536
- /**
537
- * Adds extra information under the label
538
- *
539
- * @return string
540
- *
541
- * @since 1.8.0
542
- */
543
- public function get_extra_information()
544
- {
545
- return '<p>'.__('Blocks embedded videos from Youtube, Twitter, Vimeo and Facebook.',
546
- 'cookiebot-addons').'</p>';
547
- }
548
-
549
- /**
550
- * Returns the url of WordPress SVN repository or another link where we can verify the plugin file.
551
- *
552
- * @return boolean
553
- *
554
- * @since 1.8.0
555
- */
556
- public function get_svn_url()
557
- {
558
- return false;
559
- }
560
-
561
- /**
562
- * Placeholder helper overlay in the settings page.
563
- *
564
- * @return string
565
- *
566
- * @since 1.8.0
567
- */
568
- public function get_placeholder_helper()
569
- {
570
- 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>';
571
- }
572
-
573
- /**
574
- * Returns parent class or false
575
- *
576
- * @return string|bool
577
- *
578
- * @since 2.1.3
579
- */
580
- public function get_parent_class()
581
- {
582
- return get_parent_class($this);
583
- }
584
-
585
- /**
586
- * Action after enabling the addon on the settings page
587
- *
588
- * @since 2.2.0
589
- */
590
- public function post_hook_after_enabling()
591
- {
592
- //do nothing
593
- }
594
-
595
- /**
596
- * Cookiebot plugin is deactivated
597
- *
598
- * @since 2.2.0
599
- */
600
- public function plugin_deactivated()
601
- {
602
- //do nothing
603
- }
604
-
605
- /**
606
- * Returns regex from the database
607
- * If it does not exist then it will return the default regex
608
- *
609
- * @return string
610
- *
611
- * @since 2.4.6
612
- */
613
- private function get_regex()
614
- {
615
- return apply_filters('cookiebot_embed_regex', $this->settings->get_addon_regex($this->get_option_name(), $this->get_default_regex()));
616
- }
617
-
618
- /**
619
- * Returns the default regex
620
- *
621
- * @return string
622
- *
623
- * @since 2.4.6
624
- */
625
- private function get_default_regex()
626
- {
627
- return apply_filters('cookiebot_embed_default_regex', '/<iframe[^>]* src=("|\').*(facebook\.com|youtu\.be|youtube\.com|youtube-nocookie\.com|player\.vimeo\.com).*[^>].*>.*?<\/iframe>/mi');
628
- }
629
-
630
- /**
631
- * Returns true if the default and the normal regex functions match
632
- *
633
- * @return bool
634
- *
635
- * @since 2.4.6
636
- */
637
- private function is_regex_default() {
638
- return $this->get_regex() === $this->get_default_regex();
639
- }
640
- /**
641
- * @return mixed
642
- *
643
- * @since 2.4.6
644
- */
645
- public function extra_available_addon_option()
646
- {
647
- ?>
648
  <div class="show_advanced_options">
649
- <button class="button button-secondary"><?php _e('Show advanced options', 'cookiebot-addons'); ?></button>
650
  <span class="help-tip"
651
- title="<?php echo __('This is for more advanced users.', 'cookiebot-addons'); ?>"></span>
652
  </div>
653
  <div class="advanced_options">
654
 
655
- <label for="embed_regex"><?php _e('Regex:', 'cookiebot-addons'); ?></label>
656
  <textarea
657
  id="embed_regex"
658
  cols="80"
659
  rows="5"
660
  name="cookiebot_available_addons[<?php echo $this->get_option_name(); ?>][regex]"
661
  disabled
662
- ><?php echo esc_html($this->get_regex()); ?></textarea>
663
 
664
- <?php if( $this->is_regex_default() ) : ?>
665
- <button id="edit_embed_regex" class="button"><?php _e('Edit regex', 'cookiebot-addons'); ?></button>
666
- <?php endif; ?>
667
 
668
  <button
669
  id="btn_default_embed_regex"
670
- class="button<?php echo ($this->is_regex_default()) ? ' hidden' : ''; ?>"
671
  type="button"
672
- value="Reset to default regex"><?php _e('Reset to default regex', 'cookiebot-addons'); ?></button>
673
  <input
674
  type="hidden"
675
  name="default_embed_regex"
676
  id="default_embed_regex"
677
- value="<?php echo esc_html($this->get_default_regex()); ?>"/>
678
  </div>
679
- <?php
680
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
681
  }
8
  use cookiebot_addons\lib\Cookie_Consent_Interface;
9
  use cookiebot_addons\lib\Settings_Service_Interface;
10
 
11
+ class Embed_Autocorrect implements Cookiebot_Addons_Interface {
12
+
13
+ /**
14
+ * @var Settings_Service_Interface
15
+ *
16
+ * @since 1.3.0
17
+ */
18
+ protected $settings;
19
+
20
+ /**
21
+ * @var Script_Loader_Tag_Interface
22
+ *
23
+ * @since 1.3.0
24
+ */
25
+ protected $script_loader_tag;
26
+
27
+ /**
28
+ * @var Cookie_Consent_Interface
29
+ *
30
+ * @since 1.3.0
31
+ */
32
+ public $cookie_consent;
33
+
34
+ /**
35
+ * @var Buffer_Output_Interface
36
+ *
37
+ * @since 1.3.0
38
+ */
39
+ protected $buffer_output;
40
+
41
+ /**
42
+ * Jetpack constructor.
43
+ *
44
+ * @param $settings Settings_Service_Interface
45
+ * @param $script_loader_tag Script_Loader_Tag_Interface
46
+ * @param $cookie_consent Cookie_Consent_Interface
47
+ * @param $buffer_output Buffer_Output_Interface
48
+ *
49
+ * @since 1.2.0
50
+ */
51
+ public function __construct(
52
+ Settings_Service_Interface $settings,
53
+ Script_Loader_Tag_Interface $script_loader_tag,
54
+ Cookie_Consent_Interface $cookie_consent,
55
+ Buffer_Output_Interface $buffer_output
56
+ ) {
57
+ $this->settings = $settings;
58
+ $this->script_loader_tag = $script_loader_tag;
59
+ $this->cookie_consent = $cookie_consent;
60
+ $this->buffer_output = $buffer_output;
61
+ }
62
+
63
+ /**
64
+ * Loads addon configuration
65
+ *
66
+ * @since 1.3.0
67
+ */
68
+ public function load_configuration() {
69
+ /**
70
+ * We add the action after wp_loaded and replace the original GA Google
71
+ * Analytics action with our own adjusted version.
72
+ */
73
+ add_action( 'wp_loaded', array( $this, 'cookiebot_addon_embed_autocorrect' ) );
74
+ }
75
+
76
+ /**
77
+ * Check for embed autocorrect action hooks
78
+ *
79
+ * @since 1.3.0
80
+ */
81
+ public function cookiebot_addon_embed_autocorrect() {
82
+
83
+ //add filters to handle autocorrection in content
84
+ add_filter( 'the_content', array(
85
+ $this,
86
+ 'cookiebot_addon_embed_autocorrect_content',
87
+ ), 1000 ); //Ensure it is executed as the last filter
88
+
89
+ //add filters to handle autocorrection in widget text
90
+ add_filter( 'widget_text', array(
91
+ $this,
92
+ 'cookiebot_addon_embed_autocorrect_content',
93
+ ), 1000 ); //Ensure it is executed as the last filter
94
+
95
+
96
+ //add fitler to handle video shortcodes
97
+ add_filter( 'wp_video_shortcode', array(
98
+ $this,
99
+ 'cookiebot_addon_embed_autocorrect_handle_video',
100
+ ), 1000 );
101
+
102
+ //add fitler to handle audio shortcodes
103
+ add_filter( 'wp_audio_shortcode', array(
104
+ $this,
105
+ 'cookiebot_addon_embed_autocorrect_handle_audio',
106
+ ), 1000 );
107
+
108
+ add_action( 'wp_head', array(
109
+ $this,
110
+ 'cookiebot_addon_embed_autocorrect_javascript',
111
+ ) );
112
+ }
113
+
114
+ /**
115
+ * Add javascript to handle videos as loaded
116
+ *
117
+ * @since 1.1.0
118
+ */
119
+ public function cookiebot_addon_embed_autocorrect_javascript() {
120
+ $library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' );
121
+ if ( $library === 'mediaelement' ) {
122
+ ?>
 
 
 
 
123
  <style type="text/css">video.wp-video-shortcode__disabled, audio.wp-audio-shortcode__disabled {
124
  display: none;
125
  }</style>
126
  <script>
127
  window.addEventListener( 'CookiebotOnTagsExecuted', function ( e ) {
128
+ if (<?php echo 'Cookiebot.consent.' . implode( ' && Cookiebot.consent.',
129
+ $this->get_cookie_types() ); ?>) {
130
  jQuery( '.wp-video-shortcode__disabled' ).addClass( 'wp-video-shortcode' ).removeClass( 'wp-video-shortcode__disabled' );
131
  jQuery( '.wp-audio-shortcode__disabled' ).addClass( 'wp-audio-shortcode' ).removeClass( 'wp-audio-shortcode__disabled' );
132
  window.wp.mediaelement.initialize();
133
  }
134
  }, false );
135
  </script><?php
136
+ }
137
+ }
138
+
139
+
140
+ /**
141
+ * Autocorrection of Vimeo and Youtube tags to make them GDPR compatible
142
+ *
143
+ * @since 1.1.0
144
+ */
145
+ public function cookiebot_addon_embed_autocorrect_content( $content ) {
146
+ //Make sure Cookiebot is active and the user has enabled autocorrection
147
+
148
+ preg_match_all( '|<div[^>]*id=\"fb-root\">.*?</blockquote>|si', $content, $matches );
149
+ foreach ( $matches[0] as $match ) {
150
+ //Find src.
151
+ preg_match( '|<a href=\"([^\"]*)\">([^<]*)</a></p></blockquote>|', $match, $matchSrc );
152
+ $src = $matchSrc[1];
153
+
154
+ //Replace - and add cookie consent notice.
155
+ $adjusted = str_replace( '<script>',
156
+ '<script type="text/plain" data-cookieconsent="' . cookiebot_addons_output_cookie_types( $this->get_cookie_types() ) . '">',
157
+ $match );
158
+
159
+ /**
160
+ * Generate placeholder
161
+ */
162
+ $placeholder = $this->generate_placeholder_with_src( apply_filters( 'cookiebot_addons_embed_source',
163
+ $src ) );
164
+
165
+ /**
166
+ * Modify placeholder by Filter
167
+ *
168
+ * @param $placeholder string Current placeholder text
169
+ * @param $src string Source attribute from the embedded video
170
+ * @param $this array Array of required cookie types
171
+ */
172
+ $placeholder = apply_filters( 'cookiebot_addons_embed_placeholder', $placeholder, $src,
173
+ $this->get_cookie_types() );
174
+
175
+ $adjusted .= $placeholder;
176
+ $content = str_replace( $match, $adjusted, $content );
177
+
178
+ }
179
+ unset( $matches );
180
+
181
+ preg_match_all( '|<blockquote[^>]*class=\"twitter-tweet\"[^>]*>.*?</script>|si', $content, $matches );
182
+ foreach ( $matches[0] as $match ) {
183
+ //Find src.
184
+ preg_match( '|<a href=\"([^\"]*)\">([^<]*)</a></blockquote>|', $match, $matchSrc );
185
+
186
+ if ( empty( $matchSrc ) ) {
187
+ continue;
188
+ }
189
+
190
+ $src = $matchSrc[1];
191
+
192
+ //Replace - and add cookie consent notice.
193
+ $adjusted = str_replace( '<script ',
194
+ '<script type="text/plain" data-cookieconsent="' . cookiebot_addons_output_cookie_types( $this->get_cookie_types() ) . '" ',
195
+ $match );
196
+
197
+ /**
198
+ * Generate placeholder
199
+ */
200
+ $placeholder = $this->generate_placeholder_with_src( apply_filters( 'cookiebot_addons_embed_source',
201
+ $src ) );
202
+
203
+ /**
204
+ * Modify placeholder by Filter
205
+ *
206
+ * @param $placeholder string Current placeholder text
207
+ * @param $src string Source attribute from the embedded video
208
+ * @param $this array Array of required cookie types
209
+ */
210
+ $placeholder = apply_filters( 'cookiebot_addons_embed_placeholder', $placeholder, $src,
211
+ $this->get_cookie_types() );
212
+
213
+ $adjusted .= $placeholder;
214
+ $content = str_replace( $match, $adjusted, $content );
215
+
216
+ }
217
+ unset( $matches );
218
+
219
+
220
+ //Match all speakerdeck, slideshare, screencast, reverbnation, mixcloud, kickstarter,
221
+ // dailymoition, collegehumor, cloudup, animoto, videopress, youtube, vimeo and facebook iframes.
222
+ preg_match_all( $this->get_regex(),
223
+ $content, $matches );
224
+
225
+ foreach ( $matches[0] as $x => $match ) {
226
+ /** Get the source attribute value */
227
+ $start = strpos( $match, ' src=' ) + 6;
228
+ $end = strpos( $match, $matches[1][ $x ], $start );
229
+ $src = substr( $match, $start, $end - $start );
230
+
231
+ /** Skip the matched iframe if the data-cookieconsent attribute exists */
232
+ if ( strpos( $match, 'data-cookieconsent' ) !== false ) {
233
+ continue;
234
+ }
235
+
236
+ /** Replace - and add cookie consent notice. */
237
+ $adjusted = str_replace( ' src=',
238
+ ' data-cookieconsent="' . cookiebot_addons_output_cookie_types( $this->get_cookie_types() ) . '" data-src=',
239
+ $match );
240
+
241
+ /** Generate placeholder */
242
+ $placeholder = $this->generate_placeholder_with_src( apply_filters( 'cookiebot_addons_embed_source',
243
+ $src ) );
244
+
245
+ /**
246
+ * Modify placeholder by Filter
247
+ *
248
+ * @param $placeholder string Current placeholder text
249
+ * @param $src string Source attribute from the embedded video
250
+ * @param $this array Array of required cookie types
251
+ */
252
+ $placeholder = apply_filters( 'cookiebot_addons_embed_placeholder', $placeholder, $src,
253
+ $this->get_cookie_types() );
254
+
255
+ $adjusted .= $placeholder;
256
+ $content = str_replace( $match, $adjusted, $content );
257
+ }
258
+
259
+ unset( $matches );
260
+ preg_match_all( '/<script.*(instagram|issuu|imgur|polldaddy|tumblr)+.*<\/script>/mi', $content, $matches );
261
+ foreach ( $matches[0] as $x => $match ) {
262
+ //Replace - and add cookie consent notice.
263
+ $adjusted = str_replace( ' src=',
264
+ ' data-cookieconsent="' . cookiebot_addons_output_cookie_types( $this->get_cookie_types() ) . '" data-src=',
265
+ $match );
266
+ /**
267
+ * Generate placeholder
268
+ */
269
+ $placeholder = $this->generate_placeholder_with_src( apply_filters( 'cookiebot_addons_embed_source',
270
+ $src ) );
271
+ /**
272
+ * Modify placeholder by Filter
273
+ *
274
+ * @param $placeholder string Current placeholder text
275
+ * @param $src string Source attribute from the embedded video
276
+ * @param $this array Array of required cookie types
277
+ */
278
+ $placeholder = apply_filters( 'cookiebot_addons_embed_placeholder', $placeholder, $src,
279
+ $this->get_cookie_types() );
280
+ $adjusted .= $placeholder;
281
+ $content = str_replace( $match, $adjusted, $content );
282
+ }
283
+ unset( $matches );
284
+
285
+
286
+ return $content;
287
+ }
288
+
289
+ /**
290
+ * Implementation of filter wp_video_shortcode - fixing code for cookiebot.
291
+ */
292
+ public function cookiebot_addon_embed_autocorrect_handle_video(
293
+ $output,
294
+ $atts = array(),
295
+ $video = '',
296
+ $post_id = null,
297
+ $library = ''
298
+ ) {
299
+ /* Find src in markup */
300
+ preg_match( '| src=\"([^\"]*)\"|', $output, $match );
301
+ $src = $match[1];
302
+
303
+ /**
304
+ * Generate placeholder
305
+ */
306
+ $placeholder = $this->generate_placeholder_with_src( apply_filters( 'cookiebot_addons_embed_source', $src ) );
307
+ $placeholder = apply_filters( 'cookiebot_addons_embed_placeholder', $placeholder, $src,
308
+ $this->get_cookie_types() );
309
+
310
+ $output = str_replace( 'wp-video-shortcode', 'wp-video-shortcode__disabled', $output );
311
+ $output = str_replace( ' src=',
312
+ ' data-cookieconsent="' . cookiebot_addons_output_cookie_types( $this->get_cookie_types() ) . '" data-src=',
313
+ $output );
314
+ $output .= $placeholder;
315
+
316
+ return $output;
317
+ }
318
+
319
+ /**
320
+ * Implementation of filter wp_audio_shortcode - fixing code for cookiebot.
321
+ */
322
+ public function cookiebot_addon_embed_autocorrect_handle_audio(
323
+ $output,
324
+ $atts = array(),
325
+ $video = '',
326
+ $post_id = null,
327
+ $library = ''
328
+ ) {
329
+ /* Find src in markup */
330
+ preg_match( '| src=\"([^\"]*)\"|', $output, $match );
331
+ $src = $match[1];
332
+
333
+ /**
334
+ * Generate placeholder
335
+ */
336
+ $placeholder = $this->generate_placeholder_with_src( apply_filters( 'cookiebot_addons_embed_source', $src ) );
337
+ $placeholder = apply_filters( 'cookiebot_addons_embed_placeholder', $placeholder, $src,
338
+ $this->get_cookie_types() );
339
+
340
+ $output = str_replace( 'wp-audio-shortcode', 'wp-audio-shortcode__disabled', $output );
341
+ $output = str_replace( ' src=',
342
+ ' data-cookieconsent="' . cookiebot_addons_output_cookie_types( $this->get_cookie_types() ) . '" data-src=',
343
+ $output );
344
+ $output .= $placeholder;
345
+
346
+ return $output;
347
+ }
348
+
349
+ /**
350
+ * Generates placeholder for given source
351
+ *
352
+ * @param $src
353
+ *
354
+ * @return string
355
+ */
356
+ public function generate_placeholder_with_src( $src = '' ) {
357
+ $cookieContentNotice = '<div class="cookieconsent-optout-' . cookiebot_addons_get_one_cookie_type( $this->get_cookie_types() ) . '">';
358
+ $cookieContentNotice .= $this->get_placeholder( $src );
359
+ $cookieContentNotice .= '</div>';
360
+
361
+ return $cookieContentNotice;
362
+ }
363
+
364
+ /**
365
+ * Return addon/plugin name
366
+ *
367
+ * @return string
368
+ *
369
+ * @since 1.3.0
370
+ */
371
+ public function get_addon_name() {
372
+ return 'Embed autocorrect';
373
+ }
374
+
375
+ /**
376
+ * Option name in the database
377
+ *
378
+ * @return string
379
+ *
380
+ * @since 1.3.0
381
+ */
382
+ public function get_option_name() {
383
+ return 'embed_autocorrect';
384
+ }
385
+
386
+ /**
387
+ * Plugin file path
388
+ *
389
+ * @return string
390
+ *
391
+ * @since 1.3.0
392
+ */
393
+ public function get_plugin_file() {
394
+ return false;
395
+ }
396
+
397
+ /**
398
+ * Returns checked cookie types
399
+ * @return mixed
400
+ *
401
+ * @since 1.3.0
402
+ */
403
+ public function get_cookie_types() {
404
+ return $this->settings->get_cookie_types( $this->get_option_name(), $this->get_default_cookie_types() );
405
+ }
406
+
407
+ /**
408
+ * Returns default cookie types
409
+ * @return array
410
+ *
411
+ * @since 1.5.0
412
+ */
413
+ public function get_default_cookie_types() {
414
+ return array( 'marketing', 'statistics' );
415
+ }
416
+
417
+ /**
418
+ * Check if plugin is activated and checked in the backend
419
+ *
420
+ * @since 1.3.0
421
+ */
422
+ public function is_addon_enabled() {
423
+ return $this->settings->is_addon_enabled( $this->get_option_name() );
424
+ }
425
+
426
+ /**
427
+ * Checks if addon is installed
428
+ *
429
+ * @since 1.3.0
430
+ */
431
+ public function is_addon_installed() {
432
+ return $this->settings->is_addon_installed( $this->get_plugin_file() );
433
+ }
434
+
435
+ /**
436
+ * Checks if addon is activated
437
+ *
438
+ * @since 1.3.0
439
+ */
440
+ public function is_addon_activated() {
441
+ return $this->settings->is_addon_activated( $this->get_plugin_file() );
442
+ }
443
+
444
+ /**
445
+ * Retrieves current installed version of the addon
446
+ *
447
+ * @return bool
448
+ *
449
+ * @since 2.2.1
450
+ */
451
+ public function get_addon_version() {
452
+ return false;
453
+ }
454
+
455
+ /**
456
+ * Default placeholder content
457
+ *
458
+ * @return string
459
+ *
460
+ * @since 1.8.0
461
+ */
462
+ public function get_default_placeholder() {
463
+ return 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to watch this video.';
464
+ }
465
+
466
+ /**
467
+ * Get placeholder content
468
+ *
469
+ * This function will check following features:
470
+ * - Current language
471
+ *
472
+ * @param $src
473
+ *
474
+ * @return bool|mixed
475
+ *
476
+ * @since 1.8.0
477
+ */
478
+ public function get_placeholder( $src = '' ) {
479
+ return $this->settings->get_placeholder( $this->get_option_name(), $this->get_default_placeholder(),
480
+ cookiebot_addons_output_cookie_types( $this->get_cookie_types() ), $src );
481
+ }
482
+
483
+ /**
484
+ * Checks if it does have custom placeholder content
485
+ *
486
+ * @return mixed
487
+ *
488
+ * @since 1.8.0
489
+ */
490
+ public function has_placeholder() {
491
+ return $this->settings->has_placeholder( $this->get_option_name() );
492
+ }
493
+
494
+ /**
495
+ * returns all placeholder contents
496
+ *
497
+ * @return mixed
498
+ *
499
+ * @since 1.8.0
500
+ */
501
+ public function get_placeholders() {
502
+ return $this->settings->get_placeholders( $this->get_option_name() );
503
+ }
504
+
505
+ /**
506
+ * Return true if the placeholder is enabled
507
+ *
508
+ * @return mixed
509
+ *
510
+ * @since 1.8.0
511
+ */
512
+ public function is_placeholder_enabled() {
513
+ return $this->settings->is_placeholder_enabled( $this->get_option_name() );
514
+ }
515
+
516
+ /**
517
+ * Adds extra information under the label
518
+ *
519
+ * @return string
520
+ *
521
+ * @since 1.8.0
522
+ */
523
+ public function get_extra_information() {
524
+ return '<p>' . __( 'Blocks embedded videos from Youtube, Twitter, Vimeo and Facebook.',
525
+ 'cookiebot-addons' ) . '</p>';
526
+ }
527
+
528
+ /**
529
+ * Returns the url of WordPress SVN repository or another link where we can verify the plugin file.
530
+ *
531
+ * @return boolean
532
+ *
533
+ * @since 1.8.0
534
+ */
535
+ public function get_svn_url() {
536
+ return false;
537
+ }
538
+
539
+ /**
540
+ * Placeholder helper overlay in the settings page.
541
+ *
542
+ * @return string
543
+ *
544
+ * @since 1.8.0
545
+ */
546
+ public function get_placeholder_helper() {
547
+ 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>';
548
+ }
549
+
550
+ /**
551
+ * Returns parent class or false
552
+ *
553
+ * @return string|bool
554
+ *
555
+ * @since 2.1.3
556
+ */
557
+ public function get_parent_class() {
558
+ return get_parent_class( $this );
559
+ }
560
+
561
+ /**
562
+ * Action after enabling the addon on the settings page
563
+ *
564
+ * @since 2.2.0
565
+ */
566
+ public function post_hook_after_enabling() {
567
+ //do nothing
568
+ }
569
+
570
+ /**
571
+ * Cookiebot plugin is deactivated
572
+ *
573
+ * @since 2.2.0
574
+ */
575
+ public function plugin_deactivated() {
576
+ //do nothing
577
+ }
578
+
579
+ /**
580
+ * Returns regex from the database
581
+ * If it does not exist then it will return the default regex
582
+ *
583
+ * @return string
584
+ *
585
+ * @since 2.4.6
586
+ */
587
+ private function get_regex() {
588
+ return apply_filters( 'cookiebot_embed_regex',
589
+ $this->settings->get_addon_regex( $this->get_option_name(), $this->get_default_regex() ) );
590
+ }
591
+
592
+ /**
593
+ * Returns the default regex
594
+ *
595
+ * @return string
596
+ *
597
+ * @since 2.4.6
598
+ */
599
+ private function get_default_regex() {
600
+ return apply_filters( 'cookiebot_embed_default_regex',
601
+ '/<iframe[^>]* src=("|\').*(facebook\.com|youtu\.be|youtube\.com|youtube-nocookie\.com|player\.vimeo\.com).*[^>].*>.*?<\/iframe>/mi' );
602
+ }
603
+
604
+ /**
605
+ * Returns true if the default and the normal regex functions match
606
+ *
607
+ * @return bool
608
+ *
609
+ * @since 2.4.6
610
+ */
611
+ private function is_regex_default() {
612
+ return $this->get_regex() === $this->get_default_regex();
613
+ }
614
+
615
+ /**
616
+ * @return mixed
617
+ *
618
+ * @since 2.4.6
619
+ */
620
+ public function extra_available_addon_option() {
621
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
622
  <div class="show_advanced_options">
623
+ <button class="button button-secondary"><?php _e( 'Show advanced options', 'cookiebot-addons' ); ?></button>
624
  <span class="help-tip"
625
+ title="<?php echo __( 'This is for more advanced users.', 'cookiebot-addons' ); ?>"></span>
626
  </div>
627
  <div class="advanced_options">
628
 
629
+ <label for="embed_regex"><?php _e( 'Regex:', 'cookiebot-addons' ); ?></label>
630
  <textarea
631
  id="embed_regex"
632
  cols="80"
633
  rows="5"
634
  name="cookiebot_available_addons[<?php echo $this->get_option_name(); ?>][regex]"
635
  disabled
636
+ ><?php echo esc_html( $this->get_regex() ); ?></textarea>
637
 
638
+ <?php if ( $this->is_regex_default() ) : ?>
639
+ <button id="edit_embed_regex" class="button"><?php _e( 'Edit regex', 'cookiebot-addons' ); ?></button>
640
+ <?php endif; ?>
641
 
642
  <button
643
  id="btn_default_embed_regex"
644
+ class="button<?php echo ( $this->is_regex_default() ) ? ' hidden' : ''; ?>"
645
  type="button"
646
+ value="Reset to default regex"><?php _e( 'Reset to default regex', 'cookiebot-addons' ); ?></button>
647
  <input
648
  type="hidden"
649
  name="default_embed_regex"
650
  id="default_embed_regex"
651
+ value="<?php echo esc_html( $this->get_default_regex() ); ?>"/>
652
  </div>
653
+ <?php
654
+ }
655
+
656
+ /**
657
+ * Returns boolean to enable/disable plugin by default
658
+ *
659
+ * @return bool
660
+ *
661
+ * @since 3.6.3
662
+ */
663
+ public function enable_by_default() {
664
+ return false;
665
+ }
666
+
667
+ /**
668
+ * Sets default settings for this addon
669
+ *
670
+ * @return array
671
+ *
672
+ * @since 3.6.3
673
+ */
674
+ public function get_default_enable_setting() {
675
+ return array(
676
+ 'enabled' => 1,
677
+ 'cookie_type' => $this->get_default_cookie_types(),
678
+ 'placeholder' => $this->get_default_placeholder(),
679
+ 'regex' => $this->get_default_regex(),
680
+ );
681
+ }
682
  }
addons/controller/addons/facebook-for-woocommerce/facebook-for-woocommerce.php CHANGED
@@ -73,7 +73,10 @@ 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
-
 
 
 
77
  $this->buffer_output->add_tag( 'woocommerce_after_single_product', 2, array(
78
  'fbq(\'ViewContent\'' => $this->get_cookie_types()
79
  ), false );
@@ -110,16 +113,26 @@ class Facebook_For_Woocommerce implements Cookiebot_Addons_Interface {
110
  'fbq(\'Purchase\'' => $this->get_cookie_types()
111
  ), false );
112
 
 
 
 
 
113
  /**
114
  * inject base pixel
115
  */
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
  /**
@@ -344,4 +357,30 @@ class Facebook_For_Woocommerce implements Cookiebot_Addons_Interface {
344
  public function extra_available_addon_option() {
345
  //do nothing
346
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
347
  }
73
  * @since 1.3.0
74
  */
75
  public function cookiebot_addon_facebook_for_woocommerce_tracking_code() {
76
+
77
+ add_filter( 'wc_facebook_pixel_script_attributes', array( $this, 'cookiebot_addon_facebook_for_woocommerce_script_attributes' ) );
78
+
79
+ /* Keep for old version */
80
  $this->buffer_output->add_tag( 'woocommerce_after_single_product', 2, array(
81
  'fbq(\'ViewContent\'' => $this->get_cookie_types()
82
  ), false );
113
  'fbq(\'Purchase\'' => $this->get_cookie_types()
114
  ), false );
115
 
116
+ $this->buffer_output->add_tag( 'wp_head', 10, array(
117
+ 'fbq(\'track\',' => $this->get_cookie_types()
118
+ ), false );
119
+
120
  /**
121
  * inject base pixel
122
  */
123
  //We always need to remove this untill consent is given - because we can force no execution before consent it given
124
  cookiebot_addons_remove_class_action( 'wp_footer', 'WC_Facebookcommerce_EventsTracker', 'inject_base_pixel_noscript' );
125
 
126
+ }
127
+
128
+ /**
129
+ * Return attributes for script tags
130
+ */
131
+ function cookiebot_addon_facebook_for_woocommerce_script_attributes() {
132
+ $attr = array();
133
+ $attr['type'] = 'text/plain';
134
+ $attr['data-cookieconsent'] = implode(',',$this->get_cookie_types());
135
+ return $attr;
136
  }
137
 
138
  /**
357
  public function extra_available_addon_option() {
358
  //do nothing
359
  }
360
+
361
+ /**
362
+ * Returns boolean to enable/disable plugin by default
363
+ *
364
+ * @return bool
365
+ *
366
+ * @since 3.6.3
367
+ */
368
+ public function enable_by_default() {
369
+ return false;
370
+ }
371
+
372
+ /**
373
+ * Sets default settings for this addon
374
+ *
375
+ * @return array
376
+ *
377
+ * @since 3.6.3
378
+ */
379
+ public function get_default_enable_setting() {
380
+ return array(
381
+ 'enabled' => 1,
382
+ 'cookie_type' => $this->get_default_cookie_types(),
383
+ 'placeholder' => $this->get_default_placeholder(),
384
+ );
385
+ }
386
  }
addons/controller/addons/ga-google-analytics/ga-google-analytics.php CHANGED
@@ -319,4 +319,30 @@ class Ga_Google_Analytics implements Cookiebot_Addons_Interface {
319
  public function extra_available_addon_option() {
320
  //do nothing
321
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  }
319
  public function extra_available_addon_option() {
320
  //do nothing
321
  }
322
+
323
+ /**
324
+ * Returns boolean to enable/disable plugin by default
325
+ *
326
+ * @return bool
327
+ *
328
+ * @since 3.6.3
329
+ */
330
+ public function enable_by_default() {
331
+ return false;
332
+ }
333
+
334
+ /**
335
+ * Sets default settings for this addon
336
+ *
337
+ * @return array
338
+ *
339
+ * @since 3.6.3
340
+ */
341
+ public function get_default_enable_setting() {
342
+ return array(
343
+ 'enabled' => 1,
344
+ 'cookie_type' => $this->get_default_cookie_types(),
345
+ 'placeholder' => $this->get_default_placeholder(),
346
+ );
347
+ }
348
  }
addons/controller/addons/gadwp/gadwp.php CHANGED
@@ -344,4 +344,30 @@ class Gadwp implements Cookiebot_Addons_Interface {
344
  public function extra_available_addon_option() {
345
  //do nothing
346
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
347
  }
344
  public function extra_available_addon_option() {
345
  //do nothing
346
  }
347
+
348
+ /**
349
+ * Returns boolean to enable/disable plugin by default
350
+ *
351
+ * @return bool
352
+ *
353
+ * @since 3.6.3
354
+ */
355
+ public function enable_by_default() {
356
+ return false;
357
+ }
358
+
359
+ /**
360
+ * Sets default settings for this addon
361
+ *
362
+ * @return array
363
+ *
364
+ * @since 3.6.3
365
+ */
366
+ public function get_default_enable_setting() {
367
+ return array(
368
+ 'enabled' => 1,
369
+ 'cookie_type' => $this->get_default_cookie_types(),
370
+ 'placeholder' => $this->get_default_placeholder(),
371
+ );
372
+ }
373
  }
addons/controller/addons/google-analyticator/google-analyticator.php CHANGED
@@ -335,4 +335,30 @@ class Google_Analyticator implements Cookiebot_Addons_Interface {
335
  public function extra_available_addon_option() {
336
  //do nothing
337
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  }
335
  public function extra_available_addon_option() {
336
  //do nothing
337
  }
338
+
339
+ /**
340
+ * Returns boolean to enable/disable plugin by default
341
+ *
342
+ * @return bool
343
+ *
344
+ * @since 3.6.3
345
+ */
346
+ public function enable_by_default() {
347
+ return false;
348
+ }
349
+
350
+ /**
351
+ * Sets default settings for this addon
352
+ *
353
+ * @return array
354
+ *
355
+ * @since 3.6.3
356
+ */
357
+ public function get_default_enable_setting() {
358
+ return array(
359
+ 'enabled' => 1,
360
+ 'cookie_type' => $this->get_default_cookie_types(),
361
+ 'placeholder' => $this->get_default_placeholder(),
362
+ );
363
+ }
364
  }
addons/controller/addons/google-analytics-plus/google-analytics-plus.php CHANGED
@@ -298,4 +298,30 @@ class Google_Analytics_Plus implements Cookiebot_Addons_Interface {
298
  public function extra_available_addon_option() {
299
  //do nothing
300
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  }
298
  public function extra_available_addon_option() {
299
  //do nothing
300
  }
301
+
302
+ /**
303
+ * Returns boolean to enable/disable plugin by default
304
+ *
305
+ * @return bool
306
+ *
307
+ * @since 3.6.3
308
+ */
309
+ public function enable_by_default() {
310
+ return false;
311
+ }
312
+
313
+ /**
314
+ * Sets default settings for this addon
315
+ *
316
+ * @return array
317
+ *
318
+ * @since 3.6.3
319
+ */
320
+ public function get_default_enable_setting() {
321
+ return array(
322
+ 'enabled' => 1,
323
+ 'cookie_type' => $this->get_default_cookie_types(),
324
+ 'placeholder' => $this->get_default_placeholder(),
325
+ );
326
+ }
327
  }
addons/controller/addons/google-analytics/google-analytics.php CHANGED
@@ -303,4 +303,30 @@ class Google_Analytics implements Cookiebot_Addons_Interface {
303
  public function extra_available_addon_option() {
304
  //do nothing
305
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  }
303
  public function extra_available_addon_option() {
304
  //do nothing
305
  }
306
+
307
+ /**
308
+ * Returns boolean to enable/disable plugin by default
309
+ *
310
+ * @return bool
311
+ *
312
+ * @since 3.6.3
313
+ */
314
+ public function enable_by_default() {
315
+ return false;
316
+ }
317
+
318
+ /**
319
+ * Sets default settings for this addon
320
+ *
321
+ * @return array
322
+ *
323
+ * @since 3.6.3
324
+ */
325
+ public function get_default_enable_setting() {
326
+ return array(
327
+ 'enabled' => 1,
328
+ 'cookie_type' => $this->get_default_cookie_types(),
329
+ 'placeholder' => $this->get_default_placeholder(),
330
+ );
331
+ }
332
  }
addons/controller/addons/hubspot-leadin/hubspot-leadin.php CHANGED
@@ -307,4 +307,30 @@ class Hubspot_Leadin implements Cookiebot_Addons_Interface {
307
  public function extra_available_addon_option() {
308
  //do nothing
309
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
  }
307
  public function extra_available_addon_option() {
308
  //do nothing
309
  }
310
+
311
+ /**
312
+ * Returns boolean to enable/disable plugin by default
313
+ *
314
+ * @return bool
315
+ *
316
+ * @since 3.6.3
317
+ */
318
+ public function enable_by_default() {
319
+ return false;
320
+ }
321
+
322
+ /**
323
+ * Sets default settings for this addon
324
+ *
325
+ * @return array
326
+ *
327
+ * @since 3.6.3
328
+ */
329
+ public function get_default_enable_setting() {
330
+ return array(
331
+ 'enabled' => 1,
332
+ 'cookie_type' => $this->get_default_cookie_types(),
333
+ 'placeholder' => $this->get_default_placeholder(),
334
+ );
335
+ }
336
  }
addons/controller/addons/hubspot-tracking-code/hubspot-tracking-code.php CHANGED
@@ -314,4 +314,30 @@ class Hubspot_Tracking_Code implements Cookiebot_Addons_Interface {
314
  public function extra_available_addon_option() {
315
  //do nothing
316
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  }
314
  public function extra_available_addon_option() {
315
  //do nothing
316
  }
317
+
318
+ /**
319
+ * Returns boolean to enable/disable plugin by default
320
+ *
321
+ * @return bool
322
+ *
323
+ * @since 3.6.3
324
+ */
325
+ public function enable_by_default() {
326
+ return false;
327
+ }
328
+
329
+ /**
330
+ * Sets default settings for this addon
331
+ *
332
+ * @return array
333
+ *
334
+ * @since 3.6.3
335
+ */
336
+ public function get_default_enable_setting() {
337
+ return array(
338
+ 'enabled' => 1,
339
+ 'cookie_type' => $this->get_default_cookie_types(),
340
+ 'placeholder' => $this->get_default_placeholder(),
341
+ );
342
+ }
343
  }
addons/controller/addons/instagram-feed/instagram-feed.php CHANGED
@@ -297,4 +297,30 @@ class Instagram_Feed implements Cookiebot_Addons_Interface {
297
  public function extra_available_addon_option() {
298
  //do nothing
299
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  }
297
  public function extra_available_addon_option() {
298
  //do nothing
299
  }
300
+
301
+ /**
302
+ * Returns boolean to enable/disable plugin by default
303
+ *
304
+ * @return bool
305
+ *
306
+ * @since 3.6.3
307
+ */
308
+ public function enable_by_default() {
309
+ return false;
310
+ }
311
+
312
+ /**
313
+ * Sets default settings for this addon
314
+ *
315
+ * @return array
316
+ *
317
+ * @since 3.6.3
318
+ */
319
+ public function get_default_enable_setting() {
320
+ return array(
321
+ 'enabled' => 1,
322
+ 'cookie_type' => $this->get_default_cookie_types(),
323
+ 'placeholder' => $this->get_default_placeholder(),
324
+ );
325
+ }
326
  }
addons/controller/addons/jetpack/jetpack.php CHANGED
@@ -404,4 +404,30 @@ class Jetpack implements Cookiebot_Addons_Interface {
404
  public function extra_available_addon_option() {
405
  //do nothing
406
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
407
  }
404
  public function extra_available_addon_option() {
405
  //do nothing
406
  }
407
+
408
+ /**
409
+ * Returns boolean to enable/disable plugin by default
410
+ *
411
+ * @return bool
412
+ *
413
+ * @since 3.6.3
414
+ */
415
+ public function enable_by_default() {
416
+ return false;
417
+ }
418
+
419
+ /**
420
+ * Sets default settings for this addon
421
+ *
422
+ * @return array
423
+ *
424
+ * @since 3.6.3
425
+ */
426
+ public function get_default_enable_setting() {
427
+ return array(
428
+ 'enabled' => 1,
429
+ 'cookie_type' => $this->get_default_cookie_types(),
430
+ 'placeholder' => $this->get_default_placeholder(),
431
+ );
432
+ }
433
  }
addons/controller/addons/ninja-forms/ninja-forms.php CHANGED
@@ -316,4 +316,30 @@ class Ninja_Forms implements Cookiebot_Addons_Interface {
316
  public function extra_available_addon_option() {
317
  //do nothing
318
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
  }
316
  public function extra_available_addon_option() {
317
  //do nothing
318
  }
319
+
320
+ /**
321
+ * Returns boolean to enable/disable plugin by default
322
+ *
323
+ * @return bool
324
+ *
325
+ * @since 3.6.3
326
+ */
327
+ public function enable_by_default() {
328
+ return false;
329
+ }
330
+
331
+ /**
332
+ * Sets default settings for this addon
333
+ *
334
+ * @return array
335
+ *
336
+ * @since 3.6.3
337
+ */
338
+ public function get_default_enable_setting() {
339
+ return array(
340
+ 'enabled' => 1,
341
+ 'cookie_type' => $this->get_default_cookie_types(),
342
+ 'placeholder' => $this->get_default_placeholder(),
343
+ );
344
+ }
345
  }
addons/controller/addons/optinmonster/optinmonster.php CHANGED
@@ -295,4 +295,30 @@ class Optinmonster implements Cookiebot_Addons_Interface {
295
  public function extra_available_addon_option() {
296
  //do nothing
297
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  }
295
  public function extra_available_addon_option() {
296
  //do nothing
297
  }
298
+
299
+ /**
300
+ * Returns boolean to enable/disable plugin by default
301
+ *
302
+ * @return bool
303
+ *
304
+ * @since 3.6.3
305
+ */
306
+ public function enable_by_default() {
307
+ return false;
308
+ }
309
+
310
+ /**
311
+ * Sets default settings for this addon
312
+ *
313
+ * @return array
314
+ *
315
+ * @since 3.6.3
316
+ */
317
+ public function get_default_enable_setting() {
318
+ return array(
319
+ 'enabled' => 1,
320
+ 'cookie_type' => $this->get_default_cookie_types(),
321
+ 'placeholder' => $this->get_default_placeholder(),
322
+ );
323
+ }
324
  }
addons/controller/addons/pixel-caffeine/pixel-caffeine.php CHANGED
@@ -303,4 +303,30 @@ class Pixel_Caffeine implements Cookiebot_Addons_Interface {
303
  public function extra_available_addon_option() {
304
  //do nothing
305
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  }
303
  public function extra_available_addon_option() {
304
  //do nothing
305
  }
306
+
307
+ /**
308
+ * Returns boolean to enable/disable plugin by default
309
+ *
310
+ * @return bool
311
+ *
312
+ * @since 3.6.3
313
+ */
314
+ public function enable_by_default() {
315
+ return false;
316
+ }
317
+
318
+ /**
319
+ * Sets default settings for this addon
320
+ *
321
+ * @return array
322
+ *
323
+ * @since 3.6.3
324
+ */
325
+ public function get_default_enable_setting() {
326
+ return array(
327
+ 'enabled' => 1,
328
+ 'cookie_type' => $this->get_default_cookie_types(),
329
+ 'placeholder' => $this->get_default_placeholder(),
330
+ );
331
+ }
332
  }
addons/controller/addons/wd-google-analytics/wd-google-analytics.php CHANGED
@@ -297,4 +297,30 @@ class Wd_Google_Analytics implements Cookiebot_Addons_Interface {
297
  public function extra_available_addon_option() {
298
  //do nothing
299
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  }
297
  public function extra_available_addon_option() {
298
  //do nothing
299
  }
300
+
301
+ /**
302
+ * Returns boolean to enable/disable plugin by default
303
+ *
304
+ * @return bool
305
+ *
306
+ * @since 3.6.3
307
+ */
308
+ public function enable_by_default() {
309
+ return false;
310
+ }
311
+
312
+ /**
313
+ * Sets default settings for this addon
314
+ *
315
+ * @return array
316
+ *
317
+ * @since 3.6.3
318
+ */
319
+ public function get_default_enable_setting() {
320
+ return array(
321
+ 'enabled' => 1,
322
+ 'cookie_type' => $this->get_default_cookie_types(),
323
+ 'placeholder' => $this->get_default_placeholder(),
324
+ );
325
+ }
326
  }
addons/controller/addons/wp-analytify/wp-analytify.php CHANGED
@@ -297,4 +297,30 @@ class Wp_Analytify implements Cookiebot_Addons_Interface {
297
  public function extra_available_addon_option() {
298
  //do nothing
299
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  }
297
  public function extra_available_addon_option() {
298
  //do nothing
299
  }
300
+
301
+ /**
302
+ * Returns boolean to enable/disable plugin by default
303
+ *
304
+ * @return bool
305
+ *
306
+ * @since 3.6.3
307
+ */
308
+ public function enable_by_default() {
309
+ return false;
310
+ }
311
+
312
+ /**
313
+ * Sets default settings for this addon
314
+ *
315
+ * @return array
316
+ *
317
+ * @since 3.6.3
318
+ */
319
+ public function get_default_enable_setting() {
320
+ return array(
321
+ 'enabled' => 1,
322
+ 'cookie_type' => $this->get_default_cookie_types(),
323
+ 'placeholder' => $this->get_default_placeholder(),
324
+ );
325
+ }
326
  }
addons/controller/addons/wp-mautic/wp-mautic.php CHANGED
@@ -305,4 +305,30 @@ class Wp_Mautic implements Cookiebot_Addons_Interface {
305
  public function extra_available_addon_option() {
306
  //do nothing
307
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  }
305
  public function extra_available_addon_option() {
306
  //do nothing
307
  }
308
+
309
+ /**
310
+ * Returns boolean to enable/disable plugin by default
311
+ *
312
+ * @return bool
313
+ *
314
+ * @since 3.6.3
315
+ */
316
+ public function enable_by_default() {
317
+ return false;
318
+ }
319
+
320
+ /**
321
+ * Sets default settings for this addon
322
+ *
323
+ * @return array
324
+ *
325
+ * @since 3.6.3
326
+ */
327
+ public function get_default_enable_setting() {
328
+ return array(
329
+ 'enabled' => 1,
330
+ 'cookie_type' => $this->get_default_cookie_types(),
331
+ 'placeholder' => $this->get_default_placeholder(),
332
+ );
333
+ }
334
  }
addons/controller/addons/wp-piwik/wp-piwik.php CHANGED
@@ -325,4 +325,30 @@ class Wp_Piwik implements Cookiebot_Addons_Interface {
325
  public function extra_available_addon_option() {
326
  //do nothing
327
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  }
325
  public function extra_available_addon_option() {
326
  //do nothing
327
  }
328
+
329
+ /**
330
+ * Returns boolean to enable/disable plugin by default
331
+ *
332
+ * @return bool
333
+ *
334
+ * @since 3.6.3
335
+ */
336
+ public function enable_by_default() {
337
+ return false;
338
+ }
339
+
340
+ /**
341
+ * Sets default settings for this addon
342
+ *
343
+ * @return array
344
+ *
345
+ * @since 3.6.3
346
+ */
347
+ public function get_default_enable_setting() {
348
+ return array(
349
+ 'enabled' => 1,
350
+ 'cookie_type' => $this->get_default_cookie_types(),
351
+ 'placeholder' => $this->get_default_placeholder(),
352
+ );
353
+ }
354
  }
addons/controller/addons/wp-rocket/wp-rocket.php CHANGED
@@ -75,10 +75,11 @@ class Wp_Rocket implements Cookiebot_Addons_Interface {
75
  /**
76
  * Exclude scripts from WP Rocket’s defer JS option.
77
  *
78
- * @author Caspar Hübinger
79
- * @param array $excluded_files Array of script URLs to be excluded
80
  * @return array Extended array script URLs to be excluded
81
  *
 
82
  * @since 3.6.2
83
  */
84
  public function exclude_files( $excluded_files = array() ) {
@@ -249,7 +250,8 @@ class Wp_Rocket implements Cookiebot_Addons_Interface {
249
  * @since 1.8.0
250
  */
251
  public function get_extra_information() {
252
- return false;
 
253
  }
254
 
255
  /**
@@ -312,4 +314,30 @@ class Wp_Rocket implements Cookiebot_Addons_Interface {
312
  public function extra_available_addon_option() {
313
  //do nothing
314
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  }
75
  /**
76
  * Exclude scripts from WP Rocket’s defer JS option.
77
  *
78
+ * @param array $excluded_files Array of script URLs to be excluded
79
+ *
80
  * @return array Extended array script URLs to be excluded
81
  *
82
+ * @author Caspar Hübinger
83
  * @since 3.6.2
84
  */
85
  public function exclude_files( $excluded_files = array() ) {
250
  * @since 1.8.0
251
  */
252
  public function get_extra_information() {
253
+ return '<p>' . __( 'Excludes cookiebot javascript files when the WP-Rocket deter option is enabled.',
254
+ 'cookiebot-addons' ) . '</p>';;
255
  }
256
 
257
  /**
314
  public function extra_available_addon_option() {
315
  //do nothing
316
  }
317
+
318
+ /**
319
+ * Returns boolean to enable/disable plugin by default
320
+ *
321
+ * @return bool
322
+ *
323
+ * @since 3.6.3
324
+ */
325
+ public function enable_by_default() {
326
+ return true;
327
+ }
328
+
329
+ /**
330
+ * Sets default settings for this addon
331
+ *
332
+ * @return array
333
+ *
334
+ * @since 3.6.3
335
+ */
336
+ public function get_default_enable_setting() {
337
+ return array(
338
+ 'enabled' => 1,
339
+ 'cookie_type' => $this->get_default_cookie_types(),
340
+ 'placeholder' => $this->get_default_placeholder(),
341
+ );
342
+ }
343
  }
addons/controller/addons/wpforms/wpforms.php CHANGED
@@ -366,4 +366,30 @@ class Wpforms implements Cookiebot_Addons_Interface {
366
  public function extra_available_addon_option() {
367
  //do nothing
368
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
369
  }
366
  public function extra_available_addon_option() {
367
  //do nothing
368
  }
369
+
370
+ /**
371
+ * Returns boolean to enable/disable plugin by default
372
+ *
373
+ * @return bool
374
+ *
375
+ * @since 3.6.3
376
+ */
377
+ public function enable_by_default() {
378
+ return false;
379
+ }
380
+
381
+ /**
382
+ * Sets default settings for this addon
383
+ *
384
+ * @return array
385
+ *
386
+ * @since 3.6.3
387
+ */
388
+ public function get_default_enable_setting() {
389
+ return array(
390
+ 'enabled' => 1,
391
+ 'cookie_type' => $this->get_default_cookie_types(),
392
+ 'placeholder' => $this->get_default_placeholder(),
393
+ );
394
+ }
395
  }
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', '3.6.2' );
27
 
28
  /**
29
  * Register autoloader to load files/classes dynamically
@@ -126,6 +126,17 @@ class Cookiebot_Addons {
126
  $settings->load();
127
  }
128
 
 
 
 
 
 
 
 
 
 
 
 
129
  /**
130
  * if the cookiebot is deactivated
131
  * run this script to clean up addons.
@@ -148,7 +159,7 @@ class Cookiebot_Addons {
148
  */
149
  protected function get_plugins() {
150
  $file = file_get_contents( COOKIEBOT_ADDONS_DIR . 'addons.json' );
151
- $this->plugins = json_decode( $file );
152
  }
153
 
154
  /**
23
  /**
24
  * Same version as the CookiebotWP
25
  */
26
+ define( 'COOKIEBOT_ADDONS_VERSION', '3.6.5' );
27
 
28
  /**
29
  * Register autoloader to load files/classes dynamically
126
  $settings->load();
127
  }
128
 
129
+ /**
130
+ * if the cookiebot is activated
131
+ * run this script to start up
132
+ *
133
+ * @since 2.2.0
134
+ */
135
+ public function cookiebot_activated() {
136
+ $settings_service = $this->container->get( 'Settings_Service_Interface' );
137
+ $settings_service->cookiebot_activated();
138
+ }
139
+
140
  /**
141
  * if the cookiebot is deactivated
142
  * run this script to clean up addons.
159
  */
160
  protected function get_plugins() {
161
  $file = file_get_contents( COOKIEBOT_ADDONS_DIR . 'addons.json' );
162
+ $this->plugins = apply_filters( 'cookiebot_addons_list', json_decode( $file ) );
163
  }
164
 
165
  /**
addons/lib/helper.php CHANGED
@@ -284,3 +284,13 @@ function cookiebot_addons_plugin_deactivated( ) {
284
  $cookiebot_addons = \cookiebot_addons\Cookiebot_Addons::instance();
285
  $cookiebot_addons->cookiebot_deactivated();
286
  }
 
 
 
 
 
 
 
 
 
 
284
  $cookiebot_addons = \cookiebot_addons\Cookiebot_Addons::instance();
285
  $cookiebot_addons->cookiebot_deactivated();
286
  }
287
+
288
+ /**
289
+ * Run actions when the cookiebot plugin is deactivated
290
+ *
291
+ * @since 3.6.3
292
+ */
293
+ function cookiebot_addons_plugin_activated( ) {
294
+ $cookiebot_addons = \cookiebot_addons\Cookiebot_Addons::instance();
295
+ $cookiebot_addons->cookiebot_activated();
296
+ }
addons/lib/settings-service-interface.php CHANGED
@@ -150,4 +150,11 @@ Interface Settings_Service_Interface {
150
  * @since 2.2.0
151
  */
152
  public function cookiebot_deactivated();
 
 
 
 
 
 
 
153
  }
150
  * @since 2.2.0
151
  */
152
  public function cookiebot_deactivated();
153
+
154
+ /**
155
+ * The cookiebot plugin is activated and the addon settings is activated
156
+ *
157
+ * @since 3.6.3
158
+ */
159
+ public function cookiebot_activated();
160
  }
addons/lib/settings-service.php CHANGED
@@ -64,7 +64,8 @@ class Settings_Service implements Settings_Service_Interface {
64
  * @since 2.2.1
65
  */
66
  public function get_addon_version( $addon ) {
67
- $plugin_data = get_file_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $addon, array( 'Version' => 'version' ), false );
 
68
 
69
  return ( isset( $plugin_data['Version'] ) ) ? $plugin_data['Version'] : false;
70
  }
@@ -170,7 +171,7 @@ class Settings_Service implements Settings_Service_Interface {
170
  *
171
  * @param $option_key
172
  * @param $widget
173
- * @param array $default
174
  *
175
  * @return array
176
  *
@@ -367,7 +368,7 @@ class Settings_Service implements Settings_Service_Interface {
367
  * @param $option_key
368
  * @param $default_placeholder
369
  * @param $cookies
370
- * @param string $src
371
  *
372
  * @return mixed
373
  *
@@ -390,7 +391,8 @@ class Settings_Service implements Settings_Service_Interface {
390
  * if current lang match with the prefix language in the database then get the text
391
  */
392
  if ( $key == $current_lang ) {
393
- return $this->placeholder_merge_tag( $option[ $option_key ]['placeholder']['languages'][ $key ], $cookies, $src );
 
394
  }
395
  }
396
  }
@@ -399,7 +401,8 @@ class Settings_Service implements Settings_Service_Interface {
399
  * Returns site-default text if no match found.
400
  */
401
  if ( isset( $option[ $option_key ]['placeholder']['languages']['site-default'] ) ) {
402
- return $this->placeholder_merge_tag( $option[ $option_key ]['placeholder']['languages']['site-default'], $cookies, $src );
 
403
  }
404
 
405
  /**
@@ -492,8 +495,8 @@ class Settings_Service implements Settings_Service_Interface {
492
  public function post_hook_after_enabling_addon_on_settings_page( $addon_option_name ) {
493
  $addons = $this->get_addons();
494
 
495
- foreach( $addons as $addon ) {
496
- if( $addon->get_option_name() == $addon_option_name ) {
497
  $addon->post_hook_after_enabling();
498
  }
499
  }
@@ -506,8 +509,29 @@ class Settings_Service implements Settings_Service_Interface {
506
  * @since 2.2.0
507
  */
508
  public function cookiebot_deactivated() {
509
- foreach( $this->get_active_addons() as $addon ) {
510
  $addon->plugin_deactivated();
511
  }
512
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
513
  }
64
  * @since 2.2.1
65
  */
66
  public function get_addon_version( $addon ) {
67
+ $plugin_data = get_file_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $addon, array( 'Version' => 'version' ),
68
+ false );
69
 
70
  return ( isset( $plugin_data['Version'] ) ) ? $plugin_data['Version'] : false;
71
  }
171
  *
172
  * @param $option_key
173
  * @param $widget
174
+ * @param array $default
175
  *
176
  * @return array
177
  *
368
  * @param $option_key
369
  * @param $default_placeholder
370
  * @param $cookies
371
+ * @param string $src
372
  *
373
  * @return mixed
374
  *
391
  * if current lang match with the prefix language in the database then get the text
392
  */
393
  if ( $key == $current_lang ) {
394
+ return $this->placeholder_merge_tag( $option[ $option_key ]['placeholder']['languages'][ $key ],
395
+ $cookies, $src );
396
  }
397
  }
398
  }
401
  * Returns site-default text if no match found.
402
  */
403
  if ( isset( $option[ $option_key ]['placeholder']['languages']['site-default'] ) ) {
404
+ return $this->placeholder_merge_tag( $option[ $option_key ]['placeholder']['languages']['site-default'],
405
+ $cookies, $src );
406
  }
407
 
408
  /**
495
  public function post_hook_after_enabling_addon_on_settings_page( $addon_option_name ) {
496
  $addons = $this->get_addons();
497
 
498
+ foreach ( $addons as $addon ) {
499
+ if ( $addon->get_option_name() == $addon_option_name ) {
500
  $addon->post_hook_after_enabling();
501
  }
502
  }
509
  * @since 2.2.0
510
  */
511
  public function cookiebot_deactivated() {
512
+ foreach ( $this->get_active_addons() as $addon ) {
513
  $addon->plugin_deactivated();
514
  }
515
  }
516
+
517
+ /**
518
+ * The cookiebot plugin is activated and the addon settings is activated
519
+ *
520
+ * @since 3.6.3
521
+ */
522
+ public function cookiebot_activated() {
523
+ $option = get_option( static::OPTION_NAME );
524
+
525
+ if( $option == false ) {
526
+ $option = array();
527
+
528
+ foreach ( $this->get_addons() as $addon ) {
529
+ if ( $addon->enable_by_default() ) {
530
+ $option[ $addon->get_option_name() ] = $addon->get_default_enable_setting();
531
+ }
532
+ }
533
+
534
+ update_option( static::OPTION_NAME, $option );
535
+ }
536
+ }
537
  }
addons/tests/integration/addons/test-facebook-for-woocommerce.php CHANGED
@@ -22,18 +22,9 @@ class Test_Facebook_For_Woocommerce extends \WP_UnitTestCase {
22
  */
23
  public function test_facebook_for_woocommerce_hooks() {
24
 
25
- $content = file_get_contents( 'https://raw.githubusercontent.com/facebookincubator/facebook-for-woocommerce/master/facebook-commerce-events-tracker.php' );
26
 
27
- $this->assertNotFalse( strpos( $content, 'add_action( \'wp_head\', array( $this, \'apply_filters\' ) );' ) );
28
- $this->assertNotFalse( strpos( $content, 'add_action( \'woocommerce_after_single_product\', [ $this, \'inject_view_content_event\' ] );' ) );
29
- $this->assertNotFalse( strpos( $content, 'array( $this, \'inject_view_category_event\' )' ) );
30
- $this->assertNotFalse( strpos( $content, 'array( $this, \'inject_search_event\' )' ) );
31
- $this->assertNotFalse( strpos( $content, 'add_action( \'woocommerce_add_to_cart\', [ $this, \'inject_add_to_cart_event\' ], 40, 4 );' ) );
32
- $this->assertNotFalse( strpos( $content, 'add_action( \'woocommerce_ajax_added_to_cart\', [ $this, \'add_filter_for_add_to_cart_fragments\' ] );' ) );
33
- $this->assertNotFalse( strpos( $content, 'array( $this, \'inject_initiate_checkout_event\' )' ) );
34
- $this->assertNotFalse( strpos( $content, 'array( $this, \'inject_gateway_purchase_event\' ),' ) );
35
- $this->assertNotFalse( strpos( $content, 'array( $this, \'inject_purchase_event\' ),' ) );
36
- $this->assertNotFalse( strpos( $content, 'const FB_PRIORITY_LOW = 11;' ) );
37
- $this->assertNotFalse( strpos( $content, 'const FB_PRIORITY_HIGH = 2;' ) );
38
  }
39
  }
22
  */
23
  public function test_facebook_for_woocommerce_hooks() {
24
 
25
+ $content = file_get_contents( 'https://raw.githubusercontent.com/facebookincubator/facebook-for-woocommerce/master/facebook-commerce-pixel-event.php' );
26
 
27
+ $this->assertNotFalse( strpos( $content, 'apply_filters( \'wc_facebook_pixel_script_attributes\',' ) );
28
+
 
 
 
 
 
 
 
 
 
29
  }
30
  }
addons/tests/unit/test-addon-file-name.php CHANGED
@@ -29,7 +29,7 @@ class Test_Addon_File_Name extends \WP_UnitTestCase {
29
  private function get_plugins() {
30
  $this->file_path = dirname( dirname( __DIR__ ) ) . '/addons.json';
31
  $this->file = file_get_contents( $this->file_path );
32
- $this->plugins = json_decode( $this->file );
33
  }
34
 
35
  /**
29
  private function get_plugins() {
30
  $this->file_path = dirname( dirname( __DIR__ ) ) . '/addons.json';
31
  $this->file = file_get_contents( $this->file_path );
32
+ $this->plugins = apply_filters( 'cookiebot_addons_list', json_decode( $this->file ) );
33
  }
34
 
35
  /**
addons/tests/unit/test-get-option-name.php CHANGED
@@ -35,7 +35,7 @@ class Test_Get_Option_Name extends \WP_UnitTestCase {
35
  private function get_plugins() {
36
  $this->file_path = dirname( dirname( __DIR__ ) ) . '/addons.json';
37
  $this->file = file_get_contents( $this->file_path );
38
- $this->plugins = json_decode( $this->file );
39
  }
40
 
41
  /**
35
  private function get_plugins() {
36
  $this->file_path = dirname( dirname( __DIR__ ) ) . '/addons.json';
37
  $this->file = file_get_contents( $this->file_path );
38
+ $this->plugins = apply_filters( 'cookiebot_addons_list', json_decode( $this->file ) );
39
  }
40
 
41
  /**
cookiebot.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Cookiebot | GDPR/CCPA Compliant Cookie Consent and Control
4
  Plugin URI: https://cookiebot.com/
5
  Description: Cookiebot is a cloud-driven solution that automatically controls cookies and trackers, enabling full GDPR/ePrivacy and CCPA compliance for websites.
6
  Author: Cybot A/S
7
- Version: 3.6.2
8
  Author URI: http://cookiebot.com
9
  Text Domain: cookiebot
10
  Domain Path: /langs
@@ -21,7 +21,7 @@ final class Cookiebot_WP {
21
  * @var string
22
  * @since 1.0.0
23
  */
24
- public $version = '3.6.1';
25
 
26
  /**
27
  * @var Cookiebot_WP The single instance of the class
@@ -59,7 +59,6 @@ final class Cookiebot_WP {
59
  register_deactivation_hook( __FILE__, 'cookiebot_addons_plugin_deactivated' );
60
 
61
  $this->cookiebot_fix_plugin_conflicts();
62
-
63
  }
64
 
65
  /**
@@ -85,6 +84,20 @@ final class Cookiebot_WP {
85
  update_option('cookiebot-nooutput-admin',true);
86
  }
87
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  }
89
 
90
  /**
@@ -179,6 +192,9 @@ final class Cookiebot_WP {
179
  if(defined('WP_ROCKET_VERSION')) {
180
  add_filter('rocket_minify_excluded_external_js', array($this,'wp_rocket_exclude_external_js'));
181
  }
 
 
 
182
 
183
  //Automatic update plugin
184
  if(is_admin() || (defined('DOING_CRON') && DOING_CRON)) {
@@ -255,13 +271,13 @@ final class Cookiebot_WP {
255
  add_submenu_page('cookiebot',__('Cookiebot Settings','cookiebot'),__('Settings','cookiebot'), 'manage_options', 'cookiebot',array($this,'settings_page') );
256
  add_submenu_page('cookiebot',__('Cookiebot Support','cookiebot'),__('Support','cookiebot'), 'manage_options', 'cookiebot_support',array($this,'support_page') );
257
  add_submenu_page('cookiebot',__('IAB','cookiebot'),__('IAB','cookiebot'), 'manage_options', 'cookiebot_iab',array($this,'iab_page') );
258
-
259
  if(defined('COOKIEBOT_ADDONS_UNSUPPORTED_PHPVERSION')) {
260
  //Load prior consent page anyway - but from Cookiebot WP Core plugin.
261
  add_submenu_page( 'cookiebot', __( 'Prior Consent', 'cookiebot' ), __( 'Prior Consent', 'cookiebot' ), 'manage_options', 'cookiebot-addons', array($this,'setting_page_placeholder' ) );
262
  }
263
  }
264
-
265
  /**
266
  * Cookiebot_WP Add debug menu - we need to add this seperate to ensure it is placed last (after menu items from Addons).
267
  *
@@ -1114,25 +1130,25 @@ final class Cookiebot_WP {
1114
  </div>
1115
  <?php
1116
  }
1117
-
1118
  /**
1119
  * Cookiebot_WP Debug Page
1120
- *
1121
  * @version 3.6.0
1122
  * @since 3.6.0
1123
  */
1124
-
1125
  function debug_page() {
1126
  global $wpdb;
1127
-
1128
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1129
  $plugins = get_plugins();
1130
  $active_plugins = get_option( 'active_plugins' );
1131
-
1132
-
1133
  //$foo = new cookiebot_addons\lib\Settings_Service;
1134
  //$addons = $foo->get_active_addons();
1135
-
1136
  $debugStr = "";
1137
  $debugStr.= "##### Debug Information for ".get_site_url()." generated at ".date("c")." #####\n\n";
1138
  $debugStr.= "Wordpress Version: ".get_bloginfo('version')."\n";
@@ -1152,26 +1168,26 @@ final class Cookiebot_WP {
1152
  $debugStr.= "Disable Cookiebot in WP Admin: ".(get_option('cookiebot-nooutput-admin') == '1' ? 'Yes' : 'No')."\n";
1153
  $debugStr.= "Banner tag: ".$this->add_js(false)."\n";
1154
  $debugStr.= "Declaration tag: ".$this->show_declaration()."\n";
1155
-
1156
  if($this->is_wp_consent_api_active()) {
1157
  $debugStr.= "\n--- WP Consent Level API Mapping ---\n";
1158
  $debugStr .= 'F = Functional, N = Necessary, P = Preferences, M = Marketing, S = Statistics, SA = Statistics Anonymous'."\n";
1159
  $m = $this->get_wp_consent_api_mapping();
1160
  foreach($m as $k=>$v) {
1161
  $cb = array();
1162
-
1163
  $debugStr .= strtoupper( str_replace(';', ', ', $k ) ) . ' => ';
1164
-
1165
  $debugStr .= 'F=1, ';
1166
  $debugStr .= 'P=' . $v['preferences'] . ', ';
1167
  $debugStr .= 'M=' . $v['marketing'] . ', ';
1168
  $debugStr .= 'S=' . $v['statistics'] . ', ';
1169
  $debugStr .= 'SA=' . $v['statistics-anonymous'] . "\n";
1170
-
1171
  }
1172
-
1173
- }
1174
-
1175
  if(class_exists('cookiebot_addons\Cookiebot_Addons')) {
1176
  $ca = new cookiebot_addons\Cookiebot_Addons();
1177
  $settingservice = $ca->container->get( 'Settings_Service_Interface' );
@@ -1181,16 +1197,16 @@ final class Cookiebot_WP {
1181
  $debugStr.= $addon->get_addon_name()." (".implode( ", ", $addon->get_cookie_types() ).")\n";
1182
  }
1183
  }
1184
-
1185
  $debugStr.= "\n--- Activated Plugins ---\n";
1186
  foreach($active_plugins as $p) {
1187
  if($p != 'cookiebot/cookiebot.php') {
1188
- $debugStr.= $plugins[$p]['Name'] . " (Version: ".$plugins[$p]['Version'].")\n";
1189
  }
1190
  }
1191
-
1192
  $debugStr.= "\n##### Debug Information END #####";
1193
-
1194
  ?>
1195
  <div class="wrap">
1196
  <h1><?php _e('Debug information','cookiebot'); ?></h1>
@@ -1246,12 +1262,12 @@ final class Cookiebot_WP {
1246
  }
1247
 
1248
  $iab = ( get_option('cookiebot-iab') != false ) ? 'data-framework="IAB"' : '';
1249
-
1250
  $tag = '<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" '.$iab.' data-cbid="'.$cbid.'"'.$lang.' type="text/javascript" '.$tagAttr.'></script>';
1251
  if($printTag===false) {
1252
  return $tag;
1253
  }
1254
- echo $tag;
1255
  }
1256
  }
1257
 
@@ -1406,6 +1422,17 @@ final class Cookiebot_WP {
1406
  $external_js_hosts[] = 'consentcdn.cookiebot.com';
1407
  return $external_js_hosts;
1408
  }
 
 
 
 
 
 
 
 
 
 
 
1409
 
1410
 
1411
  /**
@@ -1584,7 +1611,7 @@ final class Cookiebot_WP {
1584
  //Fix for Divi Page Builder
1585
  //Disabled - using another method now (can_current_user_edit_theme())
1586
  //add_action( 'wp', array( $this, '_cookiebot_plugin_conflict_divi' ), 100 );
1587
-
1588
  //Fix for Elementor and WPBakery Page Builder Builder
1589
  //Disabled - using another method now (can_current_user_edit_theme())
1590
  //add_filter( 'script_loader_tag', array( $this, '_cookiebot_plugin_conflict_scripttags' ), 10, 2 );
4
  Plugin URI: https://cookiebot.com/
5
  Description: Cookiebot is a cloud-driven solution that automatically controls cookies and trackers, enabling full GDPR/ePrivacy and CCPA compliance for websites.
6
  Author: Cybot A/S
7
+ Version: 3.6.5
8
  Author URI: http://cookiebot.com
9
  Text Domain: cookiebot
10
  Domain Path: /langs
21
  * @var string
22
  * @since 1.0.0
23
  */
24
+ public $version = '3.6.5';
25
 
26
  /**
27
  * @var Cookiebot_WP The single instance of the class
59
  register_deactivation_hook( __FILE__, 'cookiebot_addons_plugin_deactivated' );
60
 
61
  $this->cookiebot_fix_plugin_conflicts();
 
62
  }
63
 
64
  /**
84
  update_option('cookiebot-nooutput-admin',true);
85
  }
86
  }
87
+
88
+ /**
89
+ * Run through the addons and enable the default ones
90
+ */
91
+ if( (!defined('COOKIEBOT_ADDONS_STANDALONE') || COOKIEBOT_ADDONS_STANDALONE != true || !defined('COOKIE_ADDONS_LOADED')) ) {
92
+ //Make sure we got a PHP version that works
93
+ if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) {
94
+ define( 'COOKIEBOT_URL', plugin_dir_url( __FILE__ ) );
95
+ // activation hook doesn't have the addons loaded - so load it extra when the plugin is activated
96
+ include_once( dirname( __FILE__ ) . '/addons/cookiebot-addons-init.php' );
97
+ // run activated hook on the addons
98
+ cookiebot_addons_plugin_activated();
99
+ }
100
+ }
101
  }
102
 
103
  /**
192
  if(defined('WP_ROCKET_VERSION')) {
193
  add_filter('rocket_minify_excluded_external_js', array($this,'wp_rocket_exclude_external_js'));
194
  }
195
+
196
+ //Add filter
197
+ add_filter( 'sgo_javascript_combine_excluded_external_paths', array($this,'sgo_exclude_external_js') );
198
 
199
  //Automatic update plugin
200
  if(is_admin() || (defined('DOING_CRON') && DOING_CRON)) {
271
  add_submenu_page('cookiebot',__('Cookiebot Settings','cookiebot'),__('Settings','cookiebot'), 'manage_options', 'cookiebot',array($this,'settings_page') );
272
  add_submenu_page('cookiebot',__('Cookiebot Support','cookiebot'),__('Support','cookiebot'), 'manage_options', 'cookiebot_support',array($this,'support_page') );
273
  add_submenu_page('cookiebot',__('IAB','cookiebot'),__('IAB','cookiebot'), 'manage_options', 'cookiebot_iab',array($this,'iab_page') );
274
+
275
  if(defined('COOKIEBOT_ADDONS_UNSUPPORTED_PHPVERSION')) {
276
  //Load prior consent page anyway - but from Cookiebot WP Core plugin.
277
  add_submenu_page( 'cookiebot', __( 'Prior Consent', 'cookiebot' ), __( 'Prior Consent', 'cookiebot' ), 'manage_options', 'cookiebot-addons', array($this,'setting_page_placeholder' ) );
278
  }
279
  }
280
+
281
  /**
282
  * Cookiebot_WP Add debug menu - we need to add this seperate to ensure it is placed last (after menu items from Addons).
283
  *
1130
  </div>
1131
  <?php
1132
  }
1133
+
1134
  /**
1135
  * Cookiebot_WP Debug Page
1136
+ *
1137
  * @version 3.6.0
1138
  * @since 3.6.0
1139
  */
1140
+
1141
  function debug_page() {
1142
  global $wpdb;
1143
+
1144
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1145
  $plugins = get_plugins();
1146
  $active_plugins = get_option( 'active_plugins' );
1147
+
1148
+
1149
  //$foo = new cookiebot_addons\lib\Settings_Service;
1150
  //$addons = $foo->get_active_addons();
1151
+
1152
  $debugStr = "";
1153
  $debugStr.= "##### Debug Information for ".get_site_url()." generated at ".date("c")." #####\n\n";
1154
  $debugStr.= "Wordpress Version: ".get_bloginfo('version')."\n";
1168
  $debugStr.= "Disable Cookiebot in WP Admin: ".(get_option('cookiebot-nooutput-admin') == '1' ? 'Yes' : 'No')."\n";
1169
  $debugStr.= "Banner tag: ".$this->add_js(false)."\n";
1170
  $debugStr.= "Declaration tag: ".$this->show_declaration()."\n";
1171
+
1172
  if($this->is_wp_consent_api_active()) {
1173
  $debugStr.= "\n--- WP Consent Level API Mapping ---\n";
1174
  $debugStr .= 'F = Functional, N = Necessary, P = Preferences, M = Marketing, S = Statistics, SA = Statistics Anonymous'."\n";
1175
  $m = $this->get_wp_consent_api_mapping();
1176
  foreach($m as $k=>$v) {
1177
  $cb = array();
1178
+
1179
  $debugStr .= strtoupper( str_replace(';', ', ', $k ) ) . ' => ';
1180
+
1181
  $debugStr .= 'F=1, ';
1182
  $debugStr .= 'P=' . $v['preferences'] . ', ';
1183
  $debugStr .= 'M=' . $v['marketing'] . ', ';
1184
  $debugStr .= 'S=' . $v['statistics'] . ', ';
1185
  $debugStr .= 'SA=' . $v['statistics-anonymous'] . "\n";
1186
+
1187
  }
1188
+
1189
+ }
1190
+
1191
  if(class_exists('cookiebot_addons\Cookiebot_Addons')) {
1192
  $ca = new cookiebot_addons\Cookiebot_Addons();
1193
  $settingservice = $ca->container->get( 'Settings_Service_Interface' );
1197
  $debugStr.= $addon->get_addon_name()." (".implode( ", ", $addon->get_cookie_types() ).")\n";
1198
  }
1199
  }
1200
+
1201
  $debugStr.= "\n--- Activated Plugins ---\n";
1202
  foreach($active_plugins as $p) {
1203
  if($p != 'cookiebot/cookiebot.php') {
1204
+ $debugStr.= $plugins[$p]['Name'] . " (Version: ".$plugins[$p]['Version'].")\n";
1205
  }
1206
  }
1207
+
1208
  $debugStr.= "\n##### Debug Information END #####";
1209
+
1210
  ?>
1211
  <div class="wrap">
1212
  <h1><?php _e('Debug information','cookiebot'); ?></h1>
1262
  }
1263
 
1264
  $iab = ( get_option('cookiebot-iab') != false ) ? 'data-framework="IAB"' : '';
1265
+
1266
  $tag = '<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" '.$iab.' data-cbid="'.$cbid.'"'.$lang.' type="text/javascript" '.$tagAttr.'></script>';
1267
  if($printTag===false) {
1268
  return $tag;
1269
  }
1270
+ echo $tag;
1271
  }
1272
  }
1273
 
1422
  $external_js_hosts[] = 'consentcdn.cookiebot.com';
1423
  return $external_js_hosts;
1424
  }
1425
+
1426
+ /**
1427
+ * Cookiebot_WP Adding Cookiebot domain(s) to exclude list for SGO minification.
1428
+ *
1429
+ * @version 3.6.5
1430
+ * @since 3.6.5
1431
+ */
1432
+ function sgo_exclude_external_js( $exclude_list ) {
1433
+ //Uses same format as WP Rocket - for now we just use WP Rocket function
1434
+ return wp_rocket_exclude_external_js( $exclude_list );
1435
+ }
1436
 
1437
 
1438
  /**
1611
  //Fix for Divi Page Builder
1612
  //Disabled - using another method now (can_current_user_edit_theme())
1613
  //add_action( 'wp', array( $this, '_cookiebot_plugin_conflict_divi' ), 100 );
1614
+
1615
  //Fix for Elementor and WPBakery Page Builder Builder
1616
  //Disabled - using another method now (can_current_user_edit_theme())
1617
  //add_filter( 'script_loader_tag', array( $this, '_cookiebot_plugin_conflict_scripttags' ), 10, 2 );
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  * Contributors: cookiebot,phpgeekdk,aytac
3
  * Tags: cookie, compliance, eu, gdpr, europe, cookie consent, consent, ccpa
4
  * Requires at least: 4.4
5
- * Tested up to: 5.3.2
6
- * Stable tag: 3.6.2
7
  * Requires PHP: 5.6
8
  * License: GPLv2 or later
9
 
@@ -190,7 +190,15 @@ You are able to define the mapping between Cookiebot and the WP Consent API in t
190
 
191
  ## Changelog ##
192
 
193
- ### 3.6.2 - 2020-04-22
 
 
 
 
 
 
 
 
194
  * Adding WP Rocket addon
195
  * Adding WP Mautic addon
196
 
2
  * Contributors: cookiebot,phpgeekdk,aytac
3
  * Tags: cookie, compliance, eu, gdpr, europe, cookie consent, consent, ccpa
4
  * Requires at least: 4.4
5
+ * Tested up to: 5.4.1
6
+ * Stable tag: 3.6.5
7
  * Requires PHP: 5.6
8
  * License: GPLv2 or later
9
 
190
 
191
  ## Changelog ##
192
 
193
+ ### 3.6.5 - 2020-05-19 ###
194
+ * Adding fix for SG Optimizer
195
+ * Add support for latest version of Facebook for Woocommerce addon
196
+
197
+ ### 3.6.3 - 2020-04-30 ###
198
+ * Adding support for default enabled addons
199
+ * Added filter tp addon list
200
+
201
+ ### 3.6.2 - 2020-04-22 ###
202
  * Adding WP Rocket addon
203
  * Adding WP Mautic addon
204