Cookiebot | GDPR Compliant Cookie Consent and Notice - Version 3.6.0

Version Description

Download this release

Release Info

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

Code changes from version 3.5.0 to 3.6.0

addons/controller/addons/gadwp/gadwp.php CHANGED
@@ -98,6 +98,7 @@ class Gadwp implements Cookiebot_Addons_Interface {
98
  ),
99
  false );
100
 
 
101
  $this->buffer_output->add_tag( 'wp_footer',
102
  99,
103
  array(
@@ -106,6 +107,17 @@ class Gadwp implements Cookiebot_Addons_Interface {
106
  'ga-disable-' => $this->get_cookie_types(),
107
  ),
108
  false );
 
 
 
 
 
 
 
 
 
 
 
109
  }
110
 
111
  /**
98
  ),
99
  false );
100
 
101
+
102
  $this->buffer_output->add_tag( 'wp_footer',
103
  99,
104
  array(
107
  'ga-disable-' => $this->get_cookie_types(),
108
  ),
109
  false );
110
+
111
+
112
+ /* For new versions of GADWP */
113
+ $this->script_loader_tag->add_tag( 'exactmetrics-frontend-script', $this->get_cookie_types() );
114
+ $this->buffer_output->add_tag( 'wp_head',
115
+ 6,
116
+ array(
117
+ 'GoogleAnalyticsObject' => $this->get_cookie_types(),
118
+ ),
119
+ false );
120
+
121
  }
122
 
123
  /**
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.5.0' );
27
 
28
  /**
29
  * Register autoloader to load files/classes dynamically
23
  /**
24
  * Same version as the CookiebotWP
25
  */
26
+ define( 'COOKIEBOT_ADDONS_VERSION', '3.6.0' );
27
 
28
  /**
29
  * Register autoloader to load files/classes dynamically
addons/tests/integration/addons/test-gadwp.php CHANGED
@@ -14,16 +14,16 @@ class Test_Gadwp extends \WP_UnitTestCase {
14
  * @since 2.1.0
15
  */
16
  public function test_hooks() {
17
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/google-analytics-dashboard-for-wp/trunk/front/views/tagmanager-code.php' );
18
 
19
- $this->assertNotFalse( strpos( $content, 'https://www.googletagmanager.com') );
20
 
21
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/google-analytics-dashboard-for-wp/trunk/front/views/analytics-optout-code.php' );
22
 
23
- $this->assertNotFalse( strpos( $content, 'ga-disable-') );
24
 
25
- $content = file_get_contents( 'http://plugins.svn.wordpress.org/google-analytics-dashboard-for-wp/trunk/front/views/analytics-code.php' );
26
 
27
- $this->assertNotFalse( strpos( $content, 'tracking_script_path') );
28
  }
29
- }
14
  * @since 2.1.0
15
  */
16
  public function test_hooks() {
17
+ $content = file_get_contents( 'http://plugins.svn.wordpress.org/google-analytics-dashboard-for-wp/trunk/includes/frontend/tracking/class-tracking-analytics.php' );
18
 
19
+ $this->assertNotFalse( strpos( $content, 'GoogleAnalyticsObject') );
20
 
21
+ $content = file_get_contents( 'http://plugins.svn.wordpress.org/google-analytics-dashboard-for-wp/trunk/includes/frontend/frontend.php' );
22
 
23
+ $this->assertNotFalse( strpos( $content, "add_action( 'wp_head', 'exactmetrics_tracking_script', 6 );") );
24
 
25
+ $content = file_get_contents( 'http://plugins.svn.wordpress.org/google-analytics-dashboard-for-wp/trunk/includes/frontend/events/class-analytics-events.php' );
26
 
27
+ $this->assertNotFalse( strpos( $content, "wp_enqueue_script( 'exactmetrics-frontend-script',") );
28
  }
29
+ }
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.5.0
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.5.0';
25
 
