Cookiebot | GDPR Compliant Cookie Consent and Notice - Version 3.7.0

Version Description

Download this release

Release Info

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

Code changes from version 3.6.6 to 3.7.0

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.6' );
27
 
28
  /**
29
  * Register autoloader to load files/classes dynamically
23
  /**
24
  * Same version as the CookiebotWP
25
  */
26
+ define( 'COOKIEBOT_ADDONS_VERSION', '3.7.0' );
27
 
28
  /**
29
  * Register autoloader to load files/classes dynamically
bin/install-wp-tests.sh ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ if [ $# -lt 3 ]; then
4
+ echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]"
5
+ exit 1
6
+ fi
7
+
8
+ DB_NAME=$1
9
+ DB_USER=$2
10
+ DB_PASS=$3
11
+ DB_HOST=${4-localhost}
12
+ WP_VERSION=${5-latest}
13
+ SKIP_DB_CREATE=${6-false}
14
+
15
+ TMPDIR=${TMPDIR-/tmp}
16
+ TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
17
+ WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
18
+ WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/}
19
+
20
+ download() {
21
+ if [ `which curl` ]; then
22
+ curl -s "$1" > "$2";
23
+ elif [ `which wget` ]; then
24
+ wget -nv -O "$2" "$1"
25
+ fi
26
+ }
27
+
28
+ if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+\-(beta|RC)[0-9]+$ ]]; then
29
+ WP_BRANCH=${WP_VERSION%\-*}
30
+ WP_TESTS_TAG="branches/$WP_BRANCH"
31
+
32
+ elif [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then
33
+ WP_TESTS_TAG="branches/$WP_VERSION"
34
+ elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
35
+ if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
36
+ # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
37
+ WP_TESTS_TAG="tags/${WP_VERSION%??}"
38
+ else
39
+ WP_TESTS_TAG="tags/$WP_VERSION"
40
+ fi
41
+ elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
42
+ WP_TESTS_TAG="trunk"
43
+ else
44
+ # http serves a single offer, whereas https serves multiple. we only want one
45
+ download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json
46
+ grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json
47
+ LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
48
+ if [[ -z "$LATEST_VERSION" ]]; then
49
+ echo "Latest WordPress version could not be found"
50
+ exit 1
51
+ fi
52
+ WP_TESTS_TAG="tags/$LATEST_VERSION"
53
+ fi
54
+ set -ex
55
+
56
+ install_wp() {
57
+
58
+ if [ -d $WP_CORE_DIR ]; then
59
+ return;
60
+ fi
61
+
62
+ mkdir -p $WP_CORE_DIR
63
+
64
+ if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
65
+ mkdir -p $TMPDIR/wordpress-nightly
66
+ download https://wordpress.org/nightly-builds/wordpress-latest.zip $TMPDIR/wordpress-nightly/wordpress-nightly.zip
67
+ unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/
68
+ mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR
69
+ else
70
+ if [ $WP_VERSION == 'latest' ]; then
71
+ local ARCHIVE_NAME='latest'
72
+ elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then
73
+ # https serves multiple offers, whereas http serves single.
74
+ download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json
75
+ if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
76
+ # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
77
+ LATEST_VERSION=${WP_VERSION%??}
78
+ else
79
+ # otherwise, scan the releases and get the most up to date minor version of the major release
80
+ local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'`
81
+ LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1)
82
+ fi
83
+ if [[ -z "$LATEST_VERSION" ]]; then
84
+ local ARCHIVE_NAME="wordpress-$WP_VERSION"
85
+ else
86
+ local ARCHIVE_NAME="wordpress-$LATEST_VERSION"
87
+ fi
88
+ else
89
+ local ARCHIVE_NAME="wordpress-$WP_VERSION"
90
+ fi
91
+ download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz
92
+ tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR
93
+ fi
94
+
95
+ download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
96
+ }
97
+
98
+ install_test_suite() {
99
+ # portable in-place argument for both GNU sed and Mac OSX sed
100
+ if [[ $(uname -s) == 'Darwin' ]]; then
101
+ local ioption='-i.bak'
102
+ else
103
+ local ioption='-i'
104
+ fi
105
+
106
+ # set up testing suite if it doesn't yet exist
107
+ if [ ! -d $WP_TESTS_DIR ]; then
108
+ # set up testing suite
109
+ mkdir -p $WP_TESTS_DIR
110
+ svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
111
+ svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
112
+ fi
113
+
114
+ if [ ! -f wp-tests-config.php ]; then
115
+ download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
116
+ # remove all forward slashes in the end
117
+ WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::")
118
+ sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php
119
+ sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
120
+ sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
121
+ sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
122
+ sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
123
+ fi
124
+
125
+ }
126
+
127
+ install_db() {
128
+
129
+ if [ ${SKIP_DB_CREATE} = "true" ]; then
130
+ return 0
131
+ fi
132
+
133
+ # parse DB_HOST for port or socket references
134
+ local PARTS=(${DB_HOST//\:/ })
135
+ local DB_HOSTNAME=${PARTS[0]};
136
+ local DB_SOCK_OR_PORT=${PARTS[1]};
137
+ local EXTRA=""
138
+
139
+ if ! [ -z $DB_HOSTNAME ] ; then
140
+ if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then
141
+ EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
142
+ elif ! [ -z $DB_SOCK_OR_PORT ] ; then
143
+ EXTRA=" --socket=$DB_SOCK_OR_PORT"
144
+ elif ! [ -z $DB_HOSTNAME ] ; then
145
+ EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
146
+ fi
147
+ fi
148
+
149
+ # create database
150
+ mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
151
+ }
152
+
153
+ install_wp
154
+ install_test_suite
155
+ install_db
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.6
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.6';
25
 
26
  /**
27
  * @var Cookiebot_WP The single instance of the class
@@ -59,6 +59,7 @@ final class Cookiebot_WP {
59
  register_deactivation_hook( __FILE__, 'cookiebot_addons_plugin_deactivated' );
60
 
61
  $this->cookiebot_fix_plugin_conflicts();
 
62
  }
63
 
64
  /**
@@ -152,6 +153,7 @@ final class Cookiebot_WP {
152
 
153
  //Adding menu to WP admin
154
  add_action('admin_menu', array($this,'add_menu'),1);
 
155
  add_action('admin_menu', array($this,'add_menu_debug'),50);
156
 
157
 
@@ -192,8 +194,8 @@ final class Cookiebot_WP {
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
@@ -204,7 +206,42 @@ final class Cookiebot_WP {
204
  //Loading widgets
205
  include_once( dirname( __FILE__ ) . '/widgets/cookiebot-declaration-widget.php' );
206
  add_action( 'widgets_init', array($this,'register_widgets') );
207
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  }
209
 
210
  /**
@@ -268,16 +305,20 @@ final class Cookiebot_WP {
268
  $icon = 'data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNzIgNTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNNDYuODcyNTkwMyA4Ljc3MzU4MzM0QzQxLjk0MzkwMzkgMy4zODI5NTAxMSAzNC44NDI0OTQ2IDAgMjYuOTQ4MjgxOSAwIDEyLjA2NTE1NjggMCAwIDEyLjAyNDQ3NzQgMCAyNi44NTc0MjE5YzAgMTQuODMyOTQ0NSAxMi4wNjUxNTY4IDI2Ljg1NzQyMTkgMjYuOTQ4MjgxOSAyNi44NTc0MjE5IDcuODk0MjEyNyAwIDE0Ljk5NTYyMi0zLjM4Mjk1MDIgMTkuOTI0MzA4NC04Ljc3MzU4MzQtMi44ODk2OTY3LTEuMzY4ODY2My01LjM5OTMxMS0zLjQwNTQzOS03LjMyODA4MzgtNS45MDk2MzU4LTMuMTIxNDMwNiAzLjIwOTQxMDQtNy40OTI5OTQ0IDUuMjA0MTI5MS0xMi4zMzIwMjU4IDUuMjA0MTI5MS05LjQ4NDM0NDQgMC0xNy4xNzI5MjQ3LTcuNjYyNjU3Mi0xNy4xNzI5MjQ3LTE3LjExNTAyMzhzNy42ODg1ODAzLTE3LjExNTAyMzcgMTcuMTcyOTI0Ny0xNy4xMTUwMjM3YzQuNzIzNDgyMiAwIDkuMDAxNTU1MiAxLjkwMDU5MzkgMTIuMTA2MjkyIDQuOTc2MzA5IDEuOTU2OTIzNy0yLjY0MTEzMSA0LjU1MDAyNjMtNC43ODU1MTgzIDcuNTUzODE3Ni02LjIwODQzMTg2eiIvPjxwYXRoIGQ9Ik01NS4zODAzMjgyIDQyLjY1MDE5OTFDNDYuMzMzNzIyNyA0Mi42NTAxOTkxIDM5IDM1LjM0MTIwMzEgMzkgMjYuMzI1MDk5NiAzOSAxNy4zMDg5OTYgNDYuMzMzNzIyNyAxMCA1NS4zODAzMjgyIDEwYzkuMDQ2NjA1NSAwIDE2LjM4MDMyODIgNy4zMDg5OTYgMTYuMzgwMzI4MiAxNi4zMjUwOTk2IDAgOS4wMTYxMDM1LTcuMzMzNzIyNyAxNi4zMjUwOTk1LTE2LjM4MDMyODIgMTYuMzI1MDk5NXptLjAyMTMwOTItNy43NTU2MzQyYzQuNzM3MDI3NiAwIDguNTc3MTQ3MS0zLjgyNzE3MiA4LjU3NzE0NzEtOC41NDgyMjc5IDAtNC43MjEwNTYtMy44NDAxMTk1LTguNTQ4MjI4LTguNTc3MTQ3MS04LjU0ODIyOC00LjczNzAyNzUgMC04LjU3NzE0NyAzLjgyNzE3Mi04LjU3NzE0NyA4LjU0ODIyOCAwIDQuNzIxMDU1OSAzLjg0MDExOTUgOC41NDgyMjc5IDguNTc3MTQ3IDguNTQ4MjI3OXoiLz48L2c+PC9zdmc+';
269
  add_menu_page( 'Cookiebot', __('Cookiebot','cookiebot'), 'manage_options', 'cookiebot', array($this,'settings_page'),$icon);
270
 
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
  *
@@ -330,6 +371,8 @@ final class Cookiebot_WP {
330
  register_setting('cookiebot', 'cookiebot-cookie-blocking-mode');
331
  register_setting('cookiebot', 'cookiebot-consent-mapping');
332
  register_setting('cookiebot-iab', 'cookiebot-iab');
 
 
333
  }
334
 
335
  /**
@@ -1131,6 +1174,47 @@ final class Cookiebot_WP {
1131
  <?php
1132
  }
1133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1134
  /**
1135
  * Cookiebot_WP Debug Page
1136
  *
@@ -1161,6 +1245,8 @@ final class Cookiebot_WP {
1161
  $debugStr.= "Blocking mode: ".get_option('cookiebot-cookie-blocking-mode')."\n";
1162
  $debugStr.= "Language: ".get_option('cookiebot-language')."\n";
1163
  $debugStr.= "IAB: ".(get_option('cookiebot-iab') == '1' ? 'Enabled' : 'Not enabled')."\n";
 
 
1164
  $debugStr.= "Add async/defer to banner tag: ".(get_option('cookiebot-script-tag-uc-attribute') != '' ? get_option('cookiebot-script-tag-uc-attribute') : 'None')."\n";
1165
  $debugStr.= "Add async/defer to declaration tag: ".(get_option('cookiebot-script-tag-cd-attribute') != '' ? get_option('cookiebot-script-tag-cd-attribute') : 'None')."\n";
1166
  $debugStr.= "Auto update: ".(get_option('cookiebot-autoupdate') == '1' ? 'Enabled' : 'Not enabled')."\n";
@@ -1263,7 +1349,9 @@ final class Cookiebot_WP {
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
  }
@@ -1422,7 +1510,7 @@ final class Cookiebot_WP {
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
  *
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.7.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.7.0';
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
+ $this->gutenberg_block_setup();
63
  }
64
 
65
  /**
153
 
154
  //Adding menu to WP admin
155
  add_action('admin_menu', array($this,'add_menu'),1);
156
+ add_action('admin_menu', array($this,'add_menu_legislations'),40);
157
  add_action('admin_menu', array($this,'add_menu_debug'),50);
158
 
159
 
194
  if(defined('WP_ROCKET_VERSION')) {
195
  add_filter('rocket_minify_excluded_external_js', array($this,'wp_rocket_exclude_external_js'));
196
  }
197
+
198
+ //Add filter
199
  add_filter( 'sgo_javascript_combine_excluded_external_paths', array($this,'sgo_exclude_external_js') );
200
 
201
  //Automatic update plugin
206
  //Loading widgets
207
  include_once( dirname( __FILE__ ) . '/widgets/cookiebot-declaration-widget.php' );
208
  add_action( 'widgets_init', array($this,'register_widgets') );
209
+
210
+ }
211
+
212
+
213
+ /**
214
+ * Cookiebot_WP Setup Gutenberg block
215
+ *
216
+ * @version 3.7.0
217
+ * @since 3.7.0
218
+ */
219
+ function gutenberg_block_setup() {
220
+ if ( ! function_exists( 'register_block_type' ) ) {
221
+ return; //gutenberg not active
222
+ }
223
+
224
+ //Add Gutenberg Widget
225
+ wp_enqueue_script(
226
+ 'cookiebot-declaration',
227
+ plugin_dir_url( __FILE__ ) . '/js/block.js',
228
+ array('wp-blocks', 'wp-i18n', 'wp-element'), // Required scripts for the block
229
+ $this->version
230
+ );
231
+
232
+ register_block_type( 'cookiebot/cookie-declaration', array(
233
+ 'render_callback' => array( $this, 'block_cookie_declaration' )
234
+ ) );
235
+ }
236
+
237
+ /**
238
+ * Cookiebot_WP Render Cookiebot Declaration as Gutenberg block
239
+ *
240
+ * @version 3.7.0
241
+ * @since 3.7.0
242
+ */
243
+ function block_cookie_declaration() {
244
+ return $this->show_declaration();
245
  }
