iubenda Cookie Solution for GDPR - Version 1.10.21

Version Description

  • Rolling back to 1.10.11
Download this release

Release Info

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

Code changes from version 1.10.20 to 1.10.21

iubenda-cookie-class/iubenda.class.php CHANGED
@@ -1,27 +1,17 @@
1
  <?php
2
- /**
3
- * iubenda.class.php
4
- * version: 1.0.0.4
5
- * @author: Copyright 2015 iubenda
6
- * @license GNU/GPL
7
- * This program is free software: you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation, either version 3 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
- */
20
 
21
- class Page {
 
 
 
 
 
 
22
 
 
 
23
  const IUB_REGEX_PATTERN = '/<!--\s*IUB_COOKIE_POLICY_START\s*-->(.*?)<!--\s*IUB_COOKIE_POLICY_END\s*-->/sU';
24
-
25
  public $auto_script_tags = array(
26
  'platform.twitter.com/widgets.js',
27
  'apis.google.com/js/plusone.js',
@@ -44,7 +34,7 @@
44
  'maps.google.it/maps',
45
  'www.google.com/maps/embed'
46
  );
47
-
48
  public $iub_comments_detected = array();
49
  public $iframe_detected = array();
50
  public $iframe_converted = array();
@@ -52,8 +42,8 @@
52
  public $scripts_inline_detected = array();
53
  public $scripts_inline_converted = array();
54
  public $scripts_converted = array();
55
-
56
-
57
  /*
58
  construct: the whole HTML output of the page
59
  */
@@ -61,37 +51,37 @@
61
  $this->original_content_page = $content_page;
62
  $this->content_page = $content_page;
63
  }
64
-
65
  /*
66
  print iubenda banner, parameter: the script code of iubenda to print the banner
67
  */
68
- public function print_banner($banner){
69
  return $banner.= "\n
70
  <script>
71
  var iCallback = function(){};
72
-
73
  if('callback' in _iub.csConfiguration) {
74
  if('onConsentGiven' in _iub.csConfiguration.callback) iCallback = _iub.csConfiguration.callback.onConsentGiven;
75
-
76
  _iub.csConfiguration.callback.onConsentGiven = function()
77
  {
78
  iCallback();
79
-
80
  /*
81
  * Separator
82
  */
83
-
84
  jQuery('noscript._no_script_iub').each(function (a, b) { var el = jQuery(b); el.after(el.html()); });
85
  };
86
  };
87
  </script>";
88
  }
89
-
90
  /*
91
  Static, detect bot & crawler
92
  */