26
  /**
27
  * @var Cookiebot_WP The single instance of the class
@@ -139,6 +139,8 @@ final class Cookiebot_WP {
139
 
140
  //Adding menu to WP admin
141
  add_action('admin_menu', array($this,'add_menu'),1);
 
 
142
 
143
  if(is_multisite()) {
144
  add_action('network_admin_menu', array($this,'add_network_menu'),1);
@@ -250,15 +252,25 @@ final class Cookiebot_WP {
250
  $icon = 'data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNzIgNTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNNDYuODcyNTkwMyA4Ljc3MzU4MzM0QzQxLjk0MzkwMzkgMy4zODI5NTAxMSAzNC44NDI0OTQ2IDAgMjYuOTQ4MjgxOSAwIDEyLjA2NTE1NjggMCAwIDEyLjAyNDQ3NzQgMCAyNi44NTc0MjE5YzAgMTQuODMyOTQ0NSAxMi4wNjUxNTY4IDI2Ljg1NzQyMTkgMjYuOTQ4MjgxOSAyNi44NTc0MjE5IDcuODk0MjEyNyAwIDE0Ljk5NTYyMi0zLjM4Mjk1MDIgMTkuOTI0MzA4NC04Ljc3MzU4MzQtMi44ODk2OTY3LTEuMzY4ODY2My01LjM5OTMxMS0zLjQwNTQzOS03LjMyODA4MzgtNS45MDk2MzU4LTMuMTIxNDMwNiAzLjIwOTQxMDQtNy40OTI5OTQ0IDUuMjA0MTI5MS0xMi4zMzIwMjU4IDUuMjA0MTI5MS05LjQ4NDM0NDQgMC0xNy4xNzI5MjQ3LTcuNjYyNjU3Mi0xNy4xNzI5MjQ3LTE3LjExNTAyMzhzNy42ODg1ODAzLTE3LjExNTAyMzcgMTcuMTcyOTI0Ny0xNy4xMTUwMjM3YzQuNzIzNDgyMiAwIDkuMDAxNTU1MiAxLjkwMDU5MzkgMTIuMTA2MjkyIDQuOTc2MzA5IDEuOTU2OTIzNy0yLjY0MTEzMSA0LjU1MDAyNjMtNC43ODU1MTgzIDcuNTUzODE3Ni02LjIwODQzMTg2eiIvPjxwYXRoIGQ9Ik01NS4zODAzMjgyIDQyLjY1MDE5OTFDNDYuMzMzNzIyNyA0Mi42NTAxOTkxIDM5IDM1LjM0MTIwMzEgMzkgMjYuMzI1MDk5NiAzOSAxNy4zMDg5OTYgNDYuMzMzNzIyNyAxMCA1NS4zODAzMjgyIDEwYzkuMDQ2NjA1NSAwIDE2LjM4MDMyODIgNy4zMDg5OTYgMTYuMzgwMzI4MiAxNi4zMjUwOTk2IDAgOS4wMTYxMDM1LTcuMzMzNzIyNyAxNi4zMjUwOTk1LTE2LjM4MDMyODIgMTYuMzI1MDk5NXptLjAyMTMwOTItNy43NTU2MzQyYzQuNzM3MDI3NiAwIDguNTc3MTQ3MS0zLjgyNzE3MiA4LjU3NzE0NzEtOC41NDgyMjc5IDAtNC43MjEwNTYtMy44NDAxMTk1LTguNTQ4MjI4LTguNTc3MTQ3MS04LjU0ODIyOC00LjczNzAyNzUgMC04LjU3NzE0NyAzLjgyNzE3Mi04LjU3NzE0NyA4LjU0ODIyOCAwIDQuNzIxMDU1OSAzLjg0MDExOTUgOC41NDgyMjc5IDguNTc3MTQ3IDguNTQ4MjI3OXoiLz48L2c+PC9zdmc+';
251
  add_menu_page( 'Cookiebot', __('Cookiebot','cookiebot'), 'manage_options', 'cookiebot', array($this,'settings_page'),$icon);
252
 
253
- add_submenu_page('cookiebot',__('Cookiebot Settings','cookiebot'),__('Settings','cookiebot'), 'manage_options', 'cookiebot',array($this,'settings_page'));
254
- add_submenu_page('cookiebot',__('Cookiebot Support','cookiebot'),__('Support','cookiebot'), 'manage_options', 'cookiebot_support',array($this,'support_page'));
255
- add_submenu_page('cookiebot',__('IAB','cookiebot'),__('IAB','cookiebot'), 'manage_options', 'cookiebot_iab',array($this,'iab_page'));
256
-
257
  if(defined('COOKIEBOT_ADDONS_UNSUPPORTED_PHPVERSION')) {
258
  //Load prior consent page anyway - but from Cookiebot WP Core plugin.
259
  add_submenu_page( 'cookiebot', __( 'Prior Consent', 'cookiebot' ), __( 'Prior Consent', 'cookiebot' ), 'manage_options', 'cookiebot-addons', array($this,'setting_page_placeholder' ) );
260
  }
261
  }
 
 
 
 
 
 
 
 
 
 
262
 
263
  /**
264
  * Cookiebot_WP Add menu for network sites
@@ -745,8 +757,8 @@ final class Cookiebot_WP {
745
  <table class="widefat striped consent_mapping_table">
746
  <thead>
747
  <tr>
748
- <th>Cookiebot categories</th>
749
- <th class="consent_mapping">WP Consent Level categories</th>
750
  </tr>
751
  </thead>
752
  <?php
@@ -763,18 +775,18 @@ final class Cookiebot_WP {
763
  <td>
764
  <div class="cb_consent">
765
  <span class="forceconsent">Necessary</span>
766
- <span class="<?php echo ($state['preferences'] ? 'consent' : 'noconsent'); ?>">Preferences</span>
767
- <span class="<?php echo ($state['statistics'] ? 'consent' : 'noconsent'); ?>">Statistics</span>
768
- <span class="<?php echo ($state['marketing'] ? 'consent' : 'noconsent'); ?>">Marketing</span>
769
  </div>
770
  </td>
771
  <td>
772
  <div class="consent_mapping">
773
  <label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo $key; ?>][functional]" data-default-value="1" value="1" checked disabled> Functional </label>
774
- <label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo $key; ?>][preferences]" data-default-value="<?php echo $mDefault[$key]['preferences']; ?>" value="1" <?php if($m[$key]['preferences']) { echo 'checked'; } ?>> Preferences </label>
775
- <label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo $key; ?>][statistics]" data-default-value="<?php echo $mDefault[$key]['statistics']; ?>" value="1" <?php if($m[$key]['statistics']) { echo 'checked'; } ?>> Statistics </label>
776
- <label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo $key; ?>][statistics-anonymous]" data-default-value="<?php echo $mDefault[$key]['statistics-anonymous']; ?>" value="1" <?php if($m[$key]['statistics-anonymous']) { echo 'checked'; } ?>> Statistics Anonymous</label>
777
- <label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo $key; ?>][marketing]" data-default-value="<?php echo $mDefault[$key]['marketing']; ?>" value="1" <?php if($m[$key]['marketing']) { echo 'checked'; } ?>> Marketing</label>
778
  </div>
779
  </td>
780
  </tr>
@@ -783,7 +795,7 @@ final class Cookiebot_WP {
783
  ?>
784
  <tfoot>
785
  <tr>
786
- <td colspan="2" style="text-align:right;"><button class="button" onclick="return resetConsentMapping();">Reset to default mapping</button></td>
787
  </tr>
788
  </tfoot>
789
  </table>
@@ -824,7 +836,7 @@ final class Cookiebot_WP {
824
  <?php _e('Cookiebot enables your website to comply with current legislation in the EU on the use of cookies for user tracking and profiling. The EU ePrivacy Directive requires prior, informed consent of your site users, while the <a href="https://www.cookiebot.com/goto/gdpr" target="_blank">General Data Protection Regulation (GDPR)</a> requires you to document each consent. At the same time you must be able to account for what user data you share with embedded third-party services on your website and where in the world the user data is sent.','cookiebot'); ?>
825
  </p>
826
  <p>
827
- <b><big style="color:red;"><?php _e('The settings below is network wide settings. See notes below each field.'); ?></big></b>
828
  </p>
829
  <form method="post" action="edit.php?action=cookiebot_network_settings">
830
  <?php wp_nonce_field( 'cookiebot-network-settings' ); ?>
@@ -834,7 +846,7 @@ final class Cookiebot_WP {
834
  <td>
835
  <input type="text" name="cookiebot-cbid" value="<?php echo esc_attr( get_site_option('cookiebot-cbid','') ); ?>" style="width:300px" />
836
  <p class="description">
837
- <b><?php _e('If added this will be the default Cookiebot ID for all subsites. Subsites are able to override the Cookiebot ID.'); ?></b>
838
  <br />
839
  <?php _e('Need an ID?','cookiebot'); ?>
840
  <a href="https://www.cookiebot.com/goto/signup" target="_blank"><?php _e('Sign up for free on cookiebot.com','cookiebot'); ?></a>
@@ -894,7 +906,7 @@ final class Cookiebot_WP {
894
  ?>
895
  <label>
896
  <input type="radio" name="cookiebot-script-tag-uc-attribute" value="" <?php checked('', $cv, true); ?> />
897
- <i>None</i>
898
  </label>
899
  &nbsp; &nbsp;
900
  <label>
@@ -909,10 +921,10 @@ final class Cookiebot_WP {
909
  &nbsp; &nbsp;
910
  <label>
911
  <input type="radio" name="cookiebot-script-tag-uc-attribute" value="custom" <?php checked('custom',$cv, true); ?> />
912
- <i>Choose per subsite</i>
913
  </label>
914
  <p class="description">
915
- <b><?php _e('Setting will apply for all subsites. Subsites will not be able to override.'); ?></b><br />
916
  <?php _e('Add async or defer attribute to Cookiebot script tag. Default: Choose per subsite','cookiebot') ?>
917
  </p>
918
  </td>
@@ -920,7 +932,7 @@ final class Cookiebot_WP {
920
  <tr valign="top">
921
  <th scope="row">
922
  <?php _e('Add async or defer attribute','cookiebot'); ?>
923
- <br /><?php _e('Cookie declaration script tag'); ?>
924
  </th>
925
  <td>
926
  <?php
@@ -928,7 +940,7 @@ final class Cookiebot_WP {
928
  ?>
929
  <label>
930
  <input type="radio" name="cookiebot-script-tag-cd-attribute" value="" <?php checked('', $cv, true); ?> />
931
- <i>None</i>
932
  </label>
933
  &nbsp; &nbsp;
934
  <label>
@@ -943,10 +955,10 @@ final class Cookiebot_WP {
943
  &nbsp; &nbsp;
944
  <label>
945
  <input type="radio" name="cookiebot-script-tag-cd-attribute" value="custom" <?php checked('custom',$cv, true); ?> />
946
- <i>Choose per subsite</i>
947
  </label>
948
  <p class="description">
949
- <b><?php _e('Setting will apply for all subsites. Subsites will not be able to override.'); ?></b><br />
950
  <?php _e('Add async or defer attribute to Cookiebot script tag. Default: Choose per subsite','cookiebot') ?>
951
  </p>
952
  </td>
@@ -1102,14 +1114,108 @@ final class Cookiebot_WP {
1102
  </div>
1103
  <?php
1104
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1105
 
1106
  /**
1107
  * Cookiebot_WP Add Cookiebot JS to <head>
1108
  *
1109
- * @version 2.2.0
1110
  * @since 1.0.0
1111
  */
