iubenda Cookie Solution for GDPR - Version 1.10.3

Version Description

  • Fixed the WPML activation, which now detects the language of the embedding code and places it in the right tab
  • The first tab when WPML is activated is now activated automatically
  • The iubenda shortcode has been improved to be more flexible
Download this release

Release Info

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

Code changes from version 1.10.2 to 1.10.3

iubenda-cookie-class/iubenda.class.php CHANGED
@@ -1,8 +1,16 @@
1
  <?php
2
 
 
 
 
 
 
 
 
 
3
  class Page {
4
 
5
- const IUB_REGEX_PATTERN = '/<!--IUB_COOKIE_POLICY_START-->(.*)<!--IUB_COOKIE_POLICY_END-->/sU';
6
 
7
  public $auto_script_tags = array(
8
  'platform.twitter.com/widgets.js',
1
  <?php
2
 
3
+ /*
4
+ *
5
+ * iubenda.class.php
6
+ *
7
+ * Version: 1.0.0.0
8
+ *
9
+ */
10
+
11
  class Page {
12
 
13
+ const IUB_REGEX_PATTERN = '/<!--\s*IUB_COOKIE_POLICY_START\s*-->(.*?)<!--\s*IUB_COOKIE_POLICY_END\s*-->/sU';
14
 
15
  public $auto_script_tags = array(
16
  'platform.twitter.com/widgets.js',
iubenda-cookie-class/usage.php CHANGED
@@ -1,26 +1,42 @@
1
  <?php
2
- include_once 'simple_html_dom.php';
3
- include_once 'iubenda.class.php';
4
-
5
- // Check if the user has already given consent
6
- if(!Page::consent_given()){
7
 
8
- $url = 'http://www.facciamoilpresepe.it';
9
-
10
- // Here you should pass the content of the page, this is just an example
11
- // using file_get_contents(url) to have a real web page
12
- $content = file_get_contents(A);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
- // Istantiate new Page with content
15
- $page = new Page($content);
16
-
17
- // Parse and convert content
18
- $page->parse();
19
-
20
- // Print the new page
21
- echo $page->get_converted_page();
22
- }else{
23
- echo 'Consent already given.. print the page without instantiate and parse';
24
- }
25
-
26
  ?>
1
  <?php
 
 
 
 
 
2
 
3
+ // the "$html" parameter must contain the content of the web page with the iubenda JavaScript banner/policy included
4
+
5
+ function iubenda_system($html)
6
+ {
7
+ if(empty($html)) return;
8
+
9
+ /*
10
+ * Separator
11
+ */
12
+
13
+ if(!function_exists("file_get_html")) {
14
+ require_once("simple_html_dom.php");
15
+ }
16
+
17
+ require_once("iubenda.class.php");
18
+
19
+ /*
20
+ * Separator
21
+ */
22
+
23
+ if(!Page::consent_given() && !Page::bot_detected()) {
24
+ $page = new Page($html);
25
+ $page->parse();
26
+ $html = $page->get_converted_page();
27
+ }
28
+
29
+ /* Finished */
30
+
31
+ return $html;
32
+ }
33
+
34
+ /*
35
+ *
36
+ * Example:
37
+ *
38
+ * echo iubenda_system("<html> ...content... </html>");
39
+ *
40
+ */
41
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  ?>
iubenda_cookie_solution.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin URI: https://www.iubenda.com
5
  Description: Iubenda Cookie Solution permette di gestire tutti gli aspetti della cookie law su WP.
6
  Author: iubenda
7
- Version: 1.10.2
8
  Text Domain: iubenda-cookie-wp-plugin
9
  Author URI: https://www.iubenda.com
10
  */
@@ -65,6 +65,27 @@
65
  $page = new Page($output);
66
  $page->parse();
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  /**/
69
 
70
  $iubenda_code = "";
@@ -72,14 +93,10 @@
72
  /**/
73
 
74
  $output = $page->get_converted_page();
75
-
76
- if(get_option("iub_code")) {
77
- update_option("iubenda-code-default", html_entity_decode(stripslashes(get_option("iub_code"))));
78
- update_option("iub_code", false);
79
- }
80
 
81
  if(defined("IUBENDA_WPML") && get_option("iubenda-code-".ICL_LANGUAGE_CODE))
82
  {
 
83
  $iubenda_code .= get_option("iubenda-code-".ICL_LANGUAGE_CODE);
84
  }
85
  else
@@ -157,8 +174,22 @@ if('callback' in _iub.csConfiguration) {
157
  function __iub_admin_load(){
158
 
159
  if(get_option("iub_code")) {
160
- update_option("iubenda-code-default", html_entity_decode(stripslashes(get_option("iub_code"))));
161
- update_option("iub_code", false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  }
163
 
164
  // Only for debug purposes
@@ -395,6 +426,16 @@ if('callback' in _iub.csConfiguration) {
395
  document.getElementById("iubenda-information").style.display = "none";
396
  }
397
 
 
 
 
 
 
 
 
 
 
 
398
  setTimeout
399
  (
400
  function() {
@@ -430,7 +471,7 @@ if('callback' in _iub.csConfiguration) {
430
 
431
  echo
432
  '
433
- <div class="iubenda-tab iubenda-code-'.$language.'" onclick="iubendaGetLanguage('.chr(39).$language.chr(39).')">'
434
  .$value["translated_name"].'
435
  </div>
436
  ';
4
  Plugin URI: https://www.iubenda.com
5
  Description: Iubenda Cookie Solution permette di gestire tutti gli aspetti della cookie law su WP.
6
  Author: iubenda
7
+ Version: 1.10.3
8
  Text Domain: iubenda-cookie-wp-plugin
9
  Author URI: https://www.iubenda.com
10
  */
65
  $page = new Page($output);
66
  $page->parse();
67
 
68
+ /**/
69
+
70
+ if(get_option("iub_code")) {
71
+ $wpml_old = html_entity_decode(stripslashes(get_option("iub_code")));
72
+
73
+ $iubenda_languages = array("it", "de", "en", "es", "br", "ru");
74
+
75
+ foreach($iubenda_languages as $iubenda_language)
76
+ {
77
+ if(strpos($wpml_old, 'lang: "'.$iubenda_language) !== false) {
78
+ $language_tag = $iubenda_language;
79
+
80
+ break;
81
+ }
82
+ }
83
+
84
+ update_option("iubenda-code-$language_tag", $wpml_old);
85
+ update_option("iubenda-code-default", $wpml_old);
86
+ update_option("iub_code", false);
87
+ }
88
+
89
  /**/
90
 
91
  $iubenda_code = "";
93
  /**/
94
 
95
  $output = $page->get_converted_page();
 
 
 
 
 
96
 
97
  if(defined("IUBENDA_WPML") && get_option("iubenda-code-".ICL_LANGUAGE_CODE))
98
  {
99
+
100
  $iubenda_code .= get_option("iubenda-code-".ICL_LANGUAGE_CODE);
101
  }
102
  else
174
  function __iub_admin_load(){
175
 
176
  if(get_option("iub_code")) {
177
+ $wpml_old = html_entity_decode(stripslashes(get_option("iub_code")));
178
+
179
+ $iubenda_languages = array("it", "de", "en", "es", "br", "ru");
180
+
181
+ foreach($iubenda_languages as $iubenda_language)
182
+ {
183
+ if(strpos($wpml_old, 'lang: "'.$iubenda_language) !== false) {
184
+ $language_tag = $iubenda_language;
185
+
186
+ break;
187
+ }
188
+ }
189
+
190
+ update_option("iubenda-code-$language_tag", $wpml_old);
191
+ update_option("iubenda-code-default", $wpml_old);
192
+ update_option("iub_code", false);
193
  }
194
 
195
  // Only for debug purposes
426
  document.getElementById("iubenda-information").style.display = "none";
427
  }
428
 
429
+ window.addEventListener
430
+ (
431
+ "DOMContentLoaded", function()
432
+ {
433
+ var firstTab = document.querySelector("[data-iubenda-button]");
434
+
435
+ if(firstTab) jQuery(firstTab).trigger("click");
436
+ }
437
+ );
438
+
439
  setTimeout
440
  (
441
  function() {
471
 
472
  echo
473
  '
474
+ <div class="iubenda-tab iubenda-code-'.$language.'" onclick="iubendaGetLanguage('.chr(39).$language.chr(39).')" data-iubenda-button>'
475
  .$value["translated_name"].'
476
  </div>
477
  ';
readme.txt CHANGED
@@ -122,6 +122,11 @@ Il plugin Wordpress di iubenda permette di semplificare l’adeguamento del prop
122
 
123
  == Changelog ==
124
 
 
 
 
 
 
125
  = 1.10.2 =
126
  * Fixed an encoding issue
127
 
122
 
123
  == Changelog ==
124
 
125
+ = 1.10.3 =
126
+ * Fixed the WPML activation, which now detects the language of the embedding code and places it in the right tab
127
+ * The first tab when WPML is activated is now activated automatically
128
+ * The iubenda shortcode has been improved to be more flexible
129
+
130
  = 1.10.2 =
131
  * Fixed an encoding issue
132