93
  static function bot_detected() {
94
- return (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider|google|yahoo/i', $_SERVER['HTTP_USER_AGENT']));
95
  }
96
 
97
  /*
@@ -103,7 +93,6 @@ if('callback' in _iub.csConfiguration) {
103
  return true;
104
  }
105
  }
106
- return false;
107
  }
108
  /*
109
  Static, utility function: strpos for array
@@ -122,14 +111,14 @@ if('callback' in _iub.csConfiguration) {
122
  }
123
  return false;
124
  }
125
-
126
 
127
  /* Convert scripts, iframe and other code inside IUBENDAs comment in text/plain to not generate cookies */
128
  public function create_tags($html){
129
-
130
  $elements = $html->find("*");
131
  $js = '';
132
-
133
  if(is_array($elements)){
134
  $count = count($elements);
135
  for($j=0; $j<$count; $j++){
@@ -138,28 +127,30 @@ if('callback' in _iub.csConfiguration) {
138
  case 'script':
139
  $class = $e->class;
140
  $e->class = $class . ' _iub_cs_activate';
141
- $e->type = 'text/plain';
142
  $js.= $e->outertext;
143
  break;
144
-
145
  case 'iframe':
146
  $new_src = "//cdn.iubenda.com/cookie_solution/empty.html";
147
  $class = $e->class;
148
  $e->suppressedsrc = $e->src;
149
  $e->src = $new_src;
150
- $e->class = $class . ' _iub_cs_activate';
151
  $js.= $e->outertext;
152
  break;
153
-
154
  default:
155
- $js = $html;
 
 
156
  break;
157
- }
158
  }
159
  }
160
  return $js;
161
  }
162
-
163
  /* Parse all IUBENDAs comment and convert the code inside with create_tags method */
164
  public function parse_iubenda_comments(){
165
  preg_match_all(self::IUB_REGEX_PATTERN, $this->content_page, $scripts);
@@ -167,20 +158,20 @@ if('callback' in _iub.csConfiguration) {
167
  $count = count($scripts[1]);
168
  $js_scripts = array();
169
  for($j=0; $j<$count; $j++){
170
- $this->iub_comments_detected[] = $scripts[1][$j];
171
  $html = str_get_html($scripts[1][$j], $lowercase=true, $forceTagsClosed=true, $stripRN=false);
172
  $js_scripts[] = $this->create_tags($html);
173
  }
174
-
175
  if(is_array($scripts[1]) && is_array($js_scripts)){
176
  if(count($scripts[1]) >= 1 && count($js_scripts) >= 1){
177
  $this->content_page = strtr($this->content_page, array_combine($scripts[1], $js_scripts));
178
  }
179
- }
180
- }
181
  }
182
-
183
- /* Parse automatically all the scripts in the page and converts it in text/plain
184
  if src or the whole output has inside one of the elements in $auto_script_tags array */
185
  public function parse_scripts(){
186
 
@@ -197,7 +188,7 @@ if('callback' in _iub.csConfiguration) {
197
  $class = $s->class;
198
  $s->class = $class . ' _iub_cs_activate-inline';
199
  $s->type = 'text/plain';
200
- $this->scripts_converted[] = $s->innertext;
201
  }
202
  }else{
203
  $src = $s->src;
@@ -217,9 +208,9 @@ if('callback' in _iub.csConfiguration) {
217
  /*
218
  * AdSense check by Peste Vasile Alexandru, AdSense here
219
  */
220
-
221
  $ad_found = false;
222
-
223
  while(preg_match("#google_ad_client =(.*?);#i", $html))
224
  {
225
  $ad_found = true;
@@ -228,49 +219,49 @@ if('callback' in _iub.csConfiguration) {
228
  $ad_width = null;
229
  $ad_height = null;
230
  $ad_block = null;
231
-
232
  /**/
233
-
234
  preg_match("#google_ad_client =(.*?);#i", $html, $ad_client);
235
  preg_match("#google_ad_slot =(.*?);#i", $html, $ad_slot);
236
  preg_match("#google_ad_width =(.*?);#i", $html, $ad_width);
237
  preg_match("#google_ad_height =(.*?);#i", $html, $ad_height);
238
-
239
  /**/
240
-
241
  $html = preg_replace("#google_ad_client =(.*?);#i", "", $html, 1);
242
  $html = preg_replace("#google_ad_slot =(.*?);#i", "", $html, 1);
243
  $html = preg_replace("#google_ad_width =(.*?);#i", "", $html, 1);
244
  $html = preg_replace("#google_ad_height =(.*?);#i", "", $html, 1);
245
-
246
  /**/
247
-
248
  $ad_client = trim($ad_client[1]);
249
  $ad_slot = trim($ad_slot[1]);
250
  $ad_width = trim($ad_width[1]);
251
  $ad_height = trim($ad_height[1]);
252
-
253
  /**/
254
-
255
  $ad_class = 'class="_iub_cs_activate_google_ads"';
256
  $ad_style = 'style="width:'.$ad_width.'px; height:'.$ad_height.'px;"';
257
-
258
  $ad_client = 'data-client='.$ad_client;
259
  $ad_slot = 'data-slot='.$ad_slot;
260
  $ad_width = 'data-width="'.$ad_width.'"';
261
  $ad_height = 'data-height="'.$ad_height.'"';
262
-
263
  /**/
264
-
265
  $ad_block = "<div $ad_style $ad_class $ad_width $ad_height $ad_slot $ad_client></div>";
266
-
267
  /**/
268
-
269
  $html = preg_replace('#(<[^>]+) src="//pagead2.googlesyndication.com/pagead/show_ads.js"(.*?)</script>#i', $ad_block, $html, 1);
270
  }
271
-
272
  /**/
273
-
274
  if($ad_found)
275
  {
276
  $adsense_callback =
@@ -311,34 +302,34 @@ if('callback' in _iub.csConfiguration) {
311
  else
312
  {
313
  _iub.csConfiguration.callback = {};
314
-
315
  _iub.csConfiguration.callback.onConsentGiven = iubenda_adsense_unblock;
316
  }
317
  </script>
318
  ";
319
-
320
  $html = str_replace("</body>", $adsense_callback."</body>", $html);
321
  }
322
-
323
  /**/
324
-
325
  $this->content_page = $html;
326
  }
327
  }
328
 
329
  /* Parse automatically all the iframe in the page and change the src to suppressedsrc
330
- if src has inside one of the elements in $auto_iframe_tags array */
331
  public function parse_iframe(){
332
  $html = str_get_html($this->content_page, $lowercase=true, $forceTagsClosed=true, $stripRN=false);
333
  if(is_object($html)){
334
- $iframes = $html->find("iframe");
335
  if(is_array($iframes)){
336
  $count = count($iframes);
337
  for($j=0; $j<$count; $j++){
338
  $i = $iframes[$j];
339
  $src = $i->src;
340
  $this->iframe_detected[] = $src;
341
- if (Page::strpos_array($src, $this->auto_iframe_tags) !== false){
342
  $new_src = "//cdn.iubenda.com/cookie_solution/empty.html";
343
  $class = $i->class;
344
  $i->suppressedsrc = $src;
@@ -351,24 +342,23 @@ if('callback' in _iub.csConfiguration) {
351
  $this->content_page = $html;
352
  }
353
  }
354
-
355
  /*
356
  Call three methods to parse the page, iubendas comment, scripts + iframe
357
  */
358
- public function parse()
359
- {
360
  $this->parse_iubenda_comments();
361
  $this->parse_scripts();
362
  $this->parse_iframe();
363
  }
364
-
365
  /*
366
  Return the final page to output
367
  */
368
  public function get_converted_page(){
369
  return $this->content_page;
370
  }
371
-
372
  }
373
 
374
- ?>
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ /*
4
+ *
5
+ * iubenda.class.php
6
+ *
7
+ * Version: 1.0.1
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',
17
  'apis.google.com/js/plusone.js',
34
  'maps.google.it/maps',
35
  'www.google.com/maps/embed'
36
  );
37
+
38
  public $iub_comments_detected = array();
39
  public $iframe_detected = array();
40
  public $iframe_converted = array();
42
  public $scripts_inline_detected = array();
43
  public $scripts_inline_converted = array();
44
  public $scripts_converted = array();
45
+
46
+
47
  /*
48
  construct: the whole HTML output of the page
49
  */
51
  $this->original_content_page = $content_page;
52
  $this->content_page = $content_page;
53
  }
54
+
55
  /*
56
  print iubenda banner, parameter: the script code of iubenda to print the banner
57
  */
58
+ public function print_banner($banner){
59
  return $banner.= "\n
60
  <script>
61
  var iCallback = function(){};
62
+
63
  if('callback' in _iub.csConfiguration) {
64
  if('onConsentGiven' in _iub.csConfiguration.callback) iCallback = _iub.csConfiguration.callback.onConsentGiven;
65
+
66
  _iub.csConfiguration.callback.onConsentGiven = function()
67
  {
68
  iCallback();
69
+
70
  /*
71
  * Separator
72
  */
73
+
74
  jQuery('noscript._no_script_iub').each(function (a, b) { var el = jQuery(b); el.after(el.html()); });
75
  };
76
  };
77
  </script>";
78
  }
79
+
80
  /*
81
  Static, detect bot & crawler
82
  */
83
  static function bot_detected() {
84
+ return (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider/i', $_SERVER['HTTP_USER_AGENT']));
85
  }
86
 
87
  /*
93
  return true;
94
  }
95
  }
 
96
  }
97
  /*
98
  Static, utility function: strpos for array
111
  }
112
  return false;
113
  }
114
+
115
 
116
  /* Convert scripts, iframe and other code inside IUBENDAs comment in text/plain to not generate cookies */
117
  public function create_tags($html){
118
+
119
  $elements = $html->find("*");
120
  $js = '';
121
+
122
  if(is_array($elements)){
123
  $count = count($elements);
124
  for($j=0; $j<$count; $j++){
127
  case 'script':
128
  $class = $e->class;
129
  $e->class = $class . ' _iub_cs_activate';
130
+ $e->type = 'text/plain';
131
  $js.= $e->outertext;
132
  break;
133
+
134
  case 'iframe':
135
  $new_src = "//cdn.iubenda.com/cookie_solution/empty.html";
136
  $class = $e->class;
137
  $e->suppressedsrc = $e->src;
138
  $e->src = $new_src;
139
+ $e->class = $class . ' _iub_cs_activate';
140
  $js.= $e->outertext;
141
  break;
142
+
143
  default:
144
+ $js.= '<noscript class="_no_script_iub">';
145
+ $js.= $e->outertext;
146
+ $js.= '</noscript>';
147
  break;
148
+ }
149
  }
150
  }
151
  return $js;
152
  }
153
+
154
  /* Parse all IUBENDAs comment and convert the code inside with create_tags method */
155
  public function parse_iubenda_comments(){
156
  preg_match_all(self::IUB_REGEX_PATTERN, $this->content_page, $scripts);
158
  $count = count($scripts[1]);
159
  $js_scripts = array();
160
  for($j=0; $j<$count; $j++){
161
+ $this->iub_comments_detected[] = $scripts[1][$j];
162
  $html = str_get_html($scripts[1][$j], $lowercase=true, $forceTagsClosed=true, $stripRN=false);
163
  $js_scripts[] = $this->create_tags($html);
164
  }
165
+
166
  if(is_array($scripts[1]) && is_array($js_scripts)){
167
  if(count($scripts[1]) >= 1 && count($js_scripts) >= 1){
168
  $this->content_page = strtr($this->content_page, array_combine($scripts[1], $js_scripts));
169
  }
170
+ }
171
+ }
172
  }
173
+
174
+ /* Parse automatically all the scripts in the page and converts it in text/plain
175
  if src or the whole output has inside one of the elements in $auto_script_tags array */
176
  public function parse_scripts(){
177
 
188
  $class = $s->class;
189
  $s->class = $class . ' _iub_cs_activate-inline';
190
  $s->type = 'text/plain';
191
+ $this->scripts_converted[] = $s->innertext;
192
  }
193
  }else{
194
  $src = $s->src;
208
  /*
209
  * AdSense check by Peste Vasile Alexandru, AdSense here
210
  */
211
+
212
  $ad_found = false;
213
+
214
  while(preg_match("#google_ad_client =(.*?);#i", $html))
215
  {
216
  $ad_found = true;
219
  $ad_width = null;
220
  $ad_height = null;
221
  $ad_block = null;
222
+
223
  /**/
224
+
225
  preg_match("#google_ad_client =(.*?);#i", $html, $ad_client);
226
  preg_match("#google_ad_slot =(.*?);#i", $html, $ad_slot);
227
  preg_match("#google_ad_width =(.*?);#i", $html, $ad_width);
228
  preg_match("#google_ad_height =(.*?);#i", $html, $ad_height);
229
+
230
  /**/
231
+
232
  $html = preg_replace("#google_ad_client =(.*?);#i", "", $html, 1);
233
  $html = preg_replace("#google_ad_slot =(.*?);#i", "", $html, 1);
234
  $html = preg_replace("#google_ad_width =(.*?);#i", "", $html, 1);
235
  $html = preg_replace("#google_ad_height =(.*?);#i", "", $html, 1);
236
+
237
  /**/
238
+
239
  $ad_client = trim($ad_client[1]);
240
  $ad_slot = trim($ad_slot[1]);
241
  $ad_width = trim($ad_width[1]);
242
  $ad_height = trim($ad_height[1]);
243
+
244
  /**/
245
+
246
  $ad_class = 'class="_iub_cs_activate_google_ads"';
247
  $ad_style = 'style="width:'.$ad_width.'px; height:'.$ad_height.'px;"';
248
+
249
  $ad_client = 'data-client='.$ad_client;
250
  $ad_slot = 'data-slot='.$ad_slot;
251
  $ad_width = 'data-width="'.$ad_width.'"';
252
  $ad_height = 'data-height="'.$ad_height.'"';
253
+
254
  /**/
255
+
256
  $ad_block = "<div $ad_style $ad_class $ad_width $ad_height $ad_slot $ad_client></div>";
257
+
258
  /**/
259
+
260
  $html = preg_replace('#(<[^>]+) src="//pagead2.googlesyndication.com/pagead/show_ads.js"(.*?)</script>#i', $ad_block, $html, 1);
261
  }
262
+
263
  /**/
264
+
265
  if($ad_found)
266
  {
267
  $adsense_callback =
302
  else
303
  {
304
  _iub.csConfiguration.callback = {};
305
+
306
  _iub.csConfiguration.callback.onConsentGiven = iubenda_adsense_unblock;
307
  }
308
  </script>
309
  ";
310
+
311
  $html = str_replace("</body>", $adsense_callback."</body>", $html);
312
  }
313
+
314
  /**/
315
+
316
  $this->content_page = $html;
317
  }
318
  }
319
 
320
  /* Parse automatically all the iframe in the page and change the src to suppressedsrc
321
+ if src has inside one of the elements in $auto_iframe_tags array */
322
  public function parse_iframe(){
323
  $html = str_get_html($this->content_page, $lowercase=true, $forceTagsClosed=true, $stripRN=false);
324
  if(is_object($html)){
325
+ $iframes = $html->find("iframe");
326
  if(is_array($iframes)){
327
  $count = count($iframes);
328
  for($j=0; $j<$count; $j++){
329
  $i = $iframes[$j];
330
  $src = $i->src;
331
  $this->iframe_detected[] = $src;
332
+ if (Page::strpos_array($src, $this->auto_iframe_tags) !== false){
333
  $new_src = "//cdn.iubenda.com/cookie_solution/empty.html";
334
  $class = $i->class;
335
  $i->suppressedsrc = $src;
342
  $this->content_page = $html;
343
  }
344
  }
345
+
346
  /*
347
  Call three methods to parse the page, iubendas comment, scripts + iframe
348
  */
349
+ public function parse(){
 
350
  $this->parse_iubenda_comments();
351
  $this->parse_scripts();
352
  $this->parse_iframe();
353
  }
354
+
355
  /*
356
  Return the final page to output
357
  */
358
  public function get_converted_page(){
359
  return $this->content_page;
360
  }
361
+
362
  }
363
 
364
+ ?>
iubenda-cookie-class/test.php CHANGED
@@ -1,22 +1,4 @@
1
  <?php
2
- /**
3
- * test.php
4
- * @author: Copyright 2015 iubenda
5
- * @license GNU/GPL
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
- */
19
-
20
  ini_set('max_execution_time', 300);
21
  ?>
22
 
@@ -43,12 +25,12 @@ ul li { list-style-type: none; }
43
  <input type="submit" class="btn" value="Analyze">
44
  </form>
45
  </div>
46
-
47
  <?php
48
-
49
  $url = $_POST['url'];
50
  if($url || $_GET['url']){
51
-
52
  function print_stuff($array){
53
  if(count($array)){
54
  echo "<ul>";
@@ -60,17 +42,17 @@ ul li { list-style-type: none; }
60
  echo "<p>Nothing</p>";
61
  }
62
  }
63
-
64
  echo '<div class="col-md-12" style="padding-bottom:150px;"><h2>RESULTS</H2>';
65
  include_once 'iubenda.class.php';
66
  include_once 'simple_html_dom.php';
67
-
68
  if($_GET['url']){
69
  $content = file_get_contents('A');
70
  }else{
71
  $content = file_get_contents($url);
72
  }
73
-
74
  $page = new Page($content);
75
  $page->parse();
76
 
@@ -80,39 +62,39 @@ ul li { list-style-type: none; }
80
  $iframe_converted = count($page->iframe_converted);
81
  $script_inline_converted = count($page->scripts_inline_converted);
82
  $script_converted = count($page->scripts_converted);
83
-
84
  echo "<p>Iubenda comments detected: $iub_comments_detected<br>Iubenda automatic stuff<br>Iframe detected: $iframe_detected<br>Iframe autoconverted: $iframe_converted<br>Scripts detected: $scripts_detected<br>Inline scripts autoconverted: $script_inline_converted<br>Scripts autoconverted: $script_converted</p>";
 
85
 
86
-
87
-
88
-
89
-
90
  echo "<H3>DETAILS</H3>";
91
-
92
  echo "<H4>iubenda comments stuff</h4>";
93
  print_stuff($page->iub_comments_detected);
94
-
95
  echo "<H4>Script detected</h4>";
96
  print_stuff($page->scripts_detected);
97
  echo "<H4>Script converted</h4>";
98
  print_stuff($page->scripts_converted);
99
  echo "<H4>Script inline converted</h4>";
100
  print_stuff($page->scripts_inline_converted);
101
-
102
  echo "<H4>Iframe detected</h4>";
103
  print_stuff($page->iframe_detected);
104
  echo "<H4>Iframe converted</h4>";
105
  print_stuff($page->iframe_converted);
106
-
107
-
108
-
109
  echo "</div>";
110
-
111
-
112
  }
113
  ?>
114
  </div>
115
  </div>
116
 
117
  </body>
118
- </html>
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  ini_set('max_execution_time', 300);
3
  ?>
4
 
25
  <input type="submit" class="btn" value="Analyze">
26
  </form>
27
  </div>
28
+
29
  <?php
30
+
31
  $url = $_POST['url'];
32
  if($url || $_GET['url']){
33
+
34
  function print_stuff($array){
35
  if(count($array)){
36
  echo "<ul>";
42
  echo "<p>Nothing</p>";
43
  }
44
  }
45
+
46
  echo '<div class="col-md-12" style="padding-bottom:150px;"><h2>RESULTS</H2>';
47
  include_once 'iubenda.class.php';
48
  include_once 'simple_html_dom.php';
49
+
50
  if($_GET['url']){
51
  $content = file_get_contents('A');
52
  }else{
53
  $content = file_get_contents($url);
54
  }
55
+
56
  $page = new Page($content);
57
  $page->parse();
58
 
62
  $iframe_converted = count($page->iframe_converted);
63
  $script_inline_converted = count($page->scripts_inline_converted);
64
  $script_converted = count($page->scripts_converted);
65
+
66
  echo "<p>Iubenda comments detected: $iub_comments_detected<br>Iubenda automatic stuff<br>Iframe detected: $iframe_detected<br>Iframe autoconverted: $iframe_converted<br>Scripts detected: $scripts_detected<br>Inline scripts autoconverted: $script_inline_converted<br>Scripts autoconverted: $script_converted</p>";
67
+
68
 
69
+
70
+
71
+
 
72
  echo "<H3>DETAILS</H3>";
73
+
74
  echo "<H4>iubenda comments stuff</h4>";
75
  print_stuff($page->iub_comments_detected);
76
+
77
  echo "<H4>Script detected</h4>";
78
  print_stuff($page->scripts_detected);
79
  echo "<H4>Script converted</h4>";
80
  print_stuff($page->scripts_converted);
81
  echo "<H4>Script inline converted</h4>";
82
  print_stuff($page->scripts_inline_converted);
83
+
84
  echo "<H4>Iframe detected</h4>";
85
  print_stuff($page->iframe_detected);
86
  echo "<H4>Iframe converted</h4>";
87
  print_stuff($page->iframe_converted);
88
+
89
+
90
+
91
  echo "</div>";
92
+
93
+
94
  }
95
  ?>
96
  </div>
97
  </div>
98
 
99
  </body>
100
+ </html>
iubenda-cookie-class/usage.php CHANGED
@@ -1,50 +1,33 @@
1
  <?php
2
- /**
3
- * usage.php
4
- * @author: Copyright 2015 iubenda
5
- * @license GNU/GPL
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
- */
19
 
20
  // the "$html" parameter must contain the content of the web page with the iubenda JavaScript banner/policy included
21
-
22
  function iubenda_system($html)
23
  {
24
  if(empty($html)) return;
25
-
26
  /*
27
  * Separator
28
  */
29
-
30
  if(!function_exists("file_get_html")) {
31
  require_once("simple_html_dom.php");
32
  }
33
-
34
  require_once("iubenda.class.php");
35
-
36
  /*
37
  * Separator
38
  */
39
-
40
  if(!Page::consent_given() && !Page::bot_detected()) {
41
  $page = new Page($html);
42
  $page->parse();
43
  $html = $page->get_converted_page();
44
  }
45
-
46
  /* Finished */
47
-
48
  return $html;
49
  }
50
 
@@ -56,4 +39,4 @@ function iubenda_system($html)
56
  *
57
  */
58
 
59
- ?>
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
 
39
  *
40
  */
41
 
42
+ ?>
iubenda_cookie_solution.php CHANGED
@@ -1,129 +1,60 @@
1
  <?php
2
-
3
  /*
4
  * Plugin Name: Iubenda Cookie Solution
5
  * Plugin URI: https://www.iubenda.com
6
  * Description: Iubenda Cookie Solution permette di gestire tutti gli aspetti della cookie law su WP.
7
  * Author: iubenda
8
- * Version: 1.10.20
9
  * Text Domain: iubenda-cookie-wp-plugin
10
  * Author URI: https://www.iubenda.com
11
  */
12
 
13
- define("DEBUG", 0);
14
- define("IUB_REGEX_PATTERN", "/<!--IUB_COOKIE_POLICY_START-->(.*)<!--IUB_COOKIE_POLICY_END-->/sU");
15
 
16
- /*
17
- Deactivate the plugin if the request is XMLRPC or we have a POST form a Visitor, or if the iub_no_parse parameter exists
18
- */
19
 
20
- if(isset($_GET["iub_no_parse"]) || isset($_SERVER["HTTP_X_REQUESTED_WITH"]) || defined("XMLRPC_REQUEST") && XMLRPC_REQUEST || defined("DOING_AJAX") && DOING_AJAX)
21
- {
22
  return;
23
  }
24
-
25
- // ...
26
 
27
- /*
28
- Methods
29
- */
30
 
31
  function iubenda_load_admin_panel()
32
  {
33
- /*
34
- Check for WPML
35
  */
36
-
37
- if(function_exists("icl_object_id"))
38
- {
39
- define("IUBENDA_WPML", true);
40
- }
41
-
42
- /**/
43
-
44
- if(is_user_logged_in())
45
- {
46
- /*
47
- Settings panel
48
- */
49
-
50
- add_action("admin_menu", "iub_admin");
51
  }
52
- else
53
- {
54
- /*
55
- Check for SimpleHTMLDOM
56
- */
57
-
58
- if(!function_exists("file_get_html")) {
59
-
60
- require(dirname(__FILE__)."/iubenda-cookie-class/simple_html_dom.php");
61
-
62
- }
63
-
64
- /*
65
- Import iubenda class
66
- */
67
 
68
- require(dirname(__FILE__)."/iubenda-cookie-class/iubenda.class.php");
69
- }
 
 
 
 
 
70
  }
71
 
72
  add_action("plugins_loaded", "iubenda_load_admin_panel");
73
-
74
- function __iubenda_content_type()
75
- {
76
- if(!is_user_logged_in() && get_option("iubenda_ctype"))
77
- {
78
- $iub_headers = headers_list();
79
- $destroy = true;
80
-
81
- /**/
82
-
83
- foreach($iub_headers as $h)
84
- {
85
- if(strpos($h, "Content-Type: text/html") !== false || strpos($h, "Content-type: text/html") !== false) {
86
- $destroy = false;
87
- }
88
- }
89
-
90
- /**/
91
-
92
- if($destroy) {
93
-
94
- define("IUBENDA_NO_HTML_TYPE", true);
95
-
96
- }
97
- }
98
- }
99
 
100
  function __iubenda_buffer_head()
101
  {
102
- /*
103
- Settings
104
- */
105
-
106
- if(!get_option("default_skip_parsing")) {
107
- update_option("default_skip_parsing", true);
108
- update_option("skip_parsing", true);
109
- }
110
- if(!get_option("default_iubendactype")) {
111
- update_option("default_iubendactype", true);
112
- update_option("iubenda_ctype", true);
113
- }
114
-
115
- /**/
116
-
117
- __iubenda_content_type();
118
-
119
- /**/
120
-
121
- if(is_user_logged_in() || $_POST || defined("IUBENDA_NO_HTML_TYPE")) {
122
-
123
- return;
124
-
125
- }
126
-
127
  /*
128
  * __iubenda_buffer_head
129
  */
@@ -132,11 +63,10 @@
132
 
133
  /**/
134
 
135
- if(get_option("iub_code"))
136
- {
137
  $wpml_old = html_entity_decode(stripslashes(get_option("iub_code")));
138
 
139
- $iubenda_languages = array("it", "de", "en", "es", "pt-br", "ru", "fr", "nl");
140
 
141
  foreach($iubenda_languages as $iubenda_language)
142
  {
@@ -162,24 +92,25 @@
162
 
163
  $iubenda_code .= "\n
164
  <script>
165
- var iCallback = function(){};
166
-
167
- if('callback' in _iub.csConfiguration) {
168
- if('onConsentGiven' in _iub.csConfiguration.callback) iCallback = _iub.csConfiguration.callback.onConsentGiven;
169
-
170
- _iub.csConfiguration.callback.onConsentGiven = function()
171
- {
172
- iCallback();
173
 
174
- /*
175
- * Separator
176
- */
177
-
178
- jQuery('noscript._no_script_iub').each(function (a, b) { var el = jQuery(b); el.after(el.html()); });
179
- };
180
- };
181
  </script>";
182
 
 
183
  /**/
184
 
185
  echo $iubenda_code;
@@ -189,53 +120,35 @@
189
 
190
  add_action("wp_head", "__iubenda_buffer_head", 99);
191
 
192
- /*
193
- function __iubenda_shutdown()
194
- {
195
- $final = "";
196
 
197
- $levels = ob_get_level();
198
 
199
- for($i = 0; $i < $levels; $i++){
200
- $final .= ob_get_clean();
201
- }
202
 
203
- echo apply_filters("final_output", $final);
204
- }
205
- */
206
 
207
  // add_action("shutdown", "__iubenda_shutdown", 0);
208
 
209
- function __iubenda_setup_output()
210
- {
211
- if($_POST || defined("IUBENDA_NO_HTML_TYPE")) {
212
-
213
- return;
214
-
215
- }
216
-
217
- if(Page::consent_given() && get_option("skip_parsing") || Page::bot_detected()) {
218
-
219
- return;
220
-
221
- }
222
-
223
- /**/
224
-
225
- ob_start("__iubenda_final_output");
226
  }
227
 
228
  add_action("registered_taxonomy", "__iubenda_setup_output", 0);
229
 
230
  function __iubenda_final_output($output)
231
  {
232
- if(is_user_logged_in())
233
- {
234
  return $output;
235
  }
236
 
237
- /**/
238
-
239
  $page = new Page($output);
240
  $page->parse();
241
 
@@ -252,29 +165,33 @@
252
  return '<!--IUB_COOKIE_POLICY_START-->'.do_shortcode($content).'<!--IUB_COOKIE_POLICY_END-->';
253
  }
254
 
 
255
  add_shortcode('iub-cookie-policy', 'iub_func');
256
 
 
257
  /***********************************
258
  *
259
  * Add menù item on the admin
260
  *
261
  ************************************/
262
 
263
- function iub_admin() {
 
 
264
  add_menu_page("Iubenda - Settings", "Iubenda", "administrator", __FILE__, "__iub_admin_load");
265
  }
266
 
 
267
  /*
268
- * Iub admin forms
 
269
  */
270
-
271
  function __iub_admin_load(){
272
 
273
- if(get_option("iub_code"))
274
- {
275
  $wpml_old = html_entity_decode(stripslashes(get_option("iub_code")));
276
 
277
- $iubenda_languages = array("it", "de", "en", "es", "pt-br", "ru", "fr", "nl");
278
 
279
  foreach($iubenda_languages as $iubenda_language)
280
  {
@@ -290,36 +207,37 @@
290
  update_option("iub_code", false);
291
  }
292
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  if ( ! current_user_can( 'manage_options' ) && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
294
  wp_die( __( 'You are not allowed to access this part of the site' ) );
295
  }
296
 
297
- $iubenda_language = array("it", "de", "en", "es", "pt-br", "ru", "fr", "nl", "default");
298
 
299
  if($_POST)
300
  {
301
  if(!empty($_POST['skip_parsing'])) {
302
- update_option("skip_parsing", true);
303
  }
304
  else {
305
  update_option("skip_parsing", null);
306
  }
307
-
308
- if(!empty($_POST['iubenda_ctype'])) {
309
- update_option("iubenda_ctype", true);
310
- }
311
- else {
312
- update_option("iubenda_ctype", null);
313
- }
314
  }
315
 
316
  if(!get_option("default_skip_parsing")) {
317
  update_option("default_skip_parsing", true);
318
- update_option("skip_parsing", true);
319
- }
320
- if(!get_option("default_iubendactype")) {
321
- update_option("default_iubendactype", true);
322
- update_option("iubenda_ctype", true);
323
  }
324
 
325
  /**/
@@ -336,15 +254,14 @@
336
  /* */
337
 
338
  $checked = "";
339
- $checked_ctype = "";
340
 
341
  if(get_option("skip_parsing")) $checked = 'checked="true"';
342
- if(get_option("iubenda_ctype")) $checked_ctype = 'checked="true"';
343
 
344
  /* */
345
 
346
 
347
  echo '
 
348
  <style>
349
  #iubenda-tabs
350
  {
@@ -381,7 +298,7 @@
381
  border-color: transparent transparent;
382
  }
383
 
384
- #iubenda-code-it, #iubenda-code-de, #iubenda-code-ru, #iubenda-code-es, #iubenda-code-pt-br, #iubenda-code-en, #iubenda-code-fr, #iubenda-code-nl {
385
  display: none;
386
 
387
  width: 100%;
@@ -503,7 +420,7 @@
503
  </style>
504
  <script>
505
  function iubendaGetLanguage(str) {
506
- var languages = ["it", "de", "en", "es", "pt-br", "ru", "fr", "nl"];
507
 
508
  for(var i = 0; i < languages.length; i++) {
509
  var tab = document.getElementById("iubenda-code-" + languages[i]);
@@ -594,24 +511,19 @@
594
  {
595
  echo '<textarea class="iubenda-textarea iubenda-textarea-single" name="iubenda-code-default">'.stripslashes(get_option("iubenda-code-default")).'</textarea>';
596
  }
597
-
598
- echo '
599
- <p>
600
  <input type="checkbox" name="skip_parsing" value="skip" '.$checked.'>
601
- Lascia intatti gli script della pagina se l\'utente ha già dato il consenso (migliora le prestazioni, altamente consigliato, da disattivare solo qualora il tuo sito utilizzi un sistema di cache)
602
- </p>
603
- <p>
604
- <input type="checkbox" name="iubenda_ctype" value="enabled" '.$checked_ctype.'>
605
- Restringi l\'esecuzione del plugin alle sole richieste che presentano "Content-type: text/html" (consigliato)
606
- </p>
607
- <p>
608
- <input type="submit" value="Salva" id="iubenda-save">
609
- </p>
610
- </form>
611
- <p class="iubenda-text">
612
- <span class="iubenda-title">Hai bisogno di supporto su questo plugin?</span>
613
- Visita il nostro <a href="//support.iubenda.com/forums/314835-general/suggestions/9670701-discussion-regarding-the-iubenda-cookie-law-soluti" class="iubenda-url" target="_blank">forum di supporto</a>.
614
- </p>
615
- ';
616
  }
617
  ?>
1
  <?php
 
2
  /*
3
  * Plugin Name: Iubenda Cookie Solution
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.21
8
  * Text Domain: iubenda-cookie-wp-plugin
9
  * Author URI: https://www.iubenda.com
10
  */
11
 
12
+ define('DEBUG', 0);
13
+ define('IUB_REGEX_PATTERN', '/<!--IUB_COOKIE_POLICY_START-->(.*)<!--IUB_COOKIE_POLICY_END-->/sU');
14
 
15
+ /**/
 
 
16
 
17
+ if(isset($_GET["iub_no_parse"]) && !empty($_GET["iub_no_parse"]) || defined("XMLRPC_REQUEST") && XMLRPC_REQUEST) {
 
18
  return;
19
  }
 
 
20
 
21
+ /**/
 
 
22
 
23
  function iubenda_load_admin_panel()
24
  {
25
+ /*
26
+ * Check for WPML
27
  */
28
+
29
+ if(function_exists('icl_object_id')) {
30
+ define("IUBENDA_WPML", true);
31
+ }
32
+
33
+ /*
34
+ * Check for SimpleHTMLDom
35
+ */
36
+
37
+ if(!function_exists('file_get_html')){
38
+ include_once dirname(__FILE__) . '/iubenda-cookie-class/simple_html_dom.php';
 
 
 
 
39
  }
40
+
41
+ /*
42
+ * Import iubenda CLASS
43
+ */
 
 
 
 
 
 
 
 
 
 
 
44
 
45
+ include_once dirname(__FILE__) . '/iubenda-cookie-class/iubenda.class.php';
46
+
47
+ /*
48
+ * Add settings panel
49
+ */
50
+
51
+ if(is_admin()) add_action('admin_menu', 'iub_admin');
52
  }
53
 
54
  add_action("plugins_loaded", "iubenda_load_admin_panel");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  function __iubenda_buffer_head()
57
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  /*
59
  * __iubenda_buffer_head
60
  */
63
 
64
  /**/
65
 
66
+ if(get_option("iub_code")) {
 
67
  $wpml_old = html_entity_decode(stripslashes(get_option("iub_code")));
68
 
69
+ $iubenda_languages = array("it", "de", "en", "es", "pt-br", "ru", "fr");
70
 
71
  foreach($iubenda_languages as $iubenda_language)
72
  {
92
 
93
  $iubenda_code .= "\n
94
  <script>
95
+ var iCallback = function(){};
96
+
97
+ if('callback' in _iub.csConfiguration) {
98
+ if('onConsentGiven' in _iub.csConfiguration.callback) iCallback = _iub.csConfiguration.callback.onConsentGiven;
99
+
100
+ _iub.csConfiguration.callback.onConsentGiven = function()
101
+ {
102
+ iCallback();
103
 
104
+ /*
105
+ * Separator
106
+ */
107
+
108
+ jQuery('noscript._no_script_iub').each(function (a, b) { var el = jQuery(b); el.after(el.html()); });
109
+ };
110
+ };
111
  </script>";
112
 
113
+
114
  /**/
115
 
116
  echo $iubenda_code;
120
 
121
  add_action("wp_head", "__iubenda_buffer_head", 99);
122
 
123
+ function __iubenda_shutdown()
124
+ {
125
+ $final = "";
 
126
 
127
+ $levels = ob_get_level();
128
 
129
+ for($i = 0; $i < $levels; $i++){
130
+ $final .= ob_get_clean();
131
+ }
132
 
133
+ echo apply_filters("final_output", $final);
134
+ }
 
135
 
136
  // add_action("shutdown", "__iubenda_shutdown", 0);
137
 
138
+ function __iubenda_setup_output() {
139
+ if(!is_admin()) {
140
+ ob_start("__iubenda_final_output");
141
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  }
143
 
144
  add_action("registered_taxonomy", "__iubenda_setup_output", 0);
145
 
146
  function __iubenda_final_output($output)
147
  {
148
+ if(Page::consent_given() && get_option("skip_parsing") || Page::bot_detected()) {
 
149
  return $output;
150
  }
151
 
 
 
152
  $page = new Page($output);
153
  $page->parse();
154
 
165
  return '<!--IUB_COOKIE_POLICY_START-->'.do_shortcode($content).'<!--IUB_COOKIE_POLICY_END-->';
166
  }
167
 
168
+
169
  add_shortcode('iub-cookie-policy', 'iub_func');
170
 
171
+
172
  /***********************************
173
  *
174
  * Add menù item on the admin
175
  *
176
  ************************************/
177
 
178
+
179
+ function iub_admin()
180
+ {
181
  add_menu_page("Iubenda - Settings", "Iubenda", "administrator", __FILE__, "__iub_admin_load");
182
  }
183
 
184
+
185
  /*
186
+ * Iub admin forms
187
+ *
188
  */
 
189
  function __iub_admin_load(){
190
 
191
+ if(get_option("iub_code")) {
 
192
  $wpml_old = html_entity_decode(stripslashes(get_option("iub_code")));
193
 
194
+ $iubenda_languages = array("it", "de", "en", "es", "pt-br", "ru", "fr");
195
 
196
  foreach($iubenda_languages as $iubenda_language)
197
  {
207
  update_option("iub_code", false);
208
  }
209
 
210
+ // Only for debug purposes
211
+ // *Don't touch*
212
+ // delete_option('iub_cp_default');
213
+ // delete_option('iub_cp');
214
+
215
+ /***************************************************************************
216
+ *
217
+ * Style for messages
218
+ *
219
+ ***************************************************************************/
220
+
221
+
222
  if ( ! current_user_can( 'manage_options' ) && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
223
  wp_die( __( 'You are not allowed to access this part of the site' ) );
224
  }
225
 
226
+ $iubenda_language = array("it", "de", "en", "es", "pt-br", "ru", "fr", "default");
227
 
228
  if($_POST)
229
  {
230
  if(!empty($_POST['skip_parsing'])) {
231
+ update_option("skip_parsing", "skip");
232
  }
233
  else {
234
  update_option("skip_parsing", null);
235
  }
 
 
 
 
 
 
 
236
  }
237
 
238
  if(!get_option("default_skip_parsing")) {
239
  update_option("default_skip_parsing", true);
240
+ update_option("skip_parsing", "skip");
 
 
 
 
241
  }
242
 
243
  /**/
254
  /* */
255
 
256
  $checked = "";
 
257
 
258
  if(get_option("skip_parsing")) $checked = 'checked="true"';
 
259
 
260
  /* */
261
 
262
 
263
  echo '
264
+
265
  <style>
266
  #iubenda-tabs
267
  {
298
  border-color: transparent transparent;
299
  }
300
 
301
+ #iubenda-code-it, #iubenda-code-de, #iubenda-code-ru, #iubenda-code-es, #iubenda-code-pt-br, #iubenda-code-en, #iubenda-code-fr {
302
  display: none;
303
 
304
  width: 100%;
420
  </style>
421
  <script>
422
  function iubendaGetLanguage(str) {
423
+ var languages = ["it", "de", "en", "es", "pt-br", "ru", "fr"];
424
 
425
  for(var i = 0; i < languages.length; i++) {
426
  var tab = document.getElementById("iubenda-code-" + languages[i]);
511
  {
512
  echo '<textarea class="iubenda-textarea iubenda-textarea-single" name="iubenda-code-default">'.stripslashes(get_option("iubenda-code-default")).'</textarea>';
513
  }
514
+
515
+ echo '
516
+ <p>
517
  <input type="checkbox" name="skip_parsing" value="skip" '.$checked.'>
518
+ Lascia intatti gli script della pagina se l\'utente ha già dato il consenso (migliora le prestazioni, altamente consigliato, da disattivare solo qualora il tuo sito utilizzi un sistema di cache)
519
+ </p>
520
+ <p>
521
+ <input type="submit" value="SAVE" id="iubenda-save">
522
+ </p>
523
+ </form>
524
+ <p class="iubenda-text">
525
+ <span class="iubenda-title">Hai bisogno di supporto su questo plugin?</span>
526
+ Visita il nostro <a href="//support.iubenda.com/forums/314835-general/suggestions/9670701-discussion-regarding-the-iubenda-cookie-law-soluti" class="iubenda-url" target="_blank">forum di supporto</a>.
527
+ </p>';
 
 
 
 
 
528
  }
529
  ?>
readme.txt CHANGED
@@ -127,6 +127,9 @@ Il plugin Wordpress di iubenda permette di semplificare l’adeguamento del prop
127
 
128
  == Changelog ==
129
 
 
 
 
130
  = 1.10.20 =
131
  * Hotfix: moved “is_user_logged_in” method control after the “template_redirect” hook.
132
 
127
 
128
  == Changelog ==
129
 
130
+ = 1.10.21 =
131
+ * Rolling back to 1.10.11
132
+
133
  = 1.10.20 =
134
  * Hotfix: moved “is_user_logged_in” method control after the “template_redirect” hook.
135