1112
- function add_js() {
1113
  $cbid = $this->get_cbid();
1114
  if(!empty($cbid) && !defined('COOKIEBOT_DISABLE_ON_PAGE')) {
1115
  if(is_multisite() && get_site_option('cookiebot-nooutput',false)) {
@@ -1119,9 +1225,9 @@ final class Cookiebot_WP {
1119
  return; //Do not show JS - output disabled
1120
  }
1121
 
1122
- if($this->get_cookie_blocking_mode() == 'auto' && $this->can_current_user_edit_theme() ) {
1123
- return;
1124
- }
1125
 
1126
  $lang = $this->get_language();
1127
  if(!empty($lang)) {
@@ -1140,9 +1246,12 @@ final class Cookiebot_WP {
1140
  }
1141
 
1142
  $iab = ( get_option('cookiebot-iab') != false ) ? 'data-framework="IAB"' : '';
1143
- ?>
1144
- <script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" <?php echo $iab; ?> data-cbid="<?php echo $cbid; ?>"<?php echo $lang; ?> type="text/javascript" <?php echo $tagAttr; ?>></script>
1145
- <?php
 
 
 
1146
  }
1147
  }
1148
 
@@ -1179,7 +1288,7 @@ final class Cookiebot_WP {
1179
  * @version 2.2.0
1180
  * @since 1.0.0
1181
  */
1182
- function show_declaration($atts) {
1183
  $cbid = $this->get_cbid();
1184
  $lang = '';
1185
  if(!empty($cbid)) {
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.0
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.0';
25
 
26
  /**
27
  * @var Cookiebot_WP The single instance of the class
139
 
140
  //Adding menu to WP admin
141
  add_action('admin_menu', array($this,'add_menu'),1);
142
+ add_action('admin_menu', array($this,'add_menu_debug'),50);
143
+
144
 
145
  if(is_multisite()) {
146
  add_action('network_admin_menu', array($this,'add_network_menu'),1);
252
  $icon = 'data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNzIgNTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNNDYuODcyNTkwMyA4Ljc3MzU4MzM0QzQxLjk0MzkwMzkgMy4zODI5NTAxMSAzNC44NDI0OTQ2IDAgMjYuOTQ4MjgxOSAwIDEyLjA2NTE1NjggMCAwIDEyLjAyNDQ3NzQgMCAyNi44NTc0MjE5YzAgMTQuODMyOTQ0NSAxMi4wNjUxNTY4IDI2Ljg1NzQyMTkgMjYuOTQ4MjgxOSAyNi44NTc0MjE5IDcuODk0MjEyNyAwIDE0Ljk5NTYyMi0zLjM4Mjk1MDIgMTkuOTI0MzA4NC04Ljc3MzU4MzQtMi44ODk2OTY3LTEuMzY4ODY2My01LjM5OTMxMS0zLjQwNTQzOS03LjMyODA4MzgtNS45MDk2MzU4LTMuMTIxNDMwNiAzLjIwOTQxMDQtNy40OTI5OTQ0IDUuMjA0MTI5MS0xMi4zMzIwMjU4IDUuMjA0MTI5MS05LjQ4NDM0NDQgMC0xNy4xNzI5MjQ3LTcuNjYyNjU3Mi0xNy4xNzI5MjQ3LTE3LjExNTAyMzhzNy42ODg1ODAzLTE3LjExNTAyMzcgMTcuMTcyOTI0Ny0xNy4xMTUwMjM3YzQuNzIzNDgyMiAwIDkuMDAxNTU1MiAxLjkwMDU5MzkgMTIuMTA2MjkyIDQuOTc2MzA5IDEuOTU2OTIzNy0yLjY0MTEzMSA0LjU1MDAyNjMtNC43ODU1MTgzIDcuNTUzODE3Ni02LjIwODQzMTg2eiIvPjxwYXRoIGQ9Ik01NS4zODAzMjgyIDQyLjY1MDE5OTFDNDYuMzMzNzIyNyA0Mi42NTAxOTkxIDM5IDM1LjM0MTIwMzEgMzkgMjYuMzI1MDk5NiAzOSAxNy4zMDg5OTYgNDYuMzMzNzIyNyAxMCA1NS4zODAzMjgyIDEwYzkuMDQ2NjA1NSAwIDE2LjM4MDMyODIgNy4zMDg5OTYgMTYuMzgwMzI4MiAxNi4zMjUwOTk2IDAgOS4wMTYxMDM1LTcuMzMzNzIyNyAxNi4zMjUwOTk1LTE2LjM4MDMyODIgMTYuMzI1MDk5NXptLjAyMTMwOTItNy43NTU2MzQyYzQuNzM3MDI3NiAwIDguNTc3MTQ3MS0zLjgyNzE3MiA4LjU3NzE0NzEtOC41NDgyMjc5IDAtNC43MjEwNTYtMy44NDAxMTk1LTguNTQ4MjI4LTguNTc3MTQ3MS04LjU0ODIyOC00LjczNzAyNzUgMC04LjU3NzE0NyAzLjgyNzE3Mi04LjU3NzE0NyA4LjU0ODIyOCAwIDQuNzIxMDU1OSAzLjg0MDExOTUgOC41NDgyMjc5IDguNTc3MTQ3IDguNTQ4MjI3OXoiLz48L2c+PC9zdmc+';
253
  add_menu_page( 'Cookiebot', __('Cookiebot','cookiebot'), 'manage_options', 'cookiebot', array($this,'settings_page'),$icon);
254
 
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
+ *
268
+ * @version 3.6.0
269
+ * @since 3.6.0
270
+ */
271
+ function add_menu_debug() {
272
+ add_submenu_page('cookiebot',__('Debug info','cookiebot'),__('Debug info','cookiebot'), 'manage_options', 'cookiebot_debug',array($this,'debug_page') );
273
+ }
274
 
275
  /**
276
  * Cookiebot_WP Add menu for network sites
757
  <table class="widefat striped consent_mapping_table">
758
  <thead>
759
  <tr>
760
+ <th><?php _e('Cookiebot categories','cookiebot'); ?></th>
761
+ <th class="consent_mapping"><?php _e('WP Consent Level categories','cookiebot'); ?></th>
762
  </tr>
763
  </thead>
764
  <?php
775
  <td>
776
  <div class="cb_consent">
777
  <span class="forceconsent">Necessary</span>
778
+ <span class="<?php echo ($state['preferences'] ? 'consent' : 'noconsent'); ?>"><?php _e('Preferences','cookiebot'); ?></span>
779
+ <span class="<?php echo ($state['statistics'] ? 'consent' : 'noconsent'); ?>"><?php _e('Statistics','cookiebot'); ?></span>
780
+ <span class="<?php echo ($state['marketing'] ? 'consent' : 'noconsent'); ?>"><?php _e('Marketing','cookiebot'); ?></span>
781
  </div>
782
  </td>
783
  <td>
784
  <div class="consent_mapping">
785
  <label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo $key; ?>][functional]" data-default-value="1" value="1" checked disabled> Functional </label>
786
+ <label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo $key; ?>][preferences]" data-default-value="<?php echo $mDefault[$key]['preferences']; ?>" value="1" <?php if($m[$key]['preferences']) { echo 'checked'; } ?>> <?php _e('Preferences','cookiebot'); ?> </label>
787
+ <label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo $key; ?>][statistics]" data-default-value="<?php echo $mDefault[$key]['statistics']; ?>" value="1" <?php if($m[$key]['statistics']) { echo 'checked'; } ?>> <?php _e('Statistics','cookiebot'); ?> </label>
788
+ <label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo $key; ?>][statistics-anonymous]" data-default-value="<?php echo $mDefault[$key]['statistics-anonymous']; ?>" value="1" <?php if($m[$key]['statistics-anonymous']) { echo 'checked'; } ?>> <?php _e('Statistics Anonymous','cookiebot'); ?></label>
789
+ <label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo $key; ?>][marketing]" data-default-value="<?php echo $mDefault[$key]['marketing']; ?>" value="1" <?php if($m[$key]['marketing']) { echo 'checked'; } ?>> <?php _e('Marketing','cookiebot'); ?></label>
790
  </div>
791
  </td>
792
  </tr>
795
  ?>
796
  <tfoot>
797
  <tr>
798
+ <td colspan="2" style="text-align:right;"><button class="button" onclick="return resetConsentMapping();"><?php _e('Reset to default mapping','cookiebot'); ?></button></td>
799
  </tr>
800
  </tfoot>
801
  </table>
836
  <?php _e('Cookiebot enables your website to comply with current legislation in the EU on the use of cookies for user tracking and profiling. The EU ePrivacy Directive requires prior, informed consent of your site users, while the <a href="https://www.cookiebot.com/goto/gdpr" target="_blank">General Data Protection Regulation (GDPR)</a> requires you to document each consent. At the same time you must be able to account for what user data you share with embedded third-party services on your website and where in the world the user data is sent.','cookiebot'); ?>
837
  </p>
838
  <p>
839
+ <b><big style="color:red;"><?php _e('The settings below is network wide settings. See notes below each field.','cookiebot'); ?></big></b>
840
  </p>
841
  <form method="post" action="edit.php?action=cookiebot_network_settings">
842
  <?php wp_nonce_field( 'cookiebot-network-settings' ); ?>
846
  <td>
847
  <input type="text" name="cookiebot-cbid" value="<?php echo esc_attr( get_site_option('cookiebot-cbid','') ); ?>" style="width:300px" />
848
  <p class="description">
849
+ <b><?php _e('If added this will be the default Cookiebot ID for all subsites. Subsites are able to override the Cookiebot ID.','cookiebot'); ?></b>
850
  <br />
851
  <?php _e('Need an ID?','cookiebot'); ?>
852
  <a href="https://www.cookiebot.com/goto/signup" target="_blank"><?php _e('Sign up for free on cookiebot.com','cookiebot'); ?></a>
906
  ?>
907
  <label>
908
  <input type="radio" name="cookiebot-script-tag-uc-attribute" value="" <?php checked('', $cv, true); ?> />
909
+ <i><?php _e('None','cookiebot'); ?></i>
910
  </label>
911
  &nbsp; &nbsp;
912
  <label>
921
  &nbsp; &nbsp;
922
  <label>
923
  <input type="radio" name="cookiebot-script-tag-uc-attribute" value="custom" <?php checked('custom',$cv, true); ?> />
924
+ <i><?php _e('Choose per subsite','cookiebot'); ?></i>
925
  </label>
926
  <p class="description">
927
+ <b><?php _e('Setting will apply for all subsites. Subsites will not be able to override.','cookiebot'); ?></b><br />
928
  <?php _e('Add async or defer attribute to Cookiebot script tag. Default: Choose per subsite','cookiebot') ?>
929
  </p>
930
  </td>
932
  <tr valign="top">
933
  <th scope="row">
934
  <?php _e('Add async or defer attribute','cookiebot'); ?>
935
+ <br /><?php _e('Cookie declaration script tag','cookiebot'); ?>
936
  </th>
937
  <td>
938
  <?php
940
  ?>
941
  <label>
942
  <input type="radio" name="cookiebot-script-tag-cd-attribute" value="" <?php checked('', $cv, true); ?> />
943
+ <i><?php _e('None','cookiebot'); ?></i>
944
  </label>
945
  &nbsp; &nbsp;
946
  <label>
955
  &nbsp; &nbsp;
956
  <label>
957
  <input type="radio" name="cookiebot-script-tag-cd-attribute" value="custom" <?php checked('custom',$cv, true); ?> />
958
+ <i><?php _e('Choose per subsite','cookiebot'); ?></i>
959
  </label>
960
  <p class="description">
961
+ <b><?php _e('Setting will apply for all subsites. Subsites will not be able to override.','cookiebot'); ?></b><br />
962
  <?php _e('Add async or defer attribute to Cookiebot script tag. Default: Choose per subsite','cookiebot') ?>
963
  </p>
964
  </td>
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";
1139
+ $debugStr.= "Wordpress Language: ".get_bloginfo('language')."\n";
1140
+ $debugStr.= "PHP Version: ".phpversion()."\n";
1141
+ $debugStr.= "MySQL Version: ".$wpdb->db_version()."\n";
1142
+ $debugStr.= "\n--- Cookiebot Information ---\n";
1143
+ $debugStr.= "Plugin Version: ".$this->version."\n";
1144
+ $debugStr.= "Cookiebot ID: ".$this->get_cbid()."\n";
1145
+ $debugStr.= "Blocking mode: ".get_option('cookiebot-cookie-blocking-mode')."\n";
1146
+ $debugStr.= "Language: ".get_option('cookiebot-language')."\n";
1147
+ $debugStr.= "IAB: ".(get_option('cookiebot-iab') == '1' ? 'Enabled' : 'Not enabled')."\n";
1148
+ $debugStr.= "Add async/defer to banner tag: ".(get_option('cookiebot-script-tag-uc-attribute') != '' ? get_option('cookiebot-script-tag-uc-attribute') : 'None')."\n";
1149
+ $debugStr.= "Add async/defer to declaration tag: ".(get_option('cookiebot-script-tag-cd-attribute') != '' ? get_option('cookiebot-script-tag-cd-attribute') : 'None')."\n";
1150
+ $debugStr.= "Auto update: ".(get_option('cookiebot-autoupdate') == '1' ? 'Enabled' : 'Not enabled')."\n";
1151
+ $debugStr.= "Hide Cookie Popup: ".(get_option('cookiebot-nooutput') == '1' ? 'Yes' : 'No')."\n";
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' );
1178
+ $addons = $settingservice->get_active_addons();
1179
+ $debugStr.= "\n--- Activated Cookiebot Addons ---\n";
1180
+ foreach($addons as $addon) {
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>
1197
+ <p><?php _e('The information below is for debugging purpose. If you have any issues with your Cookiebot integration, the information below is usefull for a supporter to help you the best way.'); ?></p>
1198
+ <p><button class="button button-primary" onclick="copyDebugInfo();"><?php _e('Copy debug information to clipboard'); ?></button></p>
1199
+ <textarea cols="100" rows="40" style="width:800px;max-width:100%;" id="cookiebot-debug-info" readonly><?php echo $debugStr; ?></textarea>
1200
+ <script>
1201
+ function copyDebugInfo() {
1202
+ var t = document.getElementById("cookiebot-debug-info");
1203
+ t.select();
1204
+ t.setSelectionRange(0, 99999);
1205
+ document.execCommand("copy");
1206
+ }
1207
+ </script>
1208
+ </div>
1209
+ <?php
1210
+ }
1211
 
1212
  /**
1213
  * Cookiebot_WP Add Cookiebot JS to <head>
1214
  *
1215
+ * @version 3.6.0
1216
  * @since 1.0.0
1217
  */
1218
+ function add_js($printTag=true) {
1219
  $cbid = $this->get_cbid();
1220
  if(!empty($cbid) && !defined('COOKIEBOT_DISABLE_ON_PAGE')) {
1221
  if(is_multisite() && get_site_option('cookiebot-nooutput',false)) {
1225
  return; //Do not show JS - output disabled
1226
  }
1227
 
1228
+ if($this->get_cookie_blocking_mode() == 'auto' && $this->can_current_user_edit_theme() && $printTag !== false ) {
1229
+ return;
1230
+ }
1231
 
1232
  $lang = $this->get_language();
1233
  if(!empty($lang)) {
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
 
1288
  * @version 2.2.0
1289
  * @since 1.0.0
1290
  */
1291
+ function show_declaration($atts=array()) {
1292
  $cbid = $this->get_cbid();
1293
  $lang = '';
1294
  if(!empty($cbid)) {
readme.txt CHANGED
@@ -3,7 +3,7 @@
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.5.0
7
  * Requires PHP: 5.6
8
  * License: GPLv2 or later
9
 
@@ -190,6 +190,10 @@ You are able to define the mapping between Cookiebot and the WP Consent API in t
190
 
191
  ## Changelog ##
192
 
 
 
 
 
193
  ### 3.5.0 - 2020-02-10 ###
194
  * Adding integration with WP Consent API
195
 
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.0
7
  * Requires PHP: 5.6
8
  * License: GPLv2 or later
9
 
190
 
191
  ## Changelog ##
192
 
193
+ ### 3.6.0 - 2020-02-18 ###
194
+ * Adding Debugging submenu
195
+ * Update GADWP addon to support newest version of plugin
196
+
197
  ### 3.5.0 - 2020-02-10 ###
198
  * Adding integration with WP Consent API
199