WP GDPR Compliance - Version 1.5.2

Version Description

Release date: 21th May, 2019 * Tested with WordPress 5.2. * Load accepted consents with JavaScript to improve performance. * Use different text when all consent is required. * When standard Consent bar/button colors are used, no empty attributes will be added to the elements. * Bugfix: WP Registration integration now also works on MultiSite, accepted consent on registering gets added to the 'wpgdprc_log' table. * Bugfix: Error shown in the WooCommerce Order page is removed.

Download this release

Release Info

Developer Van Ons
Plugin Icon 128x128 WP GDPR Compliance
Version 1.5.2
Comparing to
See all releases

Code changes from version 1.5.1 to 1.5.2

Includes/Action.php CHANGED
@@ -138,29 +138,49 @@ class Action {
138
  }
139
 
140
  public function addConsentBar() {
141
- $consentBarColor = get_option(WP_GDPR_C_PREFIX . '_settings_consents_bar_color');
142
- $consentBarTextColor = get_option(WP_GDPR_C_PREFIX . '_settings_consents_bar_text_color');
143
- $consentBarButtonColor = get_option(WP_GDPR_C_PREFIX . '_settings_consents_bar_button_color_primary');
144
- $consentBarButtonTextColor = get_option(WP_GDPR_C_PREFIX . '_settings_consents_bar_button_color_secondary');
145
- $output = '<div class="wpgdprc wpgdprc-consent-bar" style="display: none; background: ' . $consentBarColor . '">';
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  $output .= '<div class="wpgdprc-consent-bar__container">';
147
- $output .= '<div class="wpgdprc-consent-bar__content" style="color: ' . $consentBarTextColor . ';">';
148
  $output .= '<div class="wpgdprc-consent-bar__column">';
149
  $output .= '<div class="wpgdprc-consent-bar__notice">';
150
  $output .= apply_filters('wpgdprc_the_content', Consent::getBarExplanationText());
151
  $output .= '</div>';
152
  $output .= '</div>';
153
  $output .= '<div class="wpgdprc-consent-bar__column">';
154
- $output .= sprintf(
155
- '<a class="wpgdprc-consent-bar__settings" href="javascript:void(0);" data-micromodal-trigger="wpgdprc-consent-modal">%s</a>',
156
- esc_attr__('My settings', WP_GDPR_C_SLUG)
157
- );
158
  $output .= '</div>';
159
  $output .= '<div class="wpgdprc-consent-bar__column">';
160
- $output .= sprintf(
161
- '<button class="wpgdprc-button wpgdprc-consent-bar__button" style="background: ' . $consentBarButtonColor . '; color: ' . $consentBarButtonTextColor . ';">%s</button>',
162
- __('Accept', WP_GDPR_C_SLUG)
163
- );
 
 
 
 
 
 
 
164
  $output .= '</div>';
165
  $output .= '</div>';
166
  $output .= '</div>';
@@ -168,13 +188,30 @@ class Action {
168
  echo apply_filters('wpgdprc_consent_bar', $output);
169
  }
170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  public function addConsentModal() {
172
- $consentModalButtonColor = get_option(WP_GDPR_C_PREFIX . '_settings_consents_bar_button_color_secondary');
173
- $consentModalButtonTextColor = get_option(WP_GDPR_C_PREFIX . '_settings_consents_bar_button_color_primary');
 
174
  $consentIds = (array)Helper::getConsentIdsByCookie();
175
  $consents = Consent::getInstance()->getList(array(
176
  'active' => array('value' => 1)
177
  ));
 
178
  $output = '<div class="wpgdprc wpgdprc-consent-modal" id="wpgdprc-consent-modal" aria-hidden="true">';
179
  $output .= '<div class="wpgdprc-consent-modal__overlay" tabindex="-1" data-micromodal-close>';
180
  $output .= '<div class="wpgdprc-consent-modal__container" role="dialog" aria-modal="true">';
@@ -236,10 +273,18 @@ class Action {
236
  $output .= '</div>'; // .wpgdprc-consent-modal__description
237
  }
238
  $output .= '<footer class="wpgdprc-consent-modal__footer">';
239
- $output .= sprintf(
240
- '<a class="wpgdprc-button wpgdprc-button--secondary" href="javascript:void(0);" style="background: ' . $consentModalButtonColor . '; color: ' . $consentModalButtonTextColor . ';">%s</a>',
241
- __('Save my settings', WP_GDPR_C_SLUG)
242
- );
 
 
 
 
 
 
 
 
243
  $output .= '</footer>'; // .wpgdprc-consent-modal__footer
244
  $output .= '</div>'; // .wpgdprc-consent-modal__information
245
  }
138
  }
139
 
140
  public function addConsentBar() {
141
+ $consentRequiredStatus = $this->checkAllConsentsRequired();
142
+ $consentBarColor = get_option(WP_GDPR_C_PREFIX . '_settings_consents_bar_color');
143
+ $consentBarTextColor = get_option(WP_GDPR_C_PREFIX . '_settings_consents_bar_text_color');
144
+ $consentBarButtonColor = get_option(WP_GDPR_C_PREFIX . '_settings_consents_bar_button_color_primary');
145
+ $consentBarButtonTextColor = get_option(WP_GDPR_C_PREFIX . '_settings_consents_bar_button_color_secondary');
146
+ $consentBarStyling = array(
147
+ 'display: none;'
148
+ );
149
+ if (!empty($consentBarColor)) {
150
+ $consentBarStyling[] = 'background: ' . $consentBarColor .';';
151
+ }
152
+ $consentBarTextStyling = array();
153
+ if (!empty($consentBarTextColor)) {
154
+ $consentBarTextStyling[] = 'color: ' . $consentBarTextColor . ';';
155
+ }
156
+
157
+ $text = ($consentRequiredStatus) ? esc_attr__('More information', WP_GDPR_C_SLUG) : esc_attr__('My settings', WP_GDPR_C_SLUG);
158
+ $output = '<div class="wpgdprc wpgdprc-consent-bar" style="' . implode('', $consentBarStyling) . '">';
159
  $output .= '<div class="wpgdprc-consent-bar__container">';
160
+ $output .= '<div class="wpgdprc-consent-bar__content" ' . (!empty($consentBarTextColor) ? 'style="' . implode('', $consentBarTextStyling) . '"' : '') . '>';
161
  $output .= '<div class="wpgdprc-consent-bar__column">';
162
  $output .= '<div class="wpgdprc-consent-bar__notice">';
163
  $output .= apply_filters('wpgdprc_the_content', Consent::getBarExplanationText());
164
  $output .= '</div>';
165
  $output .= '</div>';
166
  $output .= '<div class="wpgdprc-consent-bar__column">';
167
+ $output .= sprintf(
168
+ '<a class="wpgdprc-consent-bar__settings" href="javascript:void(0);" data-micromodal-trigger="wpgdprc-consent-modal">%s</a>',
169
+ $text
170
+ );
171
  $output .= '</div>';
172
  $output .= '<div class="wpgdprc-consent-bar__column">';
173
+ $buttonStyling = array();
174
+ if (!empty($consentBarButtonColor)) {
175
+ $buttonStyling[] = 'background: ' . $consentBarButtonColor . ';';
176
+ }
177
+ if (!empty($consentBarButtonTextColor)) {
178
+ $buttonStyling[] = 'color: ' . $consentBarButtonTextColor . ';';
179
+ }
180
+ $output .= sprintf(
181
+ '<button class="wpgdprc-button wpgdprc-consent-bar__button" ' . (!empty($buttonStyling) ? 'style="' . implode('', $buttonStyling) . '"' : '') .'>%s</button>',
182
+ __('Accept', WP_GDPR_C_SLUG)
183
+ );
184
  $output .= '</div>';
185
  $output .= '</div>';
186
  $output .= '</div>';
188
  echo apply_filters('wpgdprc_consent_bar', $output);
189
  }
