iubenda Cookie Solution for GDPR - Version 3.0.1

Version Description

  • Bugfix: Fix issue after updating to new plugin
Download this release

Release Info

Developer iubenda
Plugin Icon 128x128 iubenda Cookie Solution for GDPR
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0.0 to 3.0.1

Files changed (2) hide show
  1. iubenda_cookie_solution.php +61 -11
  2. readme.txt +11 -6
iubenda_cookie_solution.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Cookie and Consent Solution for the GDPR & ePrivacy
4
  Plugin URI: https://www.iubenda.com
5
  Description: An All-in-One approach developed by iubenda, which includes functionalities of two powerful solutions that help to make your website GDPR and ePrivacy compliant.
6
- Version: 3.0.0
7
  Author: iubenda
8
  Author URI: https://www.iubenda.com
9
  License: MIT License
@@ -34,7 +34,7 @@ define( 'IUB_DEBUG', false );
34
  * @property-read iubenda_Settings $settings
35
  *
36
  * @class iubenda
37
- * @version 3.0.0
38
  */
39
  class iubenda {
40
 
@@ -92,7 +92,7 @@ class iubenda {
92
  )
93
  );
94
  public $base_url;
95
- public $version = '3.0.0';
96
  public $activation = array(
97
  'update_version' => 0,
98
  'update_notice' => true,
@@ -330,10 +330,10 @@ class iubenda {
330
  public function activation() {
331
  set_transient( 'iub_activation_completed', 1, 3600 );
332
 
333
- add_option( 'iubenda_cookie_law_solution', $this->options['cs'], '', 'no' );
334
- add_option( 'iubenda_cookie_law_solution', $this->options['cons'], '', 'no' );
335
- add_option( 'iubenda_cookie_law_version', $this->version, '', 'no' );
336
- add_option( 'iubenda_activation_data', $this->activation, '', 'no' );
337
 
338
  // Send a radar request on plugin activation.
339
  $radar = new RadarService;
@@ -796,11 +796,13 @@ class iubenda {
796
  $radar->askRadarToSendRequest();
797
 
798
  // Migrating with old version
799
- $db_version = get_option( 'iubenda_cookie_law_version' );
800
- $db_version = ! $db_version ? '2.5.91' : $db_version;
801
 
802
- // Version 3.0.0
803
- if ( version_compare( $db_version, '3.0.0', '<' ) ) {
 
 
 
804
  $this->upgrading_to_ver_3_process();
805
  }
806
  }
@@ -813,6 +815,11 @@ class iubenda {
813
  * @return type
814
  */
815
  public function parse_configuration( $code, $args = array() ) {
 
 
 
 
 
816
  $configuration = array();
817
  $defaults = array(
818
  'mode' => 'basic',
@@ -1106,6 +1113,49 @@ class iubenda {
1106
  iubenda()->options['activated_products'] = array_get($result, 'iubenda_activated_products', []) ?: [];
1107
  $this->settings->load_defaults();
1108
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1109
  }
1110
 
1111
  if (!function_exists('array_get')) {
3
  Plugin Name: Cookie and Consent Solution for the GDPR & ePrivacy
4
  Plugin URI: https://www.iubenda.com
5
  Description: An All-in-One approach developed by iubenda, which includes functionalities of two powerful solutions that help to make your website GDPR and ePrivacy compliant.
6
+ Version: 3.0.1
7
  Author: iubenda
8
  Author URI: https://www.iubenda.com
9
  License: MIT License
34
  * @property-read iubenda_Settings $settings
35
  *
36
  * @class iubenda
37
+ * @version 3.0.1
38
  */
39
  class iubenda {
40
 
92
  )
93
  );
94
  public $base_url;
95
+ public $version = '3.0.1';
96
  public $activation = array(
97
  'update_version' => 0,
98
  'update_notice' => true,
330
  public function activation() {
331
  set_transient( 'iub_activation_completed', 1, 3600 );
332
 
333
+ update_option( 'iubenda_cookie_law_solution', $this->options['cs'], 'no' );
334
+ update_option( 'iubenda_cookie_law_solution', $this->options['cons'], 'no' );
335
+ update_option( 'iubenda_cookie_law_version', $this->version, 'no' );
336
+ update_option( 'iubenda_activation_data', $this->activation, 'no' );
337
 
338
  // Send a radar request on plugin activation.
339
  $radar = new RadarService;
796
  $radar->askRadarToSendRequest();
797
 
798
  // Migrating with old version
799
+ $db_version = get_option( 'iubenda_cookie_law_version' ) ?: '2.5.91';
 
800
 
801
+ // Update the new version in database
802
+ update_option( 'iubenda_cookie_law_version', $this->version, 'no' );
803
+
804
+ // Version 3.0.0 and above
805
+ if ( version_compare( $db_version, '3.0.1', '<' ) ) {
806
  $this->upgrading_to_ver_3_process();
807
  }
808
  }
815
  * @return type
816
  */
817
  public function parse_configuration( $code, $args = array() ) {
818
+ // Check if the embed code have Callback Functions inside it or not
819
+ if (strpos($code, 'callback') !== false) {
820
+ $code = $this->replace_the_callback_functions_to_parse_configuration($code);
821
+ }
822
+
823
  $configuration = array();
824
  $defaults = array(
825
  'mode' => 'basic',
1113
  iubenda()->options['activated_products'] = array_get($result, 'iubenda_activated_products', []) ?: [];
1114
  $this->settings->load_defaults();
1115
  }
1116
+
1117
+ /**
1118
+ * Workaround to replace the callback functions with empty json array to parse configuration
1119
+ *
1120
+ * @param $code
1121
+ * @return string|string[]
1122
+ */
1123
+ private function replace_the_callback_functions_to_parse_configuration($code)
1124
+ {
1125
+ $callback_position = strpos($code, 'callback');
1126
+ $opened_callback_braces = strpos($code, '{', $callback_position);
1127
+ $closing_callback_braces = $this->find_closing_bracket($code, $opened_callback_braces);
1128
+
1129
+ return substr_replace($code, '{', $opened_callback_braces, $closing_callback_braces - $opened_callback_braces);
1130
+ }
1131
+
1132
+ /**
1133
+ * @param $string
1134
+ * @param $open_position
1135
+ * @return mixed
1136
+ */
1137
+ private function find_closing_bracket($string, $open_position)
1138
+ {
1139
+ $close_pos = $open_position;
1140
+ $counter = 1;
1141
+ while ($counter > 0) {
1142
+
1143
+ // To Avoid the infinity loop
1144
+ if (!isset($string[$close_pos + 1])) {
1145
+ break;
1146
+ }
1147
+
1148
+ $c = $string[++$close_pos];
1149
+ if ($c == '{') {
1150
+ $counter++;
1151
+ } else if ($c == '}') {
1152
+ $counter--;
1153
+ }
1154
+ }
1155
+
1156
+ return $close_pos;
1157
+ }
1158
+
1159
  }
1160
 
1161
  if (!function_exists('array_get')) {
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: cookie banner, cookie law, eprivacy, gdpr, ukgdpr, ccpa, caloppa, lgpd, ds
5
  Requires at least: 5.0
6
  Requires PHP: 7.0.0
7
  Tested up to: 5.9
8
- Stable tag: 3.0.0
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
11
 
@@ -162,6 +162,11 @@ You can access our friendly support in multiple languages (currently EN, IT, DE,
162
 
163
  == Frequently Asked Questions ==
164
 
 
 
 
 
 
165
  = Do you have a Knowledge base or documentation? =
166
 
167
  Our extensive documentation makes it easy for you to learn all you need to know about compliance and how to use iubenda’s products on your site or app. **[You can access it here](https://www.iubenda.com/en/help)**. You can also visit our support forum [here](https://support.iubenda.com/support/home).
@@ -237,6 +242,9 @@ The Brazilian General Data Protection Law, the ***Lei Geral de Proteção de Dad
237
 
238
  == Changelog ==
239
 
 
 
 
240
  = 3.0.0 =
241
  * New: Support Privacy Policy
242
  * New: Support Terms and Conditions
@@ -642,8 +650,5 @@ The Brazilian General Data Protection Law, the ***Lei Geral de Proteção de Dad
642
 
643
  == Upgrade Notice ==
644
 
645
- = 3.0.0 =
646
- * New: Support Privacy Policy
647
- * New: Support Terms and Conditions
648
- * New: Generate your cookie solution with few clicks
649
- * New: Use Radar to scan current website
5
  Requires at least: 5.0
6
  Requires PHP: 7.0.0
7
  Tested up to: 5.9
8
+ Stable tag: 3.0.1
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
11
 
162
 
163
  == Frequently Asked Questions ==
164
 
165
+ = Updating to version 3 =
166
+
167
+ If you are experiencing troubles updating to the latest version, please ensure that your cookie banner is correctly activated and configured, and you've cleaned up yout WordPress cache. In case of emergency, you can safely rollback to the previous version by [using WP Rollback](https://www.iubenda.com/en/help/1215-cookie-solution-wordpress-plugin-installation-guide#how-to-install-a-beta-version-of-the-plugin).
168
+
169
+
170
  = Do you have a Knowledge base or documentation? =
171
 
172
  Our extensive documentation makes it easy for you to learn all you need to know about compliance and how to use iubenda’s products on your site or app. **[You can access it here](https://www.iubenda.com/en/help)**. You can also visit our support forum [here](https://support.iubenda.com/support/home).
242
 
243
  == Changelog ==
244
 
245
+ = 3.0.1 =
246
+ * Bugfix: Fix issue after updating to new plugin
247
+
248
  = 3.0.0 =
249
  * New: Support Privacy Policy
250
  * New: Support Terms and Conditions
650
 
651
  == Upgrade Notice ==
652
 
653
+ = 3.0.1 =
654
+ * Bugfix: Fix issue after updating to new plugin