246
 
247
  /**
305
  $icon = 'data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNzIgNTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNNDYuODcyNTkwMyA4Ljc3MzU4MzM0QzQxLjk0MzkwMzkgMy4zODI5NTAxMSAzNC44NDI0OTQ2IDAgMjYuOTQ4MjgxOSAwIDEyLjA2NTE1NjggMCAwIDEyLjAyNDQ3NzQgMCAyNi44NTc0MjE5YzAgMTQuODMyOTQ0NSAxMi4wNjUxNTY4IDI2Ljg1NzQyMTkgMjYuOTQ4MjgxOSAyNi44NTc0MjE5IDcuODk0MjEyNyAwIDE0Ljk5NTYyMi0zLjM4Mjk1MDIgMTkuOTI0MzA4NC04Ljc3MzU4MzQtMi44ODk2OTY3LTEuMzY4ODY2My01LjM5OTMxMS0zLjQwNTQzOS03LjMyODA4MzgtNS45MDk2MzU4LTMuMTIxNDMwNiAzLjIwOTQxMDQtNy40OTI5OTQ0IDUuMjA0MTI5MS0xMi4zMzIwMjU4IDUuMjA0MTI5MS05LjQ4NDM0NDQgMC0xNy4xNzI5MjQ3LTcuNjYyNjU3Mi0xNy4xNzI5MjQ3LTE3LjExNTAyMzhzNy42ODg1ODAzLTE3LjExNTAyMzcgMTcuMTcyOTI0Ny0xNy4xMTUwMjM3YzQuNzIzNDgyMiAwIDkuMDAxNTU1MiAxLjkwMDU5MzkgMTIuMTA2MjkyIDQuOTc2MzA5IDEuOTU2OTIzNy0yLjY0MTEzMSA0LjU1MDAyNjMtNC43ODU1MTgzIDcuNTUzODE3Ni02LjIwODQzMTg2eiIvPjxwYXRoIGQ9Ik01NS4zODAzMjgyIDQyLjY1MDE5OTFDNDYuMzMzNzIyNyA0Mi42NTAxOTkxIDM5IDM1LjM0MTIwMzEgMzkgMjYuMzI1MDk5NiAzOSAxNy4zMDg5OTYgNDYuMzMzNzIyNyAxMCA1NS4zODAzMjgyIDEwYzkuMDQ2NjA1NSAwIDE2LjM4MDMyODIgNy4zMDg5OTYgMTYuMzgwMzI4MiAxNi4zMjUwOTk2IDAgOS4wMTYxMDM1LTcuMzMzNzIyNyAxNi4zMjUwOTk1LTE2LjM4MDMyODIgMTYuMzI1MDk5NXptLjAyMTMwOTItNy43NTU2MzQyYzQuNzM3MDI3NiAwIDguNTc3MTQ3MS0zLjgyNzE3MiA4LjU3NzE0NzEtOC41NDgyMjc5IDAtNC43MjEwNTYtMy44NDAxMTk1LTguNTQ4MjI4LTguNTc3MTQ3MS04LjU0ODIyOC00LjczNzAyNzUgMC04LjU3NzE0NyAzLjgyNzE3Mi04LjU3NzE0NyA4LjU0ODIyOCAwIDQuNzIxMDU1OSAzLjg0MDExOTUgOC41NDgyMjc5IDguNTc3MTQ3IDguNTQ4MjI3OXoiLz48L2c+PC9zdmc+';
306
  add_menu_page( 'Cookiebot', __('Cookiebot','cookiebot'), 'manage_options', 'cookiebot', array($this,'settings_page'),$icon);
307
 
308
+ add_submenu_page('cookiebot',__('Cookiebot Settings','cookiebot'),__('Settings','cookiebot'), 'manage_options', 'cookiebot',array($this,'settings_page'), 10 );
309
+ add_submenu_page('cookiebot',__('Cookiebot Support','cookiebot'),__('Support','cookiebot'), 'manage_options', 'cookiebot_support',array($this,'support_page'), 20 );
310
+ add_submenu_page('cookiebot',__('IAB','cookiebot'),__('IAB','cookiebot'), 'manage_options', 'cookiebot_iab',array($this,'iab_page'), 30 );
311
 
312
  if(defined('COOKIEBOT_ADDONS_UNSUPPORTED_PHPVERSION')) {
313
  //Load prior consent page anyway - but from Cookiebot WP Core plugin.
314
+ add_submenu_page( 'cookiebot', __( 'Prior Consent', 'cookiebot' ), __( 'Prior Consent', 'cookiebot' ), 'manage_options', 'cookiebot-addons', array($this,'setting_page_placeholder' ), 40 );
315
  }
316
  }
317
 
318
+ function add_menu_legislations() {
319
+ add_submenu_page( 'cookiebot', __( 'Legislations', 'cookiebot' ), __( 'Legislations', 'cookiebot' ), 'manage_options', 'cookiebot-legislations', array($this,'legislations_page' ), 50 );
320
+ }
321
+
322
  /**
323
  * Cookiebot_WP Add debug menu - we need to add this seperate to ensure it is placed last (after menu items from Addons).
324
  *
371
  register_setting('cookiebot', 'cookiebot-cookie-blocking-mode');
372
  register_setting('cookiebot', 'cookiebot-consent-mapping');
373
  register_setting('cookiebot-iab', 'cookiebot-iab');
374
+ register_setting('cookiebot-legislations', 'cookiebot-ccpa');
375
+ register_setting('cookiebot-legislations', 'cookiebot-ccpa-domain-group-id');
376
  }
377
 
378
  /**
1174
  <?php
1175
  }
1176
 
1177
+ /**
1178
+ * Cookiebot_WP Cookiebot legislations page
1179
+ *
1180
+ * @version 3.6.6
1181
+ * @since 3.6.6
1182
+ */
1183
+ function legislations_page() {
1184
+ ?>
1185
+ <div class="wrap">
1186
+ <h1><?php _e('Legislations','cookiebot'); ?></h1>
1187
+
1188
+ <p>For more details about Cookiebot's CCPA Legislation integration, see <a href="https://support.cookiebot.com/hc/en-us/articles/360010932419-Use-multiple-banners-on-the-same-website-support-both-CCPA-GDPR-compliance-" target="_blank">article about cookiebot and the CCPA compliance</a></p>
1189
+
1190
+ <form method="post" action="options.php">
1191
+ <?php settings_fields( 'cookiebot-legislations' ); ?>
1192
+ <?php do_settings_sections( 'cookiebot-legislations' ); ?>
1193
+
1194
+
1195
+ <table class="form-table">
1196
+ <tbody>
1197
+ <tr valign="top">
1198
+ <th scope="row"><label>Enable CCPA banner for visitors from California</label></th>
1199
+ <td>
1200
+ <input type="checkbox" name="cookiebot-ccpa" value="1" <?php checked(1,get_option('cookiebot-ccpa'), true); ?>>
1201
+ </td>
1202
+ </tr>
1203
+ <tr>
1204
+ <th valign="top"><label>Domain Group ID</label></th>
1205
+ <td>
1206
+ <input type="text" style="width: 300px;" name="cookiebot-ccpa-domain-group-id" value="<?php echo get_option('cookiebot-ccpa-domain-group-id'); ?>">
1207
+ </td>
1208
+ </tr>
1209
+ </tbody>
1210
+ </table>
1211
+
1212
+ <?php submit_button(); ?>
1213
+ </form>
1214
+ </div>
1215
+ <?php
1216
+ }
1217
+
1218
  /**
1219
  * Cookiebot_WP Debug Page
1220
  *
1245
  $debugStr.= "Blocking mode: ".get_option('cookiebot-cookie-blocking-mode')."\n";
1246
  $debugStr.= "Language: ".get_option('cookiebot-language')."\n";
1247
  $debugStr.= "IAB: ".(get_option('cookiebot-iab') == '1' ? 'Enabled' : 'Not enabled')."\n";
1248
+ $debugStr.= "CCPA banner for visitors from California: ".(get_option('cookiebot-ccpa') == '1' ? 'Enabled' : 'Not enabled')."\n";
1249
+ $debugStr.= "CCPA domain group id: ". get_option('cookiebot-ccpa-domain-group-id') ."\n";
1250
  $debugStr.= "Add async/defer to banner tag: ".(get_option('cookiebot-script-tag-uc-attribute') != '' ? get_option('cookiebot-script-tag-uc-attribute') : 'None')."\n";
1251
  $debugStr.= "Add async/defer to declaration tag: ".(get_option('cookiebot-script-tag-cd-attribute') != '' ? get_option('cookiebot-script-tag-cd-attribute') : 'None')."\n";
1252
  $debugStr.= "Auto update: ".(get_option('cookiebot-autoupdate') == '1' ? 'Enabled' : 'Not enabled')."\n";
1349
 
1350
  $iab = ( get_option('cookiebot-iab') != false ) ? 'data-framework="IAB"' : '';
1351
 
1352
+ $ccpa = ( get_option('cookiebot-ccpa') != false ) ? 'data-georegions="{\'region\':\'US-06\',\'cbid\':\''.get_option('cookiebot-ccpa-domain-group-id').'\'}"' : '';
1353
+
1354
+ $tag = '<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" '.$iab.' '.$ccpa.' data-cbid="'.$cbid.'"'.$lang.' type="text/javascript" '.$tagAttr.'></script>';
1355
  if($printTag===false) {
1356
  return $tag;
1357
  }
1510
  $external_js_hosts[] = 'consentcdn.cookiebot.com';
1511
  return $external_js_hosts;
1512
  }
1513
+
1514
  /**
1515
  * Cookiebot_WP Adding Cookiebot domain(s) to exclude list for SGO minification.
1516
  *
js/block.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function( blocks, element ) {
2
+ var el = element.createElement,
3
+ registerBlockType = blocks.registerBlockType;
4
+
5
+ registerBlockType( 'cookiebot/cookie-declaration', {
6
+ title: 'Cookie Declaration',
7
+ keywords: ['cookiebot'],
8
+ icon: 'media-spreadsheet',
9
+ category: 'widgets',
10
+ edit: function(props) {
11
+ return el(
12
+ 'i',
13
+ {},
14
+ 'Cookiebot Cookie Declaration'
15
+ );
16
+ },
17
+ } );
18
+ }(
19
+ window.wp.blocks,
20
+ window.wp.element,
21
+ ) );
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.4.2
6
- * Stable tag: 3.6.6
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.6.6 - 2020-06-16 ###
194
  * Fix through addon for Lightspeed Cache
195
  * Added addon for Enchanged Ecommerce for WooCommerce
3
  * Tags: cookie, compliance, eu, gdpr, europe, cookie consent, consent, ccpa
4
  * Requires at least: 4.4
5
  * Tested up to: 5.4.2
6
+ * Stable tag: 3.7.0
7
  * Requires PHP: 5.6
8
  * License: GPLv2 or later
9
 
190
 
191
  ## Changelog ##
192
 
193
+ ### 3.7.0 - 2020-07-06 ###
194
+ * Adding CCPA feature
195
+ * Adding Gutenberg Cookie Declaration block for editor
196
+
197
  ### 3.6.6 - 2020-06-16 ###
198
  * Fix through addon for Lightspeed Cache
199
  * Added addon for Enchanged Ecommerce for WooCommerce
tests/bootstrap.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPUnit bootstrap file
4
+ *
5
+ * @package Cookiebot
6
+ */
7
+
8
+ $_tests_dir = getenv( 'WP_TESTS_DIR' );
9
+
10
+ if ( ! $_tests_dir ) {
11
+ $_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
12
+ }
13
+
14
+ if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
15
+ echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; // WPCS: XSS ok.
16
+ exit( 1 );
17
+ }
18
+
19
+ // Give access to tests_add_filter() function.
20
+ require_once $_tests_dir . '/includes/functions.php';
21
+
22
+ /**
23
+ * Manually load the plugin being tested.
24
+ */
25
+ function _manually_load_plugin() {
26
+ require dirname( dirname( __FILE__ ) ) . '/cookiebot.php';
27
+ }
28
+ tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
29
+
30
+ // Start up the WP testing environment.
31
+ require $_tests_dir . '/includes/bootstrap.php';
tests/test-sample.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class SampleTest
4
+ *
5
+ * @package Cookiebot
6
+ */
7
+
8
+ /**
9
+ * Sample test case.
10
+ */
11
+ class SampleTest extends WP_UnitTestCase {
12
+
13
+ /**
14
+ * A single example test.
15
+ */
16
+ public function test_sample() {
17
+ // Replace this with some actual testing code.
18
+ $this->assertTrue( true );
19
+ }
20
+ }