190
 
191
+ /**
192
+ * Checks if all the consents are required.
193
+ * @return bool
194
+ */
195
+ public function checkAllConsentsRequired() {
196
+ $totalRequiredConsents = Consent::getInstance()->getList(array(
197
+ 'active' => array('value' => 1),
198
+ 'required' => array('value' => 1)
199
+ ));
200
+ $totalActiveConsents = Consent::getInstance()->getList(array(
201
+ 'active' => array('value' => 1),
202
+ ));
203
+ return sizeof($totalRequiredConsents) === sizeof($totalActiveConsents);
204
+ }
205
+
206
  public function addConsentModal() {
207
+ $consentRequiredStatus = $this->checkAllConsentsRequired();
208
+ $consentModalButtonColor = get_option(WP_GDPR_C_PREFIX . '_settings_consents_bar_button_color_secondary');
209
+ $consentModalButtonTextColor = get_option(WP_GDPR_C_PREFIX . '_settings_consents_bar_button_color_primary');
210
  $consentIds = (array)Helper::getConsentIdsByCookie();
211
  $consents = Consent::getInstance()->getList(array(
212
  'active' => array('value' => 1)
213
  ));
214
+ $text = ($consentRequiredStatus) ? __('Accept', WP_GDPR_C_SLUG) : __('Save my settings', WP_GDPR_C_SLUG);
215
  $output = '<div class="wpgdprc wpgdprc-consent-modal" id="wpgdprc-consent-modal" aria-hidden="true">';
216
  $output .= '<div class="wpgdprc-consent-modal__overlay" tabindex="-1" data-micromodal-close>';
217
  $output .= '<div class="wpgdprc-consent-modal__container" role="dialog" aria-modal="true">';
273
  $output .= '</div>'; // .wpgdprc-consent-modal__description
274
  }
275
  $output .= '<footer class="wpgdprc-consent-modal__footer">';
276
+ $buttonStyling = array();
277
+ if (!empty($consentModalButtonColor)) {
278
+ $buttonStyling[] = 'background: ' . $consentModalButtonColor . ';';
279
+ }
280
+ if (!empty($consentModalButtonTextColor)) {
281
+ $buttonStyling[] = 'color: ' . $consentModalButtonTextColor . ';';
282
+ }
283
+ $output .= sprintf(
284
+ '<a class="wpgdprc-button wpgdprc-button--secondary" href="javascript:void(0);" %s>%s</a>',
285
+ (!empty($buttonStyling) ? 'style="' . implode('', $buttonStyling) . '"' : ''),
286
+ $text
287
+ );
288
  $output .= '</footer>'; // .wpgdprc-consent-modal__footer
289
  $output .= '</div>'; // .wpgdprc-consent-modal__information
290
  }
Includes/Ajax.php CHANGED
@@ -426,37 +426,6 @@ class Ajax {
426
  die();
427
  }
428
 
429
- public function loadConsents() {
430
- check_ajax_referer('wpgdprc', 'security');
431
-
432
- $output = array();
433
- $consentIds = Helper::getConsentIdsByCookie();
434
-
435
- if (!empty($consentIds)) {
436
- foreach (Consent::getPossiblePlacements() as $placement => $label) {
437
- $consents = Consent::getInstance()->getList(array(
438
- 'placement' => array(
439
- 'value' => $placement
440
- ),
441
- 'active' => array(
442
- 'value' => 1
443
- ),
444
- 'ID' => array(
445
- 'value' => $consentIds,
446
- 'compare' => 'IN'
447
- )
448
- ));
449
- if (!empty($consents)) {
450
- $output[$placement] = Consent::output($consents);
451
- }
452
- }
453
- }
454
-
455
- header('Content-type: application/json');
456
- echo json_encode($output);
457
- die();
458
- }
459
-
460
  /**
461
  * @param $value
462
  * @return mixed
426
  die();
427
  }
428
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
  /**
430
  * @param $value
431
  * @return mixed
Includes/Consent.php CHANGED
@@ -85,27 +85,45 @@ class Consent {
85
  }
86
 
87
  /**
88
- * @param array $consents
89
- * @return string
90
  */
91
- public static function output($consents = array()) {
92
- $output = '';
 
 
 
 
 
93
  if (!empty($consents)) {
94
  /** @var Consent $consent */
95
  foreach ($consents as $consent) {
96
- if ($consent->getWrap()) {
97
- $output .= sprintf(
98
- '<script type="text/javascript">%s</script>',
99
- $consent->getSnippet()
100
- );
101
- } else {
102
- $output .= sprintf('%s', $consent->getSnippet());
103
- }
 
 
 
 
 
104
  }
105
  }
106
  return $output;
107
  }
108
 
 
 
 
 
 
 
 
 
 
109
  /**
110
  * @param array $filters
111
  * @return int
85
  }
86
 
87
  /**
88
+ * @return array
 
89
  */
90
+ public function getListByPlacements() {
91
+ $output = array();
92
+ $consents = self::getInstance()->getList(array(
93
+ 'active' => array(
94
+ 'value' => 1
95
+ ),
96
+ ));
97
  if (!empty($consents)) {
98
  /** @var Consent $consent */
99
  foreach ($consents as $consent) {
100
+ $content = ($consent->getWrap()) ? sprintf(
101
+ '<script type="text/javascript">%s</script>',
102
+ $consent->getSnippet()
103
+ ) : sprintf(
104
+ '%s',
105
+ $consent->getSnippet()
106
+ );
107
+ $output[] = array(
108
+ 'id' => $consent->getId(),
109
+ 'required' => ($consent->getRequired() == 1),
110
+ 'placement' => $consent->getPlacement(),
111
+ 'content' => $content,
112
+ );
113
  }
114
  }
115
  return $output;
116
  }
117
 
118
+ /**
119
+ * @param array $consents
120
+ * @return array
121
+ */
122
+ public static function output($consents = array()) {
123
+ $output = array();
124
+ return $output;
125
+ }
126
+
127
  /**
128
  * @param array $filters
129
  * @return int
Includes/Extensions/WPRegistration.php CHANGED
@@ -14,14 +14,26 @@ class WPRegistration {
14
  /** @var null */
15
  private static $instance = null;
16
 
17
- public function addField() {
18
  ?>
19
  <p>
20
  <label><input type="checkbox" name="wpgdprc_consent" value="1" /> <?php echo Integration::getCheckboxText(self::ID); ?><abbr class="wpgdprc-required" title=" <?php echo Integration::getRequiredMessage(self::ID); ?> ">*</abbr></label>
21
  </p><br>
22
  <?php
 
 
 
 
23
  }
24
 
 
 
 
 
 
 
 
 
25
  /**
26
  * @param $errors
27
  * @param $sanitized_user_login
@@ -30,26 +42,52 @@ class WPRegistration {
30
  * @return mixed
31
  */
32
  public function validateGDPRCheckbox($errors, $sanitized_user_login, $user_email) {
33
- if (!isset($_POST['wpgdprc_consent'])) {
34
- $errors->add('gdpr_consent_error', '<strong>ERROR</strong>: ' . Integration::getErrorMessage(self::ID));
35
- }
36
  return $errors;
37
  }
38
 
39
- public function logGivenGDPRConsent() {
40
- if (isset($_POST['user_email'])) {
41
- global $wpdb;
42
- $wpdb->insert($wpdb->base_prefix . 'wpgdprc_log', array(
43
- 'plugin_id' => self::ID,
44
- 'user' => Helper::anonymizeEmail($_POST['user_email']),
45
- 'ip_address' => Helper::anonymizeIP(Helper::getClientIpAddress()),
46
- 'date_created' => Helper::localDateTime(time())->format('Y-m-d H:i:s'),
47
- 'log' => 'user has given consent when registering',
48
- 'consent_text' => Integration::getCheckboxText(self::ID)
49
- ));
50
- }
 
 
51
  }
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  /**
54
  * @return null|WPRegistration
55
  */
14
  /** @var null */
15
  private static $instance = null;
16
 
17
+ public function addFieldMultiSite( $errors ) {
18
  ?>
19
  <p>
20
  <label><input type="checkbox" name="wpgdprc_consent" value="1" /> <?php echo Integration::getCheckboxText(self::ID); ?><abbr class="wpgdprc-required" title=" <?php echo Integration::getRequiredMessage(self::ID); ?> ">*</abbr></label>
21
  </p><br>
22
  <?php
23
+
24
+ if ($errorMessage = $errors->get_error_message( 'wpgdprc_consent' )) : ?>
25
+ <p class="error"><?php echo $errorMessage; ?></p>
26
+ <?php endif;
27
  }
28
 
29
+ public function addField() {
30
+ ?>
31
+ <p>
32
+ <label><input type="checkbox" name="wpgdprc_consent" value="1" /> <?php echo Integration::getCheckboxText(self::ID); ?><abbr class="wpgdprc-required" title=" <?php echo Integration::getRequiredMessage(self::ID); ?> ">*</abbr></label>
33
+ </p><br>
34
+ <?php
35
+ }
36
+
37
  /**
38
  * @param $errors
39
  * @param $sanitized_user_login
42
  * @return mixed
43
  */
44
  public function validateGDPRCheckbox($errors, $sanitized_user_login, $user_email) {
45
+ if (!isset($_POST['wpgdprc_consent'])) {
46
+ $errors->add('gdpr_consent_error', '<strong>ERROR</strong>: ' . Integration::getErrorMessage(self::ID));
47
+ }
48
  return $errors;
49
  }
50
 
51
+ /**
52
+ * @param $result
53
+ *
54
+ * @return mixed
55
+ */
56
+ public function validateGDPRCheckboxMultisite( $result ) {
57
+ $wpgdprConsent = '';
58
+ if( !empty( $_POST['wpgdprc_consent'] ) ) {
59
+ $wpgdprConsent = sanitize_text_field( $_POST['wpgdprc_consent'] );
60
+ } elseif (empty($_POST['wpgdprc_consent'])) {
61
+ $result['errors']->add( 'wpgdprc_consent', Integration::getErrorMessage(self::ID), WP_GDPR_C_SLUG );
62
+ }
63
+ $result['wpgdprc_consent'] = $wpgdprConsent;
64
+ return $result;
65
  }
66
 
67
+ /**
68
+ * @param $user
69
+ */
70
+ public function logGivenGDPRConsent($user) {
71
+ global $wpdb;
72
+ if (is_multisite()) {
73
+ $user = get_userdata($user);
74
+ $userEmail = $user->user_email;
75
+ $siteId = get_current_blog_id();
76
+ } else {
77
+ $userEmail = $_POST['user_email'];
78
+ $siteId = null;
79
+ }
80
+ $wpdb->insert($wpdb->base_prefix . 'wpgdprc_log', array(
81
+ 'site_id' => $siteId,
82
+ 'plugin_id' => self::ID,
83
+ 'user' => Helper::anonymizeEmail($userEmail),
84
+ 'ip_address' => Helper::anonymizeIP(Helper::getClientIpAddress()),
85
+ 'date_created' => Helper::localDateTime(time())->format('Y-m-d H:i:s'),
86
+ 'log' => __('user has given consent when registering', WP_GDPR_C_SLUG),
87
+ 'consent_text' => Integration::getCheckboxText(self::ID)
88
+ ));
89
+ }
90
+
91
  /**
92
  * @return null|WPRegistration
93
  */
Includes/Integration.php CHANGED
@@ -45,9 +45,16 @@ class Integration {
45
  case WPRegistration::ID :
46
  $users_can_register = get_option('users_can_register');
47
  if ($users_can_register) {
48
- add_action('register_form', array(WPRegistration::getInstance(), 'addField'), 999);
49
- add_filter('registration_errors', array(WPRegistration::getInstance(), 'validateGDPRCheckbox'), 10, 3);
50
- add_action('user_register', array(WPRegistration::getInstance(), 'logGivenGDPRConsent'), 10, 1);
 
 
 
 
 
 
 
51
  }
52
  break;
53
  case WC::ID :
45
  case WPRegistration::ID :
46
  $users_can_register = get_option('users_can_register');
47
  if ($users_can_register) {
48
+ $addFieldAction = (is_multisite() ? 'signup_extra_fields' : 'register_form');
49
+ $addFieldFunction = (is_multisite() ? 'addFieldMultiSite' : 'addField');
50
+ $validationAction = (is_multisite() ? 'wpmu_validate_user_signup' : 'registration_errors');
51
+ $registerUserAction = (is_multisite() ? 'wpmu_new_user' : 'user_register');
52
+ $validateFunction = (is_multisite() ? 'validateGDPRCheckboxMultisite' : 'validateGDPRCheckbox' );
53
+ $logFunction = 'logGivenGDPRConsent';
54
+ $validationArguments = (is_multisite() ? 1 : 3);
55
+ add_action($addFieldAction, array(WPRegistration::getInstance(), $addFieldFunction), 10, 1);
56
+ add_filter( $validationAction, array(WPRegistration::getInstance(), $validateFunction), 10, $validationArguments );
57
+ add_action($registerUserAction, array(WPRegistration::getInstance(), $logFunction), 10, 1);
58
  }
59
  break;
60
  case WC::ID :
assets/js/front.js CHANGED
@@ -1,19 +1,46 @@
1
  (function (window, document, undefined) {
2
  'use strict';
3
 
 
 
 
 
4
  /**
5
- * @param data
6
- * @returns {string}
7
  * @private
8
  */
9
- var ajaxLoading = false,
10
- ajaxURL = wpgdprcData.ajaxURL,
11
- ajaxSecurity = wpgdprcData.ajaxSecurity,
12
- consentVersion = wpgdprcData.consentVersion,
13
- path = wpgdprcData.path,
14
- isMultisite = wpgdprcData.isMultisite,
15
- blogId = wpgdprcData.blogId,
16
- consentStatus = wpgdprcData.consentStatus,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  _objectToParametersString = function (data) {
18
  return Object.keys(data).map(function (key) {
19
  var value = data[key];
@@ -40,6 +67,15 @@
40
  }
41
  return output;
42
  },
 
 
 
 
 
 
 
 
 
43
  /**
44
  * @param data
45
  * @param values
@@ -83,38 +119,10 @@
83
  }, (delay || 0));
84
  }
85
  },
86
- /**
87
- * @param data
88
- * @param days
89
- * @private
90
- */
91
- _saveCookie = function (data, days) {
92
- var date = new Date(),
93
- cookieName = (isMultisite) ? blogId + '-wpgdprc-consent-' : 'wpgdprc-consent-';
94
- data = (data) ? data : '';
95
- days = (days) ? days : 365;
96
- date.setTime(date.getTime() + 24 * days * 60 * 60 * 1e3);
97
- document.cookie = cookieName + consentVersion + '=' + encodeURIComponent(data) + '; expires=' + date.toGMTString() + '; path=' + path;
98
- },
99
- /**
100
- * @param name
101
- * @returns {*}
102
- * @private
103
- */
104
- _readCookie = function (name) {
105
- if (name) {
106
- for (var e = encodeURIComponent(name) + "=", o = document.cookie.split(";"), r = 0; r < o.length; r++) {
107
- for (var n = o[r]; " " === n.charAt(0);) {
108
- n = n.substring(1, n.length);
109
- }
110
- if (n.indexOf(e) === 0) {
111
- return decodeURIComponent(n.substring(e.length, n.length));
112
- }
113
- }
114
- }
115
- return null;
116
- },
117
  initConsentBar = function () {
 
 
 
118
  var $consentBar = document.querySelector('.wpgdprc-consent-bar');
119
  if ($consentBar === null) {
120
  return;
@@ -126,7 +134,7 @@
126
  if ($button !== null) {
127
  $button.addEventListener('click', function (e) {
128
  e.preventDefault();
129
- _saveCookie('accept');
130
  window.location.reload(true);
131
  });
132
  }
@@ -211,9 +219,9 @@
211
  }
212
  }
213
  if (checked.length > 0) {
214
- _saveCookie(checked);
215
  } else {
216
- _saveCookie('decline');
217
  }
218
  }
219
 
@@ -226,33 +234,52 @@
226
  return;
227
  }
228
 
229
- var data = {
230
- action: 'wpgdprc_load_consents',
231
- security: ajaxSecurity
232
- },
233
- request = new XMLHttpRequest();
234
-
235
- data = _objectToParametersString(data);
236
- request.open('POST', ajaxURL, true);
237
- request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=UTF-8');
238
- request.send(data);
239
- request.addEventListener('load', function () {
240
- if (request.response) {
241
- var response = JSON.parse(request.response);
242
- if (response.head) {
243
- postscribe(document.head, response.head);
 
 
 
 
 
 
 
 
244
  }
245
- if (response.body) {
246
- var bodyElement = document.createElement('div');
247
- bodyElement.id = 'wpgdprc-consent-body';
248
- document.body.prepend(bodyElement);
249
- postscribe('#' + bodyElement.id, response.body);
 
 
 
 
250
  }
251
- if (response.footer) {
252
- postscribe(document.body, response.footer);
 
 
 
 
 
 
 
253
  }
254
  }
255
- });
256
  },
257
  initFormAccessRequest = function () {
258
  var $formAccessRequest = document.querySelector('.wpgdprc-form--access-request');
@@ -349,11 +376,10 @@
349
  };
350
 
351
  document.addEventListener('DOMContentLoaded', function () {
352
- if (consentStatus) {
353
- var cookieName = (isMultisite) ? blogId + '-wpgdprc-consent-' : 'wpgdprc-consent-';
354
- if (_readCookie(cookieName + consentVersion) === null) {
355
- initConsentBar();
356
- }
357
  initConsentModal();
358
  initLoadConsents();
359
  }
1
  (function (window, document, undefined) {
2
  'use strict';
3
 
4
+ if (typeof wpgdprcData === 'undefined') {
5
+ return;
6
+ }
7
+
8
  /**
9
+ * @param name
10
+ * @returns {*}
11
  * @private
12
  */
13
+ var _readCookie = function (name) {
14
+ if (name) {
15
+ for (var e = encodeURIComponent(name) + '=', o = document.cookie.split(';'), r = 0; r < o.length; r++) {
16
+ for (var n = o[r]; ' ' === n.charAt(0);) {
17
+ n = n.substring(1, n.length);
18
+ }
19
+ if (n.indexOf(e) === 0) {
20
+ return decodeURIComponent(n.substring(e.length, n.length));
21
+ }
22
+ }
23
+ }
24
+ return null;
25
+ },
26
+ /**
27
+ * @param name
28
+ * @param data
29
+ * @param days
30
+ * @private
31
+ */
32
+ _saveCookie = function (name, data, days) {
33
+ var date = new Date();
34
+ data = (data) ? data : '';
35
+ days = (days) ? days : 365;
36
+ date.setTime(date.getTime() + 24 * days * 60 * 60 * 1e3);
37
+ document.cookie = name + '=' + encodeURIComponent(data) + '; expires=' + date.toGMTString() + '; path=' + path;
38
+ },
39
+ /**
40
+ * @param data
41
+ * @returns {string}
42
+ * @private
43
+ */
44
  _objectToParametersString = function (data) {
45
  return Object.keys(data).map(function (key) {
46
  var value = data[key];
67
  }
68
  return output;
69
  },
70
+ ajaxLoading = false,
71
+ ajaxURL = wpgdprcData.ajaxURL,
72
+ ajaxSecurity = wpgdprcData.ajaxSecurity,
73
+ isMultisite = wpgdprcData.isMultisite,
74
+ blogId = wpgdprcData.blogId,
75
+ path = wpgdprcData.path,
76
+ consents = (typeof wpgdprcData.consents !== 'undefined') ? wpgdprcData.consents : [],
77
+ consentCookieName,
78
+ consentCookie,
79
  /**
80
  * @param data
81
  * @param values
119
  }, (delay || 0));
120
  }
121
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  initConsentBar = function () {
123
+ if (consentCookie !== null) {
124
+ return;
125
+ }
126
  var $consentBar = document.querySelector('.wpgdprc-consent-bar');
127
  if ($consentBar === null) {
128
  return;
134
  if ($button !== null) {
135
  $button.addEventListener('click', function (e) {
136
  e.preventDefault();
137
+ _saveCookie(consentCookieName, 'accept');
138
  window.location.reload(true);
139
  });
140
  }
219
  }
220
  }
221
  if (checked.length > 0) {
222
+ _saveCookie(consentCookieName, checked);
223
  } else {
224
+ _saveCookie(consentCookieName, 'decline');
225
  }
226
  }
227
 
234
  return;
235
  }
236
 
237
+ /**
238
+ * @param placement
239
+ * @returns {HTMLHeadElement | Element | string | HTMLElement}
240
+ * @private
241
+ */
242
+ var _getTargetByPlacement = function (placement) {
243
+ var output;
244
+ switch (placement) {
245
+ case 'head' :
246
+ output = document.head;
247
+ break;
248
+ case 'body' :
249
+ output = document.querySelector('#wpgdprc-consent-body');
250
+ if (output === null) {
251
+ var bodyElement = document.createElement('div');
252
+ bodyElement.id = 'wpgdprc-consent-body';
253
+ document.body.prepend(bodyElement);
254
+ output = '#' + bodyElement.id;
255
+ }
256
+ break;
257
+ case 'footer' :
258
+ output = document.body;
259
+ break;
260
  }
261
+ return output;
262
+ },
263
+ /**
264
+ * @param consent
265
+ */
266
+ loadConsent = function (consent) {
267
+ var target = _getTargetByPlacement(consent.placement);
268
+ if (target !== null) {
269
+ postscribe(target, consent.content);
270
  }
271
+ };
272
+
273
+ // Load consents by cookie
274
+ var ids = (consentCookie !== null && consentCookie !== 'accept') ? consentCookie.split(',') : [];
275
+ for (var i = 0; i < consents.length; i++) {
276
+ if (consents.hasOwnProperty(i)) {
277
+ var consent = consents[i];
278
+ if (ids.indexOf(consent.id) >= 0 || consent.required || consentCookie === 'accept') {
279
+ loadConsent(consent);
280
  }
281
  }
282
+ }
283
  },
284
  initFormAccessRequest = function () {
285
  var $formAccessRequest = document.querySelector('.wpgdprc-form--access-request');
376
  };
377
 
378
  document.addEventListener('DOMContentLoaded', function () {
379
+ if (typeof consents === 'object' && consents.length > 0) {
380
+ consentCookieName = ((isMultisite) ? blogId + '-wpgdprc-consent-' : 'wpgdprc-consent-') + wpgdprcData.consentVersion;
381
+ consentCookie = _readCookie(consentCookieName);
382
+ initConsentBar();
 
383
  initConsentModal();
384
  initLoadConsents();
385
  }
languages/wp-gdpr-compliance.pot CHANGED
@@ -2,14 +2,14 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: WP GDPR Compliance\n"
5
- "POT-Creation-Date: 2019-03-12 11:59+0100\n"
6
  "Last-Translator: \n"
7
  "Language-Team: Van Ons <info@van-ons.nl>\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
  "PO-Revision-Date: \n"
12
- "X-Generator: Poedit 2.0.6\n"
13
  "X-Poedit-SourceCharset: UTF-8\n"
14
  "X-Poedit-KeywordsList: __;_e;_ngettext:1,2;_n;_ngettext_noop:1,2;_n_noop:1,2;"
15
  "_c;_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;esc_attr__;"
@@ -29,40 +29,44 @@ msgstr ""
29
  msgid "Retry"
30
  msgstr ""
31
 
32
- #: Includes/Action.php:156 Includes/Page.php:492 Includes/Shortcode.php:169
 
 
 
 
33
  msgid "My settings"
34
  msgstr ""
35
 
36
- #: Includes/Action.php:162
37
  msgid "Accept"
38
  msgstr ""
39
 
40
- #: Includes/Action.php:193 Includes/Page.php:755
 
 
 
 
41
  msgid "(no title)"
42
  msgstr ""
43
 
44
- #: Includes/Action.php:206 Includes/Helper.php:116 Includes/Helper.php:174
45
  #: Includes/Page.php:260 Includes/Page.php:355 Includes/Page.php:370
46
  #: Includes/Page.php:431 Includes/Page.php:487 Includes/Page.php:841
47
  #: Includes/Page.php:947 Includes/Shortcode.php:164
48
  msgid "Note"
49
  msgstr ""
50
 
51
- #: Includes/Action.php:207
52
  msgid ""
53
  "These settings will only apply to the browser and device you are currently "
54
  "using."
55
  msgstr ""
56
 
57
- #: Includes/Action.php:232
58
  msgid "Enable"
59
  msgstr ""
60
 
61
- #: Includes/Action.php:241
62
- msgid "Save my settings"
63
- msgstr ""
64
-
65
- #: Includes/Action.php:248
66
  msgid "Close modal"
67
  msgstr ""
68
 
@@ -256,23 +260,23 @@ msgid ""
256
  "experience."
257
  msgstr ""
258
 
259
- #: Includes/Consent.php:278
260
  msgid "Wrap my code snippet with <script> tags"
261
  msgstr ""
262
 
263
- #: Includes/Consent.php:279
264
  msgid "Do not wrap my code snippet"
265
  msgstr ""
266
 
267
- #: Includes/Consent.php:288 Includes/Page.php:669
268
  msgid "Head"
269
  msgstr ""
270
 
271
- #: Includes/Consent.php:289 Includes/Page.php:674
272
  msgid "Body"
273
  msgstr ""
274
 
275
- #: Includes/Consent.php:290 Includes/Page.php:679
276
  msgid "Footer"
277
  msgstr ""
278
 
@@ -401,6 +405,10 @@ msgstr ""
401
  msgid "GDPR Accepted On"
402
  msgstr ""
403
 
 
 
 
 
404
  #: Includes/Helper.php:110
405
  #, php-format
406
  msgid "You can use: %s"
@@ -500,56 +508,56 @@ msgid ""
500
  "mention if you will send or share the data with any 3rd-parties and which."
501
  msgstr ""
502
 
503
- #: Includes/Integration.php:130 Includes/Integration.php:174
504
  #, php-format
505
  msgid "Form: %s"
506
  msgstr ""
507
 
508
- #: Includes/Integration.php:131 Includes/Integration.php:175
509
  msgid "Activate for this form:"
510
  msgstr ""
511
 
512
- #: Includes/Integration.php:134 Includes/Integration.php:178
513
- #: Includes/Integration.php:213 Includes/Page.php:462
514
  msgid "Checkbox text"
515
  msgstr ""
516
 
517
- #: Includes/Integration.php:140 Includes/Integration.php:184
518
- #: Includes/Integration.php:219
519
  msgid "Error message"
520
  msgstr ""
521
 
522
- #: Includes/Integration.php:150 Includes/Integration.php:200
523
  msgid "No forms found."
524
  msgstr ""
525
 
526
- #: Includes/Integration.php:190 Includes/Integration.php:225
527
  msgid "Required message"
528
  msgstr ""
529
 
530
- #: Includes/Integration.php:251 Includes/Integration.php:315
531
  msgid ""
532
  "By using this form you agree with the storage and handling of your data by "
533
  "this website."
534
  msgstr ""
535
 
536
- #: Includes/Integration.php:268
537
  msgid "Please accept the privacy checkbox."
538
  msgstr ""
539
 
540
- #: Includes/Integration.php:284
541
  msgid "You need to accept this checkbox."
542
  msgstr ""
543
 
544
- #: Includes/Integration.php:295 Includes/Page.php:342 Includes/Page.php:394
545
  msgid "Privacy Policy"
546
  msgstr ""
547
 
548
- #: Includes/Integration.php:303
549
  msgid "http://www.example.com"
550
  msgstr ""
551
 
552
- #: Includes/Integration.php:329
553
  #, php-format
554
  msgid ""
555
  "Below we show you all of the data stored by %s on %s. Select the data you "
@@ -558,43 +566,43 @@ msgid ""
558
  "request. When your data is anonymised you will receive an email confirmation."
559
  msgstr ""
560
 
561
- #: Includes/Integration.php:372 Includes/Page.php:834
562
  msgid "WordPress Comments"
563
  msgstr ""
564
 
565
- #: Includes/Integration.php:373
566
  msgid ""
567
  "When activated the GDPR checkbox will be added automatically just above the "
568
  "submit button."
569
  msgstr ""
570
 
571
- #: Includes/Integration.php:377
572
  msgid "Wordpress Registration"
573
  msgstr ""
574
 
575
- #: Includes/Integration.php:378
576
  msgid ""
577
  "When activated the GDPR checkbox will be added automatically just above the "
578
  "register button."
579
  msgstr ""
580
 
581
- #: Includes/Integration.php:392
582
  msgid "Contact Form 7"
583
  msgstr ""
584
 
585
- #: Includes/Integration.php:393 Includes/Integration.php:400
586
  msgid "A GDPR form tag will be automatically added to every form you activate."
587
  msgstr ""
588
 
589
- #: Includes/Integration.php:399
590
  msgid "Gravity Forms"
591
  msgstr ""
592
 
593
- #: Includes/Integration.php:406 Includes/Page.php:836
594
  msgid "WooCommerce"
595
  msgstr ""
596
 
597
- #: Includes/Integration.php:407
598
  msgid ""
599
  "The GDPR checkbox will be added automatically at the end of your checkout "
600
  "page."
@@ -612,7 +620,7 @@ msgstr ""
612
  msgid "Checklist"
613
  msgstr ""
614
 
615
- #: Includes/Page.php:98 wp-gdpr-compliance.php:355
616
  msgid "Settings"
617
  msgstr ""
618
 
@@ -818,7 +826,7 @@ msgid "Active"
818
  msgstr ""
819
 
820
  #: Includes/Page.php:597 Includes/Page.php:690 Includes/Page.php:759
821
- #: Includes/Page.php:779 wp-gdpr-compliance.php:365 wp-gdpr-compliance.php:402
822
  msgid "Yes"
823
  msgstr ""
824
 
@@ -925,8 +933,8 @@ msgstr ""
925
  msgid "Action"
926
  msgstr ""
927
 
928
- #: Includes/Page.php:759 Includes/Page.php:779 wp-gdpr-compliance.php:366
929
- #: wp-gdpr-compliance.php:403
930
  msgid "No"
931
  msgstr ""
932
 
@@ -1070,6 +1078,6 @@ msgstr ""
1070
  msgid "You need to make sure you have added atleast one (1) active consent."
1071
  msgstr ""
1072
 
1073
- #: wp-gdpr-compliance.php:355
1074
  msgid "View WP GDPR Compliance settings"
1075
  msgstr ""
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: WP GDPR Compliance\n"
5
+ "POT-Creation-Date: 2019-05-17 16:07+0200\n"
6
  "Last-Translator: \n"
7
  "Language-Team: Van Ons <info@van-ons.nl>\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
  "PO-Revision-Date: \n"
12
+ "X-Generator: Poedit 2.2.1\n"
13
  "X-Poedit-SourceCharset: UTF-8\n"
14
  "X-Poedit-KeywordsList: __;_e;_ngettext:1,2;_n;_ngettext_noop:1,2;_n_noop:1,2;"
15
  "_c;_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;esc_attr__;"
29
  msgid "Retry"
30
  msgstr ""
31
 
32
+ #: Includes/Action.php:157
33
+ msgid "More information"
34
+ msgstr ""
35
+
36
+ #: Includes/Action.php:157 Includes/Page.php:492 Includes/Shortcode.php:169
37
  msgid "My settings"
38
  msgstr ""
39
 
40
+ #: Includes/Action.php:182 Includes/Action.php:214
41
  msgid "Accept"
42
  msgstr ""
43
 
44
+ #: Includes/Action.php:214
45
+ msgid "Save my settings"
46
+ msgstr ""
47
+
48
+ #: Includes/Action.php:230 Includes/Page.php:755
49
  msgid "(no title)"
50
  msgstr ""
51
 
52
+ #: Includes/Action.php:243 Includes/Helper.php:116 Includes/Helper.php:174
53
  #: Includes/Page.php:260 Includes/Page.php:355 Includes/Page.php:370
54
  #: Includes/Page.php:431 Includes/Page.php:487 Includes/Page.php:841
55
  #: Includes/Page.php:947 Includes/Shortcode.php:164
56
  msgid "Note"
57
  msgstr ""
58
 
59
+ #: Includes/Action.php:244
60
  msgid ""
61
  "These settings will only apply to the browser and device you are currently "
62
  "using."
63
  msgstr ""
64
 
65
+ #: Includes/Action.php:269
66
  msgid "Enable"
67
  msgstr ""
68
 
69
+ #: Includes/Action.php:293
 
 
 
 
70
  msgid "Close modal"
71
  msgstr ""
72
 
260
  "experience."
261
  msgstr ""
262
 
263
+ #: Includes/Consent.php:296
264
  msgid "Wrap my code snippet with <script> tags"
265
  msgstr ""
266
 
267
+ #: Includes/Consent.php:297
268
  msgid "Do not wrap my code snippet"
269
  msgstr ""
270
 
271
+ #: Includes/Consent.php:306 Includes/Page.php:669
272
  msgid "Head"
273
  msgstr ""
274
 
275
+ #: Includes/Consent.php:307 Includes/Page.php:674
276
  msgid "Body"
277
  msgstr ""
278
 
279
+ #: Includes/Consent.php:308 Includes/Page.php:679
280
  msgid "Footer"
281
  msgstr ""
282
 
405
  msgid "GDPR Accepted On"
406
  msgstr ""
407
 
408
+ #: Includes/Extensions/WPRegistration.php:86
409
+ msgid "user has given consent when registering"
410
+ msgstr ""
411
+
412
  #: Includes/Helper.php:110
413
  #, php-format
414
  msgid "You can use: %s"
508
  "mention if you will send or share the data with any 3rd-parties and which."
509
  msgstr ""
510
 
511
+ #: Includes/Integration.php:137 Includes/Integration.php:181
512
  #, php-format
513
  msgid "Form: %s"
514
  msgstr ""
515
 
516
+ #: Includes/Integration.php:138 Includes/Integration.php:182
517
  msgid "Activate for this form:"
518
  msgstr ""
519
 
520
+ #: Includes/Integration.php:141 Includes/Integration.php:185
521
+ #: Includes/Integration.php:220 Includes/Page.php:462
522
  msgid "Checkbox text"
523
  msgstr ""
524
 
525
+ #: Includes/Integration.php:147 Includes/Integration.php:191
526
+ #: Includes/Integration.php:226
527
  msgid "Error message"
528
  msgstr ""
529
 
530
+ #: Includes/Integration.php:157 Includes/Integration.php:207
531
  msgid "No forms found."
532
  msgstr ""
533
 
534
+ #: Includes/Integration.php:197 Includes/Integration.php:232
535
  msgid "Required message"
536
  msgstr ""
537
 
538
+ #: Includes/Integration.php:258 Includes/Integration.php:322
539
  msgid ""
540
  "By using this form you agree with the storage and handling of your data by "
541
  "this website."
542
  msgstr ""
543
 
544
+ #: Includes/Integration.php:275
545
  msgid "Please accept the privacy checkbox."
546
  msgstr ""
547
 
548
+ #: Includes/Integration.php:291
549
  msgid "You need to accept this checkbox."
550
  msgstr ""
551
 
552
+ #: Includes/Integration.php:302 Includes/Page.php:342 Includes/Page.php:394
553
  msgid "Privacy Policy"
554
  msgstr ""
555
 
556
+ #: Includes/Integration.php:310
557
  msgid "http://www.example.com"
558
  msgstr ""
559
 
560
+ #: Includes/Integration.php:336
561
  #, php-format
562
  msgid ""
563
  "Below we show you all of the data stored by %s on %s. Select the data you "
566
  "request. When your data is anonymised you will receive an email confirmation."
567
  msgstr ""
568
 
569
+ #: Includes/Integration.php:379 Includes/Page.php:834
570
  msgid "WordPress Comments"
571
  msgstr ""
572
 
573
+ #: Includes/Integration.php:380
574
  msgid ""
575
  "When activated the GDPR checkbox will be added automatically just above the "
576
  "submit button."
577
  msgstr ""
578
 
579
+ #: Includes/Integration.php:384
580
  msgid "Wordpress Registration"
581
  msgstr ""
582
 
583
+ #: Includes/Integration.php:385
584
  msgid ""
585
  "When activated the GDPR checkbox will be added automatically just above the "
586
  "register button."
587
  msgstr ""
588
 
589
+ #: Includes/Integration.php:399
590
  msgid "Contact Form 7"
591
  msgstr ""
592
 
593
+ #: Includes/Integration.php:400 Includes/Integration.php:407
594
  msgid "A GDPR form tag will be automatically added to every form you activate."
595
  msgstr ""
596
 
597
+ #: Includes/Integration.php:406
598
  msgid "Gravity Forms"
599
  msgstr ""
600
 
601
+ #: Includes/Integration.php:413 Includes/Page.php:836
602
  msgid "WooCommerce"
603
  msgstr ""
604
 
605
+ #: Includes/Integration.php:414
606
  msgid ""
607
  "The GDPR checkbox will be added automatically at the end of your checkout "
608
  "page."
620
  msgid "Checklist"
621
  msgstr ""
622
 
623
+ #: Includes/Page.php:98 wp-gdpr-compliance.php:368
624
  msgid "Settings"
625
  msgstr ""
626
 
826
  msgstr ""
827
 
828
  #: Includes/Page.php:597 Includes/Page.php:690 Includes/Page.php:759
829
+ #: Includes/Page.php:779 wp-gdpr-compliance.php:378 wp-gdpr-compliance.php:414
830
  msgid "Yes"
831
  msgstr ""
832
 
933
  msgid "Action"
934
  msgstr ""
935
 
936
+ #: Includes/Page.php:759 Includes/Page.php:779 wp-gdpr-compliance.php:379
937
+ #: wp-gdpr-compliance.php:415
938
  msgid "No"
939
  msgstr ""
940
 
1078
  msgid "You need to make sure you have added atleast one (1) active consent."
1079
  msgstr ""
1080
 
1081
+ #: wp-gdpr-compliance.php:368
1082
  msgid "View WP GDPR Compliance settings"
1083
  msgstr ""
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: donnyoexman, jeffreyvisser, merijnmolenaar, michaelvt, van-ons
3
  Tags: gdpr, law, regulations, compliance, data, protection, privacy, data protection, eu, avg, comments, woocommerce, wc, contact form 7, cf7
4
  Requires at least: 4.5
5
- Tested up to: 5.1.1
6
  Requires PHP: 5.3
7
- Stable tag: 1.5.1
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -44,6 +44,15 @@ You'll find answers to many of your questions on [https://www.wpgdprc.com/faq/](
44
 
45
  == Changelog ==
46
 
 
 
 
 
 
 
 
 
 
47
  = 1.5.1 =
48
  *Release date: April 30th, 2019*
49
  * Bugfix: 'token' column not being added to access_request table for new users.
2
  Contributors: donnyoexman, jeffreyvisser, merijnmolenaar, michaelvt, van-ons
3
  Tags: gdpr, law, regulations, compliance, data, protection, privacy, data protection, eu, avg, comments, woocommerce, wc, contact form 7, cf7
4
  Requires at least: 4.5
5
+ Tested up to: 5.2
6
  Requires PHP: 5.3
7
+ Stable tag: 1.5.2
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
44
 
45
  == Changelog ==
46
 
47
+ = 1.5.2 =
48
+ *Release date: 21th May, 2019*
49
+ * Tested with WordPress 5.2.
50
+ * Load accepted consents with JavaScript to improve performance.
51
+ * Use different text when all consent is required.
52
+ * When standard Consent bar/button colors are used, no empty attributes will be added to the elements.
53
+ * Bugfix: WP Registration integration now also works on MultiSite, accepted consent on registering gets added to the 'wpgdprc_log' table.
54
+ * Bugfix: Error shown in the WooCommerce Order page is removed.
55
+
56
  = 1.5.1 =
57
  *Release date: April 30th, 2019*
58
  * Bugfix: 'token' column not being added to access_request table for new users.
wp-gdpr-compliance.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: WP GDPR Compliance
5
  Plugin URI: https://www.wpgdprc.com/
6
  Description: This plugin assists website and webshop owners to comply with European privacy regulations known as GDPR. By May 24th, 2018 your website or shop has to comply to avoid large fines.
7
- Version: 1.5.1
8
  Author: Van Ons
9
  Author URI: https://www.van-ons.nl/
10
  License: GPL2
@@ -158,6 +158,7 @@ class WPGDPRC {
158
 
159
  // WP_Query arguments
160
  $args = array(
 
161
  'post_status' => array('publish'),
162
  's' => '[wpgdprc_access_request_form]',
163
  );
@@ -271,7 +272,7 @@ class WPGDPRC {
271
 
272
  public static function handleDatabaseTables() {
273
  $dbVersion = get_option('wpgdprc_db_version', 0);
274
- if (version_compare($dbVersion, '1.7', '==')) {
275
  return;
276
  }
277
 
@@ -344,6 +345,18 @@ class WPGDPRC {
344
  update_option('wpgdprc_db_version', '1.7');
345
  }
346
  }
 
 
 
 
 
 
 
 
 
 
 
 
347
  }
348
 
349
  /**
@@ -366,22 +379,20 @@ class WPGDPRC {
366
  div.wpgdprc .wpgdprc-switch .wpgdprc-switch-inner:after { content: '" . __('No', WP_GDPR_C_SLUG) . "'; }
367
  ");
368
  $dependencies = array();
369
- if (Consent::isActive()) {
370
- $dependencies[] = 'wpgdprc.micromodal.js';
371
- $dependencies[] = 'wpgdprc.postscribe.js';
372
- }
373
- wp_enqueue_script('wpgdprc.js', WP_GDPR_C_URI_JS . '/front.js', $dependencies, filemtime(WP_GDPR_C_DIR_JS . '/front.js'), true);
374
- $consentVersion = get_option('wpgdprc_consent_version');
375
  $isMultisite = is_multisite();
376
  $data = array(
377
  'ajaxURL' => admin_url('admin-ajax.php'),
378
  'ajaxSecurity' => wp_create_nonce('wpgdprc'),
379
- 'consentVersion' => $consentVersion,
380
- 'consentStatus' => (Consent::isActive()) ? 1 : 0,
381
  'isMultisite' => $isMultisite,
382
  'path' => '/',
383
  'blogId' => '',
384
  );
 
 
 
 
 
 
385
  if ($isMultisite) {
386
  $blogDetails = get_blog_details();
387
  if ($blogDetails !== false) {
@@ -392,6 +403,7 @@ class WPGDPRC {
392
  if (!empty($_REQUEST['wpgdprc'])) {
393
  $data['token'] = esc_html(urldecode($_REQUEST['wpgdprc']));
394
  }
 
395
  wp_localize_script('wpgdprc.js', 'wpgdprcData', $data);
396
  }
397
 
4
  Plugin Name: WP GDPR Compliance
5
  Plugin URI: https://www.wpgdprc.com/
6
  Description: This plugin assists website and webshop owners to comply with European privacy regulations known as GDPR. By May 24th, 2018 your website or shop has to comply to avoid large fines.
7
+ Version: 1.5.2
8
  Author: Van Ons
9
  Author URI: https://www.van-ons.nl/
10
  License: GPL2
158
 
159
  // WP_Query arguments
160
  $args = array(
161
+ 'post_type' => 'any',
162
  'post_status' => array('publish'),
163
  's' => '[wpgdprc_access_request_form]',
164
  );
272
 
273
  public static function handleDatabaseTables() {
274
  $dbVersion = get_option('wpgdprc_db_version', 0);
275
+ if (version_compare($dbVersion, '1.8', '==')) {
276
  return;
277
  }
278
 
345
  update_option('wpgdprc_db_version', '1.7');
346
  }
347
  }
348
+
349
+ // Add column 'siteId' to 'Log' table
350
+ if (version_compare($dbVersion, '1.8', '<')) {
351
+ if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->base_prefix . "wpgdprc_log'") === $wpdb->base_prefix . 'wpgdprc_log') {
352
+ if (!$wpdb->get_var("SHOW COLUMNS FROM " . $wpdb->base_prefix . "wpgdprc_log" . " LIKE 'site_id'")) {
353
+ $query = "ALTER TABLE `" . $wpdb->base_prefix . "wpgdprc_log" . "`
354
+ ADD column `site_id` bigint(20) NULL AFTER `ID`;";
355
+ $wpdb->query($query);
356
+ }
357
+ update_option('wpgdprc_db_version', '1.8');
358
+ }
359
+ }
360
  }
361
 
362
  /**
379
  div.wpgdprc .wpgdprc-switch .wpgdprc-switch-inner:after { content: '" . __('No', WP_GDPR_C_SLUG) . "'; }
380
  ");
381
  $dependencies = array();
 
 
 
 
 
 
382
  $isMultisite = is_multisite();
383
  $data = array(
384
  'ajaxURL' => admin_url('admin-ajax.php'),
385
  'ajaxSecurity' => wp_create_nonce('wpgdprc'),
 
 
386
  'isMultisite' => $isMultisite,
387
  'path' => '/',
388
  'blogId' => '',
389
  );
390
+ if (Consent::isActive()) {
391
+ $dependencies[] = 'wpgdprc.micromodal.js';
392
+ $dependencies[] = 'wpgdprc.postscribe.js';
393
+ $data['consentVersion'] = get_option('wpgdprc_consent_version');
394
+ $data['consents'] = Consent::getInstance()->getListByPlacements();
395
+ }
396
  if ($isMultisite) {
397
  $blogDetails = get_blog_details();
398
  if ($blogDetails !== false) {
403
  if (!empty($_REQUEST['wpgdprc'])) {
404
  $data['token'] = esc_html(urldecode($_REQUEST['wpgdprc']));
405
  }
406
+ wp_enqueue_script('wpgdprc.js', WP_GDPR_C_URI_JS . '/front.js', $dependencies, filemtime(WP_GDPR_C_DIR_JS . '/front.js'), true);
407
  wp_localize_script('wpgdprc.js', 'wpgdprcData', $data);
408
  }
409