iubenda Cookie Solution for GDPR - Version 1.15.2

Version Description

  • Tweak: Update and unify iubenda parsing engine
  • Tweak: Polylang Pro support
Download this release

Release Info

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

Code changes from version 1.15.1 to 1.15.2

iubenda-cookie-class/README.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Read Me
2
+
3
+ [![GitHub release](https://img.shields.io/github/release/iubenda/iubenda-cookie-class.svg)](https://github.com/iubenda/iubenda-cookie-class/releases/tag/2.0.3)
4
+
5
+ ***PHP class for the iubenda cookie law solution***
6
+
7
+ If you have European users you need to obtain and manage consent for the use of most cookies.
8
+ The iubenda Cookie Solution is an all-in-one approach developed by iubenda, that helps to make your website GDPR and Cookie Law compliant by integrating with your cookie policy, providing a compliant cookie banner and the blocking management of cookie scripts. The Cookie Solution also allows users to set advertising preferences on-site and within the solution, facilitated the recent-but-widely adopted IAB Europe Transparency & Consent [framework](https://www.iubenda.com/en/help/7440#aboutIAB).
9
+
10
+ [Read more about the Cookie Solution here](https://www.iubenda.com/en/features#cookie-solution).
11
+
12
+ * * *
13
+ #### This class allows you to scan a page in PHP for scripts and run the automatic blocking of scripts
14
+
15
+ *This is the class on which our WordPress and Joomla! and Drupal plugins are based and you can use it to build your own plugin independently for a platform other than those for which we have already developed a dedicated solution.*
16
+
17
+ * * *
18
+
19
+ ## Functionality
20
+
21
+ This class works with the iubenda Cookie Law Solution and allows you to block the most common widgets and third-party cookies to comply with Cookie Law.
22
+
23
+ The class is currently able to detect and automatically block the following scripts:
24
+
25
+ * Facebook widgets
26
+ * Twitter widgets
27
+ * Google+ widgets
28
+ * Google AdSense
29
+ * YouTube widgets
30
+ * Vimeo
31
+ * AddThis widgets
32
+ * ShareThis widgets
33
+
34
+ It also allows the manual blocking of all other resources without direct intervention on the actual scripts. Read more about the [prior blocking functionality here](https://www.iubenda.com/en/help/1229-cookie-law-solution-preventing-code-execution-that-could-install-cookies).
35
+ * * *
36
+ Here is an example of the PHP class integration:
37
+
38
+ ```php
39
+ function iubenda_system( $html, $type = 'page' ) {
40
+ if ( empty( $html ) )
41
+ return;
42
+
43
+ require_once( 'iubenda.class.php' );
44
+
45
+ // separator
46
+ if ( ! iubendaParser::consent_given() && ! iubendaParser::bot_detected() ) {
47
+ $iubenda = new iubendaParser( $html, array( 'type' => in_array( $type, array( 'page', 'faster' ), true ) ? $type : 'page' ) );
48
+ $html = $iubenda->parse();
49
+ }
50
+
51
+ // finished
52
+ return $html;
53
+ }
54
+ ```
55
+
56
+ The `iubenda_system` method verifies if the page visitor consents to the use of cookies. If they have consented, the script returns the HTML provided as a parameter without taking any action such as parsing/replacing.
57
+ Simply copy your method into the PHP document and then call it with the following syntax `iubenda_system("contenutohtml");` that will return the code.
58
+
59
+ * Parsing/replacing the portions of code contained within `<!--IUB-COOKIE-BLOCK-START-->` and `<!--IUB-COOKIE-BLOCK-END-->`
60
+ * Automatic parsing/replacing of iframe that contain defined src
61
+ * Automatic parsing/replacing of scripts that contain defined src
62
+
63
+ These operations take place in accordance with the rules explained in [this guide](https://www.iubenda.com/en/help/posts/1229). We suggest that you consult the posts relating to the alteration of script, img and iframe tags.
64
+
65
+ As a last step the script invokes the `get_converted_page()` of the Page object and returns the page modified in such a way that no cookie will be generated.
66
+
67
+ ## Additional Help and docs
68
+
69
+ * [Full Cookie Solution Documentation](https://www.iubenda.com/en/help/1205-technical-documentation-for-the-cookie-law-solution-banner-cookie-policy-and-consent-management)
70
+ * [Prior Blocking Guide](https://www.iubenda.com/en/help/1229-cookie-law-solution-preventing-code-execution-that-could-install-cookies)
71
+ * [Cookie Solution Feature Overview](https://www.iubenda.com/en/features#cookie-solution)
72
+
73
+ ## Changelog
74
+
75
+ ##### 3.0.0
76
+ * Tweak: Update and unify iubenda parsing engine
77
+
78
+ ### License
79
+
80
+ This project is licensed under the GPl 3 license.
iubenda-cookie-class/composer.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "iubenda/iubenda-cookie-class",
3
+ "type": "project",
4
+ "description": "PHP class for the cookie law solution",
5
+ "keywords": ["cookie","gdpr"],
6
+ "homepage": "https://github.com/iubenda/iubenda-cookie-class",
7
+ "license": "MIT",
8
+ "require": {
9
+ "php": ">=5.2.4"
10
+ }
11
+ }
iubenda-cookie-class/iubenda.class.faster.php CHANGED
@@ -3,6 +3,7 @@
3
  * iubenda.class.php
4
  * version: 2.0.3
5
  * codename: Faster
 
6
  * @author: Copyright 2018 iubenda
7
  * @license GNU/GPL
8
  * This program is free software: you can redistribute it and/or modify
3
  * iubenda.class.php
4
  * version: 2.0.3
5
  * codename: Faster
6
+ * @deprecated
7
  * @author: Copyright 2018 iubenda
8
  * @license GNU/GPL
9
  * This program is free software: you can redistribute it and/or modify
iubenda-cookie-class/iubenda.class.page.php ADDED
@@ -0,0 +1,383 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * iubenda.class.php
4
+ * version: 1.0.3
5
+ * codename: Page
6
+ * @deprecated
7
+ * @author: Copyright 2018 iubenda
8
+ * @license GNU/GPL
9
+ * This program is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ *
20
+ * You should have received a copy of the GNU General Public License
21
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
22
+ */
23
+
24
+ class iubendaPage {
25
+
26
+ // variables
27
+ const IUB_REGEX_PATTERN = '/<!--\s*IUB_COOKIE_POLICY_START\s*-->(.*?)<!--\s*IUB_COOKIE_POLICY_END\s*-->/s';
28
+ const IUB_REGEX_PATTERN_2 = '/<!--\s*IUB-COOKIE-BLOCK-START\s*-->(.*?)<!--\s*IUB-COOKIE-BLOCK-END\s*-->/s';
29
+
30
+ public $auto_script_tags = array(
31
+ 'platform.twitter.com/widgets.js',
32
+ 'apis.google.com/js/plusone.js',
33
+ 'apis.google.com/js/platform.js',
34
+ 'connect.facebook.net',
35
+ 'www.youtube.com/iframe_api',
36
+ 'pagead2.googlesyndication.com/pagead/js/adsbygoogle.js',
37
+ 'sharethis.com/button/buttons.js',
38
+ 'addthis.com/js/',
39
+ 'window.adsbygoogle'
40
+ );
41
+ public $auto_iframe_tags = array(
42
+ 'youtube.com',
43
+ 'platform.twitter.com',
44
+ 'www.facebook.com/plugins/like.php',
45
+ 'www.facebook.com/plugins/likebox.php',
46
+ 'apis.google.com',
47
+ 'www.google.com/maps/embed/',
48
+ 'player.vimeo.com/video',
49
+ 'maps.google.it/maps',
50
+ 'www.google.com/maps/embed',
51
+ 'window.adsbygoogle'
52
+ );
53
+ public $iub_comments_detected = array();
54
+ public $iframe_detected = array();
55
+ public $iframe_converted = array();
56
+ public $scripts_detected = array();
57
+ public $scripts_inline_detected = array();
58
+ public $scripts_inline_converted = array();
59
+ public $scripts_converted = array();
60
+
61
+ /**
62
+ * Construct: the whole HTML output of the page
63
+ *
64
+ * @param mixed $content_page
65
+ */
66
+ public function __construct( $content_page ) {
67
+ $this->original_content_page = $content_page;
68
+ $this->content_page = $content_page;
69
+ }
70
+
71
+ /**
72
+ * Print iubenda banner, parameter: the script code of iubenda to print the banner
73
+ *
74
+ * @param string $banner
75
+ * @return string
76
+ */
77
+ public function print_banner( $banner ) {
78
+ return $banner .= "\n
79
+ <script>
80
+ var iCallback = function(){};
81
+
82
+ if('callback' in _iub.csConfiguration) {
83
+ if('onConsentGiven' in _iub.csConfiguration.callback) iCallback = _iub.csConfiguration.callback.onConsentGiven;
84
+
85
+ _iub.csConfiguration.callback.onConsentGiven = function()
86
+ {
87
+ iCallback();
88
+
89
+ /*
90
+ * Separator
91
+ */
92
+
93
+ jQuery('noscript._no_script_iub').each(function (a, b) { var el = jQuery(b); el.after(el.html()); });
94
+ };
95
+ };
96
+ </script>";
97
+ }
98
+
99
+ /**
100
+ * Static, detect bot & crawler
101
+ *
102
+ * @return bool
103
+ */
104
+ static function bot_detected() {
105
+ return ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/bot|crawl|slurp|spider|google|yahoo/i', $_SERVER['HTTP_USER_AGENT'] ) );
106
+ }
107
+
108
+ /**
109
+ * Static, utility function: Return true if the user has already given consent on the page
110
+ *
111
+ * @return boolean
112
+ */
113
+ static function consent_given() {
114
+ foreach ( $_COOKIE as $key => $value ) {
115
+ if ( iubendaPage::strpos_array( $key, array( '_iub_cs-s', '_iub_cs' ) ) ) {
116
+ return true;
117
+ }
118
+ }
119
+ return false;
120
+ }
121
+
122
+ /**
123
+ * Static, utility function: strpos for array
124
+ *
125
+ * @param type $haystack
126
+ * @param type $needle
127
+ * @return boolean
128
+ */
129
+ static function strpos_array( $haystack, $needle ) {
130
+ if ( is_array( $needle ) ) {
131
+ foreach ( $needle as $need ) {
132
+ if ( strpos( $haystack, $need ) !== false ) {
133
+ return true;
134
+ }
135
+ }
136
+ } else {
137
+ if ( strpos( $haystack, $need ) !== false ) {
138
+ return true;
139
+ }
140
+ }
141
+ return false;
142
+ }
143
+
144
+ /**
145
+ * Convert scripts, iframe and other code inside IUBENDAs comment in text/plain to not generate cookies
146
+ *
147
+ * @param mixed $html
148
+ * @return mixed
149
+ */
150
+ public function create_tags( $html ) {
151
+
152
+ $elements = $html->find( "*" );
153
+ $js = '';
154
+
155
+ if ( is_array( $elements ) ) {
156
+ $count = count( $elements );
157
+ for ( $j = 0; $j < $count; $j ++ ) {
158
+ $e = $elements[$j];
159
+ switch ( $e->tag ) {
160
+ case 'script':
161
+ $class = $e->class;
162
+ $e->class = $class . ' _iub_cs_activate';
163
+ $e->type = 'text/plain';
164
+ $js .= $e->outertext;
165
+ break;
166
+
167
+ case 'iframe':
168
+ $new_src = "//cdn.iubenda.com/cookie_solution/empty.html";
169
+ $class = $e->class;
170
+ $e->suppressedsrc = $e->src;
171
+ $e->src = $new_src;
172
+ $e->class = $class . ' _iub_cs_activate';
173
+ $js .= $e->outertext;
174
+ break;
175
+
176
+ default:
177
+ $js = $html;
178
+ break;
179
+ }
180
+ }
181
+ }
182
+ return $js;
183
+ }
184
+
185
+ /**
186
+ * Parse all IUBENDAs comment and convert the code inside with create_tags method
187
+ */
188
+ public function parse_iubenda_comments() {
189
+ foreach ( array( 'IUB_REGEX_PATTERN', 'IUB_REGEX_PATTERN_2' ) as $pattern ) {
190
+ preg_match_all( constant( 'self::' . $pattern ), $this->content_page, $scripts );
191
+
192
+ if ( is_array( $scripts[1] ) ) {
193
+ $count = count( $scripts[1] );
194
+ $js_scripts = array();
195
+ for ( $j = 0; $j < $count; $j ++ ) {
196
+ $this->iub_comments_detected[] = $scripts[1][$j];
197
+ $html = str_get_html( $scripts[1][$j], $lowercase = true, $forceTagsClosed = true, $stripRN = false );
198
+ $js_scripts[] = $this->create_tags( $html );
199
+ }
200
+
201
+ if ( is_array( $scripts[1] ) && is_array( $js_scripts ) ) {
202
+ if ( count( $scripts[1] ) >= 1 && count( $js_scripts ) >= 1 ) {
203
+ $this->content_page = strtr( $this->content_page, array_combine( $scripts[1], $js_scripts ) );
204
+ }
205
+ }
206
+ }
207
+ }
208
+ }
209
+
210
+ /**
211
+ * Parse automatically all the scripts in the page and converts it in text/plain
212
+ * if src or the whole output has inside one of the elements in $auto_script_tags array
213
+ */
214
+ public function parse_scripts() {
215
+ $html = str_get_html( $this->content_page, $lowercase = true, $forceTagsClosed = true, $stripRN = false );
216
+
217
+ if ( is_object( $html ) ) {
218
+ $scripts = $html->find( "script" );
219
+ if ( is_array( $scripts ) ) {
220
+ $count = count( $scripts );
221
+ for ( $j = 0; $j < $count; $j ++ ) {
222
+ $s = $scripts[$j];
223
+ if ( ! empty( $s->innertext ) ) {
224
+ $this->scripts_detected[] = $s->innertext;
225
+ if ( iubendaPage::strpos_array( $s->innertext, $this->auto_script_tags ) !== false ) {
226
+ $class = $s->class;
227
+ $s->class = $class . ' _iub_cs_activate-inline';
228
+ $s->type = 'text/plain';
229
+ $this->scripts_converted[] = $s->innertext;
230
+ }
231
+ } else {
232
+ $src = $s->src;
233
+ if ( $src ) {
234
+ $this->scripts_inline_detected[] = $src;
235
+ if ( iubendaPage::strpos_array( $src, $this->auto_script_tags ) !== false ) {
236
+ $class = $s->class;
237
+ $s->class = $class . ' _iub_cs_activate';
238
+ $s->type = 'text/plain';
239
+ $this->scripts_inline_converted[] = $src;
240
+ }
241
+ }
242
+ }
243
+ }
244
+ }
245
+
246
+ // AdSense check by Peste Vasile Alexandru, AdSense here
247
+ $ad_found = false;
248
+
249
+ while ( preg_match( "#google_ad_client =(.*?);#i", $html ) ) {
250
+ $ad_found = true;
251
+ $ad_client = null;
252
+ $ad_slot = null;
253
+ $ad_width = null;
254
+ $ad_height = null;
255
+ $ad_block = null;
256
+
257
+ preg_match( "#google_ad_client =(.*?);#i", $html, $ad_client );
258
+ preg_match( "#google_ad_slot =(.*?);#i", $html, $ad_slot );
259
+ preg_match( "#google_ad_width =(.*?);#i", $html, $ad_width );
260
+ preg_match( "#google_ad_height =(.*?);#i", $html, $ad_height );
261
+
262
+ $html = preg_replace( "#google_ad_client =(.*?);#i", "", $html, 1 );
263
+ $html = preg_replace( "#google_ad_slot =(.*?);#i", "", $html, 1 );
264
+ $html = preg_replace( "#google_ad_width =(.*?);#i", "", $html, 1 );
265
+ $html = preg_replace( "#google_ad_height =(.*?);#i", "", $html, 1 );
266
+
267
+ $ad_client = trim( $ad_client[1] );
268
+ $ad_slot = trim( $ad_slot[1] );
269
+ $ad_width = trim( $ad_width[1] );
270
+ $ad_height = trim( $ad_height[1] );
271
+
272
+ $ad_class = 'class="_iub_cs_activate_google_ads"';
273
+ $ad_style = 'style="width:' . $ad_width . 'px; height:' . $ad_height . 'px;"';
274
+
275
+ $ad_client = 'data-client=' . $ad_client;
276
+ $ad_slot = 'data-slot=' . $ad_slot;
277
+ $ad_width = 'data-width="' . $ad_width . '"';
278
+ $ad_height = 'data-height="' . $ad_height . '"';
279
+
280
+ $ad_block = "<div $ad_style $ad_class $ad_width $ad_height $ad_slot $ad_client></div>";
281
+
282
+ $html = preg_replace( '#(<[^>]+) src="//pagead2.googlesyndication.com/pagead/show_ads.js"(.*?)</script>#i', $ad_block, $html, 1 );
283
+ }
284
+
285
+ if ( $ad_found ) {
286
+ $adsense_callback = "
287
+ <script>
288
+ function iubenda_adsense_unblock(){
289
+ var t = 1;
290
+ jQuery('._iub_cs_activate_google_ads').each(function() {
291
+ var banner = jQuery(this);
292
+ setTimeout(function(){
293
+ var client = banner.data('client');
294
+ var slot = banner.data('slot');
295
+ var width = banner.data('width');
296
+ var height = banner.data('height');
297
+ var adsense_script = '<scr'+'ipt>'
298
+ + 'google_ad_client = " . chr( 34 ) . "'+client+'" . chr( 34 ) . ";'
299
+ + 'google_ad_slot = '+slot+';'
300
+ + 'google_ad_width = '+width+';'
301
+ + 'google_ad_height = '+height+';'
302
+ + '</scr'+'ipt>';
303
+ var script = document.createElement('script');
304
+ var ads = document.createElement('ads');
305
+ var w = document.write;
306
+ script.setAttribute('type', 'text/javascript');
307
+ script.setAttribute('src', 'http://pagead2.googlesyndication.com/pagead/show_ads.js');
308
+ document.write = (function(params) {
309
+ ads.innerHTML = params;
310
+ document.write = w;
311
+ });
312
+ banner.html(adsense_script).append(ads).append(script);
313
+ }, t);
314
+ t += 300;
315
+ });
316
+ }
317
+ if('callback' in _iub.csConfiguration) {
318
+ _iub.csConfiguration.callback.onConsentGiven = iubenda_adsense_unblock;
319
+ }
320
+ else
321
+ {
322
+ _iub.csConfiguration.callback = {};
323
+
324
+ _iub.csConfiguration.callback.onConsentGiven = iubenda_adsense_unblock;
325
+ }
326
+ </script>
327
+ ";
328
+
329
+ $html = str_replace( "</body>", $adsense_callback . "</body>", $html );
330
+ }
331
+
332
+ $this->content_page = $html;
333
+ }
334
+ }
335
+
336
+ /**
337
+ * Parse automatically all the iframe in the page and change the src to suppressedsrc
338
+ * if src has inside one of the elements in $auto_iframe_tags array
339
+ */
340
+ public function parse_iframe() {
341
+ $html = str_get_html( $this->content_page, $lowercase = true, $forceTagsClosed = true, $stripRN = false );
342
+
343
+ if ( is_object( $html ) ) {
344
+ $iframes = $html->find( "iframe" );
345
+ if ( is_array( $iframes ) ) {
346
+ $count = count( $iframes );
347
+ for ( $j = 0; $j < $count; $j ++ ) {
348
+ $i = $iframes[$j];
349
+ $src = $i->src;
350
+ $this->iframe_detected[] = $src;
351
+ if ( iubendaPage::strpos_array( $src, $this->auto_iframe_tags ) !== false ) {
352
+ $new_src = "//cdn.iubenda.com/cookie_solution/empty.html";
353
+ $class = $i->class;
354
+ $i->suppressedsrc = $src;
355
+ $i->src = $new_src;
356
+ $i->class = $class . ' _iub_cs_activate';
357
+ $this->iframe_converted[] = $src;
358
+ }
359
+ }
360
+ }
361
+ $this->content_page = $html;
362
+ }
363
+ }
364
+
365
+ /**
366
+ * Call three methods to parse the page, iubendas comment, scripts + iframe
367
+ */
368
+ public function parse() {
369
+ $this->parse_iubenda_comments();
370
+ $this->parse_scripts();
371
+ $this->parse_iframe();
372
+ }
373
+
374
+ /**
375
+ * Return the final page to output
376
+ *
377
+ * @return mixed
378
+ */
379
+ public function get_converted_page() {
380
+ return $this->content_page;
381
+ }
382
+
383
+ }
iubenda-cookie-class/iubenda.class.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * iubenda.class.php
4
- * version: 1.0.3
5
  * @author: Copyright 2018 iubenda
6
  * @license GNU/GPL
7
  * This program is free software: you can redistribute it and/or modify
@@ -11,20 +11,20 @@
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
- *
18
  * You should have received a copy of the GNU General Public License
19
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
  */
21
 
22
- class iubendaPage {
23
 
24
  // variables
25
  const IUB_REGEX_PATTERN = '/<!--\s*IUB_COOKIE_POLICY_START\s*-->(.*?)<!--\s*IUB_COOKIE_POLICY_END\s*-->/s';
26
  const IUB_REGEX_PATTERN_2 = '/<!--\s*IUB-COOKIE-BLOCK-START\s*-->(.*?)<!--\s*IUB-COOKIE-BLOCK-END\s*-->/s';
27
 
 
28
  public $auto_script_tags = array(
29
  'platform.twitter.com/widgets.js',
30
  'apis.google.com/js/plusone.js',
@@ -36,62 +36,57 @@ class iubendaPage {
36
  'addthis.com/js/',
37
  'window.adsbygoogle'
38
  );
 
 
39
  public $auto_iframe_tags = array(
40
  'youtube.com',
41
  'platform.twitter.com',
42
  'www.facebook.com/plugins/like.php',
43
  'www.facebook.com/plugins/likebox.php',
44
  'apis.google.com',
45
- 'www.google.com/maps/embed/',
46
  'player.vimeo.com/video',
47
  'maps.google.it/maps',
48
  'www.google.com/maps/embed',
49
  'window.adsbygoogle'
50
  );
 
 
51
  public $iub_comments_detected = array();
52
- public $iframe_detected = array();
53
- public $iframe_converted = array();
54
  public $scripts_detected = array();
 
55
  public $scripts_inline_detected = array();
56
  public $scripts_inline_converted = array();
57
- public $scripts_converted = array();
 
 
58
 
59
  /**
60
  * Construct: the whole HTML output of the page
61
  *
62
  * @param mixed $content_page
 
63
  */
64
- public function __construct( $content_page ) {
65
- $this->original_content_page = $content_page;
66
- $this->content_page = $content_page;
67
- }
68
-
69
- /**
70
- * Print iubenda banner, parameter: the script code of iubenda to print the banner
71
- *
72
- * @param string $banner
73
- * @return string
74
- */
75
- public function print_banner( $banner ) {
76
- return $banner .= "\n
77
- <script>
78
- var iCallback = function(){};
79
 
80
- if('callback' in _iub.csConfiguration) {
81
- if('onConsentGiven' in _iub.csConfiguration.callback) iCallback = _iub.csConfiguration.callback.onConsentGiven;
 
82
 
83
- _iub.csConfiguration.callback.onConsentGiven = function()
84
- {
85
- iCallback();
86
 
87
- /*
88
- * Separator
89
- */
90
 
91
- jQuery('noscript._no_script_iub').each(function (a, b) { var el = jQuery(b); el.after(el.html()); });
92
- };
93
- };
94
- </script>";
95
  }
96
 
97
  /**
@@ -110,10 +105,10 @@ if('callback' in _iub.csConfiguration) {
110
  */
111
  static function consent_given() {
112
  foreach ( $_COOKIE as $key => $value ) {
113
- if ( iubendaPage::strpos_array( $key, array( '_iub_cs-s', '_iub_cs' ) ) ) {
114
  return true;
115
- }
116
  }
 
117
  return false;
118
  }
119
 
@@ -125,248 +120,389 @@ if('callback' in _iub.csConfiguration) {
125
  * @return boolean
126
  */
127
  static function strpos_array( $haystack, $needle ) {
 
 
 
128
  if ( is_array( $needle ) ) {
129
  foreach ( $needle as $need ) {
130
- if ( strpos( $haystack, $need ) !== false ) {
131
  return true;
132
- }
133
  }
134
  } else {
135
- if ( strpos( $haystack, $need ) !== false ) {
136
  return true;
137
- }
138
  }
 
139
  return false;
140
  }
141
 
142
  /**
143
  * Convert scripts, iframe and other code inside IUBENDAs comment in text/plain to not generate cookies
144
  *
145
- * @param mixed $html
146
  * @return mixed
147
  */
148
- public function create_tags( $html ) {
149
-
150
- $elements = $html->find( "*" );
151
  $js = '';
152
 
153
  if ( is_array( $elements ) ) {
154
  $count = count( $elements );
155
- for ( $j = 0; $j < $count; $j ++ ) {
 
156
  $e = $elements[$j];
 
157
  switch ( $e->tag ) {
158
  case 'script':
159
  $class = $e->class;
160
- $e->class = $class . ' _iub_cs_activate';
161
  $e->type = 'text/plain';
162
  $js .= $e->outertext;
163
  break;
164
 
165
  case 'iframe':
166
- $new_src = "//cdn.iubenda.com/cookie_solution/empty.html";
167
  $class = $e->class;
168
  $e->suppressedsrc = $e->src;
169
  $e->src = $new_src;
170
- $e->class = $class . ' _iub_cs_activate';
171
  $js .= $e->outertext;
172
  break;
173
 
174
  default:
175
- $js = $html;
176
  break;
177
  }
178
  }
179
  }
 
180
  return $js;
181
  }
182
 
183
  /**
184
- * Parse all IUBENDAs comment and convert the code inside with create_tags method
 
 
 
185
  */
186
- public function parse_iubenda_comments() {
187
- foreach ( array( 'IUB_REGEX_PATTERN', 'IUB_REGEX_PATTERN_2' ) as $pattern ) {
188
- preg_match_all( constant( 'self::' . $pattern ), $this->content_page, $scripts );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
 
190
- if ( is_array( $scripts[1] ) ) {
191
- $count = count( $scripts[1] );
192
- $js_scripts = array();
193
- for ( $j = 0; $j < $count; $j ++ ) {
194
- $this->iub_comments_detected[] = $scripts[1][$j];
195
- $html = str_get_html( $scripts[1][$j], $lowercase = true, $forceTagsClosed = true, $stripRN = false );
196
- $js_scripts[] = $this->create_tags( $html );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  }
 
198
 
199
- if ( is_array( $scripts[1] ) && is_array( $js_scripts ) ) {
200
- if ( count( $scripts[1] ) >= 1 && count( $js_scripts ) >= 1 ) {
201
- $this->content_page = strtr( $this->content_page, array_combine( $scripts[1], $js_scripts ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
203
  }
204
- }
 
 
 
 
 
 
 
 
205
  }
206
  }
207
 
208
  /**
209
- * Parse automatically all the scripts in the page and converts it in text/plain
210
- * if src or the whole output has inside one of the elements in $auto_script_tags array
 
 
211
  */
212
- public function parse_scripts() {
213
- $html = str_get_html( $this->content_page, $lowercase = true, $forceTagsClosed = true, $stripRN = false );
214
-
215
- if ( is_object( $html ) ) {
216
- $scripts = $html->find( "script" );
217
- if ( is_array( $scripts ) ) {
218
- $count = count( $scripts );
219
- for ( $j = 0; $j < $count; $j ++ ) {
220
- $s = $scripts[$j];
221
- if ( ! empty( $s->innertext ) ) {
222
- $this->scripts_detected[] = $s->innertext;
223
- if ( iubendaPage::strpos_array( $s->innertext, $this->auto_script_tags ) !== false ) {
224
- $class = $s->class;
225
- $s->class = $class . ' _iub_cs_activate-inline';
226
- $s->type = 'text/plain';
227
- $this->scripts_converted[] = $s->innertext;
228
- }
229
- } else {
230
- $src = $s->src;
231
- if ( $src ) {
232
- $this->scripts_inline_detected[] = $src;
233
- if ( iubendaPage::strpos_array( $src, $this->auto_script_tags ) !== false ) {
234
- $class = $s->class;
235
- $s->class = $class . ' _iub_cs_activate';
236
- $s->type = 'text/plain';
237
- $this->scripts_inline_converted[] = $src;
238
  }
239
  }
240
  }
 
 
241
  }
242
- }
243
 
244
- // AdSense check by Peste Vasile Alexandru, AdSense here
245
- $ad_found = false;
246
 
247
- while ( preg_match( "#google_ad_client =(.*?);#i", $html ) ) {
248
- $ad_found = true;
249
- $ad_client = null;
250
- $ad_slot = null;
251
- $ad_width = null;
252
- $ad_height = null;
253
- $ad_block = null;
254
 
255
- preg_match( "#google_ad_client =(.*?);#i", $html, $ad_client );
256
- preg_match( "#google_ad_slot =(.*?);#i", $html, $ad_slot );
257
- preg_match( "#google_ad_width =(.*?);#i", $html, $ad_width );
258
- preg_match( "#google_ad_height =(.*?);#i", $html, $ad_height );
259
 
260
- $html = preg_replace( "#google_ad_client =(.*?);#i", "", $html, 1 );
261
- $html = preg_replace( "#google_ad_slot =(.*?);#i", "", $html, 1 );
262
- $html = preg_replace( "#google_ad_width =(.*?);#i", "", $html, 1 );
263
- $html = preg_replace( "#google_ad_height =(.*?);#i", "", $html, 1 );
264
 
265
- $ad_client = trim( $ad_client[1] );
266
- $ad_slot = trim( $ad_slot[1] );
267
- $ad_width = trim( $ad_width[1] );
268
- $ad_height = trim( $ad_height[1] );
269
 
270
- $ad_class = 'class="_iub_cs_activate_google_ads"';
271
- $ad_style = 'style="width:' . $ad_width . 'px; height:' . $ad_height . 'px;"';
272
 
273
- $ad_client = 'data-client=' . $ad_client;
274
- $ad_slot = 'data-slot=' . $ad_slot;
275
- $ad_width = 'data-width="' . $ad_width . '"';
276
- $ad_height = 'data-height="' . $ad_height . '"';
277
 
278
- $ad_block = "<div $ad_style $ad_class $ad_width $ad_height $ad_slot $ad_client></div>";
 
279
 
280
- $html = preg_replace( '#(<[^>]+) src="//pagead2.googlesyndication.com/pagead/show_ads.js"(.*?)</script>#i', $ad_block, $html, 1 );
281
- }
 
 
282
 
283
- if ( $ad_found ) {
284
- $adsense_callback = "
285
- <script>
286
- function iubenda_adsense_unblock(){
287
- var t = 1;
288
- jQuery('._iub_cs_activate_google_ads').each(function() {
289
- var banner = jQuery(this);
290
- setTimeout(function(){
291
- var client = banner.data('client');
292
- var slot = banner.data('slot');
293
- var width = banner.data('width');
294
- var height = banner.data('height');
295
- var adsense_script = '<scr'+'ipt>'
296
- + 'google_ad_client = " . chr( 34 ) . "'+client+'" . chr( 34 ) . ";'
297
- + 'google_ad_slot = '+slot+';'
298
- + 'google_ad_width = '+width+';'
299
- + 'google_ad_height = '+height+';'
300
- + '</scr'+'ipt>';
301
- var script = document.createElement('script');
302
- var ads = document.createElement('ads');
303
- var w = document.write;
304
- script.setAttribute('type', 'text/javascript');
305
- script.setAttribute('src', 'http://pagead2.googlesyndication.com/pagead/show_ads.js');
306
- document.write = (function(params) {
307
- ads.innerHTML = params;
308
- document.write = w;
309
- });
310
- banner.html(adsense_script).append(ads).append(script);
311
- }, t);
312
- t += 300;
313
- });
314
- }
315
- if('callback' in _iub.csConfiguration) {
316
- _iub.csConfiguration.callback.onConsentGiven = iubenda_adsense_unblock;
317
- }
318
- else
319
- {
320
- _iub.csConfiguration.callback = {};
321
-
322
- _iub.csConfiguration.callback.onConsentGiven = iubenda_adsense_unblock;
323
- }
324
- </script>
325
- ";
326
-
327
- $html = str_replace( "</body>", $adsense_callback . "</body>", $html );
328
- }
329
 
330
- $this->content_page = $html;
 
 
 
 
 
 
 
331
  }
332
  }
333
 
334
  /**
335
- * Parse automatically all the iframe in the page and change the src to suppressedsrc
336
- * if src has inside one of the elements in $auto_iframe_tags array
 
337
  */
338
- public function parse_iframe() {
339
- $html = str_get_html( $this->content_page, $lowercase = true, $forceTagsClosed = true, $stripRN = false );
340
-
341
- if ( is_object( $html ) ) {
342
- $iframes = $html->find( "iframe" );
343
- if ( is_array( $iframes ) ) {
344
- $count = count( $iframes );
345
- for ( $j = 0; $j < $count; $j ++ ) {
346
- $i = $iframes[$j];
347
- $src = $i->src;
348
- $this->iframe_detected[] = $src;
349
- if ( iubendaPage::strpos_array( $src, $this->auto_iframe_tags ) !== false ) {
350
- $new_src = "//cdn.iubenda.com/cookie_solution/empty.html";
351
- $class = $i->class;
352
- $i->suppressedsrc = $src;
353
- $i->src = $new_src;
354
- $i->class = $class . ' _iub_cs_activate';
355
- $this->iframe_converted[] = $src;
 
 
356
  }
357
  }
358
  }
359
- $this->content_page = $html;
360
  }
361
  }
362
 
363
  /**
364
- * Call three methods to parse the page, iubendas comment, scripts + iframe
 
 
365
  */
366
  public function parse() {
367
- $this->parse_iubenda_comments();
368
  $this->parse_scripts();
369
- $this->parse_iframe();
 
 
370
  }
371
 
372
  /**
@@ -378,4 +514,27 @@ if('callback' in _iub.csConfiguration) {
378
  return $this->content_page;
379
  }
380
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  }
1
  <?php
2
  /**
3
  * iubenda.class.php
4
+ * version: 3.0.0
5
  * @author: Copyright 2018 iubenda
6
  * @license GNU/GPL
7
  * This program is free software: you can redistribute it and/or modify
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 iubendaParser {
22
 
23
  // variables
24
  const IUB_REGEX_PATTERN = '/<!--\s*IUB_COOKIE_POLICY_START\s*-->(.*?)<!--\s*IUB_COOKIE_POLICY_END\s*-->/s';
25
  const IUB_REGEX_PATTERN_2 = '/<!--\s*IUB-COOKIE-BLOCK-START\s*-->(.*?)<!--\s*IUB-COOKIE-BLOCK-END\s*-->/s';
26
 
27
+ // scripts
28
  public $auto_script_tags = array(
29
  'platform.twitter.com/widgets.js',
30
  'apis.google.com/js/plusone.js',
36
  'addthis.com/js/',
37
  'window.adsbygoogle'
38
  );
39
+
40
+ // iframes
41
  public $auto_iframe_tags = array(
42
  'youtube.com',
43
  'platform.twitter.com',
44
  'www.facebook.com/plugins/like.php',
45
  'www.facebook.com/plugins/likebox.php',
46
  'apis.google.com',
 
47
  'player.vimeo.com/video',
48
  'maps.google.it/maps',
49
  'www.google.com/maps/embed',
50
  'window.adsbygoogle'
51
  );
52
+
53
+ private $type = 'page';
54
  public $iub_comments_detected = array();
55
+ public $iframes_detected = array();
56
+ public $iframes_converted = array();
57
  public $scripts_detected = array();
58
+ public $scripts_converted = array();
59
  public $scripts_inline_detected = array();
60
  public $scripts_inline_converted = array();
61
+ private $iub_empty = '//cdn.iubenda.com/cookie_solution/empty.html';
62
+ private $iub_class = '_iub_cs_activate';
63
+ private $iub_class_inline = '_iub_cs_activate-inline';
64
 
65
  /**
66
  * Construct: the whole HTML output of the page
67
  *
68
  * @param mixed $content_page
69
+ * @param array $args
70
  */
71
+ public function __construct( $content_page = '', $args = array() ) {
72
+ // check scripts
73
+ if ( ! empty( $args['scripts'] ) && is_array( $args['scripts'] ) )
74
+ $this->auto_script_tags = array_unique( array_merge( $this->auto_script_tags, $args['scripts'] ) );
 
 
 
 
 
 
 
 
 
 
 
75
 
76
+ // check iframes
77
+ if ( ! empty( $args['iframes'] ) && is_array( $args['iframes'] ) )
78
+ $this->auto_iframe_tags = array_unique( array_merge( $this->auto_iframe_tags, $args['iframes'] ) );
79
 
80
+ // valid type?
81
+ $this->type = ! empty( $args['type'] ) && in_array( $args['type'], array( 'page', 'faster' ), true ) ? $args['type'] : 'page';
 
82
 
83
+ // load Simple HTML DOM if needed
84
+ if ( ! function_exists( 'file_get_html' ) )
85
+ require_once( dirname( __FILE__ ) . '/simple_html_dom.php' );
86
 
87
+ // set content
88
+ $this->original_content_page = $content_page;
89
+ $this->content_page = $content_page;
 
90
  }
91
 
92
  /**
105
  */
106
  static function consent_given() {
107
  foreach ( $_COOKIE as $key => $value ) {
108
+ if ( self::strpos_array( $key, array( '_iub_cs-s', '_iub_cs' ) ) )
109
  return true;
 
110
  }
111
+
112
  return false;
113
  }
114
 
120
  * @return boolean
121
  */
122
  static function strpos_array( $haystack, $needle ) {
123
+ if ( empty( $haystack ) || empty( $needle ) )
124
+ return false;
125
+
126
  if ( is_array( $needle ) ) {
127
  foreach ( $needle as $need ) {
128
+ if ( strpos( $haystack, $need ) !== false )
129
  return true;
 
130
  }
131
  } else {
132
+ if ( strpos( $haystack, $need ) !== false )
133
  return true;
 
134
  }
135
+
136
  return false;
137
  }
138
 
139
  /**
140
  * Convert scripts, iframe and other code inside IUBENDAs comment in text/plain to not generate cookies
141
  *
142
+ * @param mixed $content
143
  * @return mixed
144
  */
145
+ public function create_tags( $content ) {
146
+ $elements = $content->find( "*" );
 
147
  $js = '';
148
 
149
  if ( is_array( $elements ) ) {
150
  $count = count( $elements );
151
+
152
+ for ( $j = 0; $j < $count; $j++ ) {
153
  $e = $elements[$j];
154
+
155
  switch ( $e->tag ) {
156
  case 'script':
157
  $class = $e->class;
158
+ $e->class = $class . ' ' . $this->iub_class;
159
  $e->type = 'text/plain';
160
  $js .= $e->outertext;
161
  break;
162
 
163
  case 'iframe':
164
+ $new_src = $this->iub_empty;
165
  $class = $e->class;
166
  $e->suppressedsrc = $e->src;
167
  $e->src = $new_src;
168
+ $e->class = $class . ' ' . $this->iub_class;
169
  $js .= $e->outertext;
170
  break;
171
 
172
  default:
173
+ $js = $content;
174
  break;
175
  }
176
  }
177
  }
178
+
179
  return $js;
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
+ *
186
+ * @return void
187
  */
188
+ public function parse_scripts() {
189
+ switch ( $this->type ) {
190
+ case 'page':
191
+ $html = str_get_html( $this->content_page, $lowercase = true, $force_tags_closed = true, $strip = false );
192
+
193
+ if ( is_object( $html ) ) {
194
+ $scripts = $html->find( 'script' );
195
+
196
+ if ( is_array( $scripts ) ) {
197
+ $count = count( $scripts );
198
+
199
+ for ( $j = 0; $j < $count; $j ++ ) {
200
+ $s = $scripts[$j];
201
+
202
+ if ( ! empty( $s->innertext ) ) {
203
+ $this->scripts_inline_detected[] = $s->innertext;
204
+
205
+ if ( self::strpos_array( $s->innertext, $this->auto_script_tags ) !== false ) {
206
+ $class = $s->class;
207
+ $s->class = $class . ' ' . $this->iub_class_inline;
208
+ $s->type = 'text/plain';
209
+ $this->scripts_inline_converted[] = $s->innertext;
210
+ }
211
+ } else {
212
+ $src = $s->src;
213
+
214
+ if ( $src ) {
215
+ $this->scripts_detected[] = $src;
216
+
217
+ if ( self::strpos_array( $src, $this->auto_script_tags ) !== false ) {
218
+ $class = $s->class;
219
+ $s->class = $class . ' ' . $this->iub_class;
220
+ $s->type = 'text/plain';
221
+ $this->scripts_converted[] = $src;
222
+ }
223
+ }
224
+ }
225
+ }
226
+ }
227
 
228
+ // AdSense check by Peste Vasile Alexandru, AdSense here
229
+ $ad_found = false;
230
+
231
+ while ( preg_match( "#google_ad_client =(.*?);#i", $html ) ) {
232
+ $ad_found = true;
233
+ $ad_client = null;
234
+ $ad_slot = null;
235
+ $ad_width = null;
236
+ $ad_height = null;
237
+ $ad_block = null;
238
+
239
+ preg_match( "#google_ad_client =(.*?);#i", $html, $ad_client );
240
+ preg_match( "#google_ad_slot =(.*?);#i", $html, $ad_slot );
241
+ preg_match( "#google_ad_width =(.*?);#i", $html, $ad_width );
242
+ preg_match( "#google_ad_height =(.*?);#i", $html, $ad_height );
243
+
244
+ $html = preg_replace( "#google_ad_client =(.*?);#i", "", $html, 1 );
245
+ $html = preg_replace( "#google_ad_slot =(.*?);#i", "", $html, 1 );
246
+ $html = preg_replace( "#google_ad_width =(.*?);#i", "", $html, 1 );
247
+ $html = preg_replace( "#google_ad_height =(.*?);#i", "", $html, 1 );
248
+
249
+ $ad_client = trim( $ad_client[1] );
250
+ $ad_slot = trim( $ad_slot[1] );
251
+ $ad_width = trim( $ad_width[1] );
252
+ $ad_height = trim( $ad_height[1] );
253
+
254
+ $ad_class = 'class="' . $this->iub_class . '_google_ads"';
255
+ $ad_style = 'style="width:' . $ad_width . 'px; height:' . $ad_height . 'px;"';
256
+
257
+ $ad_client = 'data-client=' . $ad_client;
258
+ $ad_slot = 'data-slot=' . $ad_slot;
259
+ $ad_width = 'data-width="' . $ad_width . '"';
260
+ $ad_height = 'data-height="' . $ad_height . '"';
261
+
262
+ $ad_block = "<div $ad_style $ad_class $ad_width $ad_height $ad_slot $ad_client></div>";
263
+
264
+ $html = preg_replace( '#(<[^>]+) src="//pagead2.googlesyndication.com/pagead/show_ads.js"(.*?)</script>#i', $ad_block, $html, 1 );
265
+ }
266
+
267
+ if ( $ad_found ) {
268
+ $adsense_callback = "
269
+ <script>
270
+ function iubenda_adsense_unblock() {
271
+ var t = 1;
272
+ jQuery('." . $this->iub_class . "_google_ads').each(function() {
273
+ var banner = jQuery(this);
274
+ setTimeout(function(){
275
+ var client = banner.data('client');
276
+ var slot = banner.data('slot');
277
+ var width = banner.data('width');
278
+ var height = banner.data('height');
279
+ var adsense_script = '<scr'+'ipt>'
280
+ + 'google_ad_client = " . chr( 34 ) . "'+client+'" . chr( 34 ) . ";'
281
+ + 'google_ad_slot = '+slot+';'
282
+ + 'google_ad_width = '+width+';'
283
+ + 'google_ad_height = '+height+';'
284
+ + '</scr'+'ipt>';
285
+ var script = document.createElement('script');
286
+ var ads = document.createElement('ads');
287
+ var w = document.write;
288
+ script.setAttribute('type', 'text/javascript');
289
+ script.setAttribute('src', 'http://pagead2.googlesyndication.com/pagead/show_ads.js');
290
+ document.write = (function(params) {
291
+ ads.innerHTML = params;
292
+ document.write = w;
293
+ });
294
+ banner.html(adsense_script).append(ads).append(script);
295
+ }, t);
296
+ t += 300;
297
+ });
298
+ }
299
+
300
+ if ( 'callback' in _iub.csConfiguration ) {
301
+ _iub.csConfiguration.callback.onConsentGiven = iubenda_adsense_unblock;
302
+ } else {
303
+ _iub.csConfiguration.callback = {};
304
+
305
+ _iub.csConfiguration.callback.onConsentGiven = iubenda_adsense_unblock;
306
+ }
307
+ </script>";
308
+
309
+ $html = str_replace( '</body>', $adsense_callback . '</body>', $html );
310
+ }
311
+
312
+ $this->content_page = $html;
313
  }
314
+ break;
315
 
316
+ case 'faster':
317
+ libxml_use_internal_errors( true );
318
+
319
+ // get class attributes for better performance
320
+ $script_tags = $this->auto_script_tags;
321
+ $class = $this->iub_class;
322
+ $class_inline = $this->iub_class_inline;
323
+
324
+ // create new DOM document
325
+ $document = new DOMDocument();
326
+
327
+ // set document arguments
328
+ $document->formatOutput = true;
329
+ $document->preserveWhiteSpace = false;
330
+
331
+ // load HTML
332
+ $document->loadHTML( $this->content_page );
333
+
334
+ // search for scripts
335
+ $scripts = $document->getElementsByTagName( 'script' );
336
+
337
+ // any scripts?
338
+ if ( ! empty( $scripts ) && is_object( $scripts ) ) {
339
+ foreach ( $scripts as $script ) {
340
+ $src = $script->getAttribute( 'src' );
341
+
342
+ // add script as detected
343
+ if ( ! empty( $src ) )
344
+ $this->scripts_detected[] = $src;
345
+
346
+ // add inline script as detected
347
+ if ( ! empty( $script->nodeValue ) )
348
+ $this->scripts_inline_detected[] = $script->nodeValue;
349
+
350
+ if ( self::strpos_array( $src, $script_tags ) ) {
351
+ $script->setAttribute( 'type', 'text/plain' );
352
+ $script->setAttribute( 'class', $script->getAttribute( 'class' ) . ' ' . $class );
353
+
354
+ // add script as converted
355
+ $this->scripts_converted[] = $src;
356
+ } elseif ( self::strpos_array( $script->nodeValue, $script_tags ) ) {
357
+ $script->setAttribute( 'type', 'text/plain' );
358
+ $script->setAttribute( 'class', $script->getAttribute( 'class' ) . ' ' . $class_inline );
359
+
360
+ // add inline script as converted
361
+ $this->scripts_inline_converted[] = $script->nodeValue;
362
+ }
363
  }
364
  }
365
+
366
+ // save document content
367
+ $content = $document->saveHTML();
368
+
369
+ libxml_use_internal_errors( false );
370
+
371
+ // update content
372
+ $this->content_page = $content;
373
+ break;
374
  }
375
  }
376
 
377
  /**
378
+ * Parse automatically all the iframe in the page and change the src to suppressedsrc
379
+ * if src has inside one of the elements in $auto_iframe_tags array
380
+ *
381
+ * @return void
382
  */
383
+ public function parse_iframes() {
384
+ switch ( $this->type ) {
385
+ case 'page':
386
+ $html = str_get_html( $this->content_page, $lowercase = true, $force_tags_closed = true, $strip = false );
387
+
388
+ if ( is_object( $html ) ) {
389
+ $iframes = $html->find( 'iframe' );
390
+
391
+ if ( is_array( $iframes ) ) {
392
+ $count = count( $iframes );
393
+
394
+ for ( $j = 0; $j < $count; $j ++ ) {
395
+ $i = $iframes[$j];
396
+ $src = $i->src;
397
+ $this->iframes_detected[] = $src;
398
+
399
+ if ( self::strpos_array( $src, $this->auto_iframe_tags ) !== false ) {
400
+ $class = $i->class;
401
+ $i->suppressedsrc = $src;
402
+ $i->src = $this->iub_empty;
403
+ $i->class = $class . ' ' . $this->iub_class;
404
+ $this->iframes_converted[] = $src;
 
 
 
 
405
  }
406
  }
407
  }
408
+
409
+ $this->content_page = $html;
410
  }
411
+ break;
412
 
413
+ case 'faster':
414
+ libxml_use_internal_errors( true );
415
 
416
+ // get class attributes for better performance
417
+ $iframe_tags = $this->auto_iframe_tags;
418
+ $empty = $this->iub_empty;
419
+ $class = $this->iub_class;
 
 
 
420
 
421
+ // create new DOM document
422
+ $document = new DOMDocument();
 
 
423
 
424
+ // set document arguments
425
+ $document->formatOutput = true;
426
+ $document->preserveWhiteSpace = false;
 
427
 
428
+ // load HTML
429
+ $document->loadHTML( $this->content_page );
 
 
430
 
431
+ // search for iframes
432
+ $iframes = $document->getElementsByTagName( 'iframe' );
433
 
434
+ // any iframes?
435
+ if ( ! empty( $iframes ) && is_object( $iframes ) ) {
436
+ foreach ( $iframes as $iframe ) {
437
+ $src = $iframe->getAttribute( 'src' );
438
 
439
+ // add iframe as detected
440
+ $this->iframes_detected[] = $src;
441
 
442
+ if ( self::strpos_array( $src, $iframe_tags ) ) {
443
+ $iframe->setAttribute( 'src', $empty );
444
+ $iframe->setAttribute( 'suppressedsrc', $src );
445
+ $iframe->setAttribute( 'class', $iframe->getAttribute( 'class' ) . ' ' . $class );
446
 
447
+ // add iframe as converted
448
+ $this->iframes_converted[] = $src;
449
+ }
450
+ }
451
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452
 
453
+ // save document content
454
+ $content = $document->saveHTML();
455
+
456
+ libxml_use_internal_errors( false );
457
+
458
+ // update content
459
+ $this->content_page = $content;
460
+ break;
461
  }
462
  }
463
 
464
  /**
465
+ * Parse all IUBENDAs comment and convert the code inside with create_tags method
466
+ *
467
+ * @return mixed
468
  */
469
+ public function parse_comments() {
470
+ foreach ( array( 'IUB_REGEX_PATTERN', 'IUB_REGEX_PATTERN_2' ) as $pattern ) {
471
+ preg_match_all( constant( 'self::' . $pattern ), $this->content_page, $scripts );
472
+
473
+ // found any content?
474
+ if ( is_array( $scripts[1] ) ) {
475
+ $count = count( $scripts[1] );
476
+ $js_scripts = array();
477
+
478
+ for ( $j = 0; $j < $count; $j++ ) {
479
+ $this->iub_comments_detected[] = $scripts[1][$j];
480
+ // get HTML dom from string
481
+ $html = str_get_html( $scripts[1][$j], $lowercase = true, $force_tags_closed = true, $strip = false );
482
+ // convert scripts, iframes and other code inside IUBENDAs comment in text/plain to not generate cookies
483
+ $js_scripts[] = $this->create_tags( $html );
484
+ }
485
+
486
+ if ( is_array( $scripts[1] ) && is_array( $js_scripts ) ) {
487
+ if ( $count >= 1 && count( $js_scripts ) >= 1 ) {
488
+ $this->content_page = strtr( $this->content_page, array_combine( $scripts[1], $js_scripts ) );
489
  }
490
  }
491
  }
 
492
  }
493
  }
494
 
495
  /**
496
+ * Call three methods to parse the page, iubendas comment, scripts and iframes
497
+ *
498
+ * @return string Content
499
  */
500
  public function parse() {
501
+ $this->parse_comments();
502
  $this->parse_scripts();
503
+ $this->parse_iframes();
504
+
505
+ return $this->content_page;
506
  }
507
 
508
  /**
514
  return $this->content_page;
515
  }
516
 
517
+ /**
518
+ * Print iubenda banner, parameter: the script code of iubenda to print the banner
519
+ *
520
+ * @param string $banner
521
+ * @return string
522
+ */
523
+ public function print_banner( $banner ) {
524
+ return $banner .= "\n
525
+ <script>
526
+ var iCallback = function(){};
527
+
528
+ if ('callback' in _iub.csConfiguration) {
529
+ if ('onConsentGiven' in _iub.csConfiguration.callback)
530
+ iCallback = _iub.csConfiguration.callback.onConsentGiven;
531
+
532
+ _iub.csConfiguration.callback.onConsentGiven = function() {
533
+ iCallback();
534
+
535
+ jQuery('noscript._no_script_iub').each(function (a, b) { var el = jQuery(b); el.after(el.html()); });
536
+ };
537
+ };
538
+ </script>";
539
+ }
540
  }
iubenda-cookie-class/test.php CHANGED
@@ -16,98 +16,95 @@
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
 
23
  <html>
24
- <head>
25
- <!-- Latest compiled and minified CSS -->
26
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
27
-
28
- <!-- Optional theme -->
29
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
30
- <style>
31
- ul { margin: 0; padding: 0;}
32
- ul li { list-style-type: none; }
33
- </style>
34
- </head>
35
- <body>
36
- <div class="container">
37
- <div class="row">
38
- <div class="col-md-12">
39
- <h1>iubenda class test</h1>
40
- <form action="" method="POST">
41
- <strong>URL WEBSITE</strong><BR>
42
- <input type="text" name="url">
43
- <input type="submit" class="btn" value="Analyze">
44
- </form>
45
- </div>
46
-
47
- <?php
48
- $url = $_POST['url'];
49
-
50
- if ( $url || $_GET['url'] ) {
51
-
52
- function print_stuff( $array ) {
53
- if ( count( $array ) ) {
54
- echo "<ul>";
55
- foreach ( $array as $r ) {
56
- echo "<li><pre><code>" . htmlspecialchars( $r ) . "</code></pre></li>";
 
 
 
 
 
 
 
 
57
  }
58
- echo "</ul>";
59
- } else {
60
- echo "<p>Nothing</p>";
61
- }
62
- }
63
 
64
- echo '<div class="col-md-12" style="padding-bottom:150px;"><h2>RESULTS</H2>';
65
-
66
- include_once 'iubenda.class.php';
67
- include_once 'simple_html_dom.php';
68
 
69
- if ( $_GET['url'] ) {
70
- $content = file_get_contents( 'A' );
71
- } else {
72
- $content = file_get_contents( $url );
73
- }
74
 
75
- $page = new Page( $content );
76
- $page->parse();
77
 
78
- $iub_comments_detected = count( $page->iub_comments_detected );
79
- $scripts_detected = count( $page->scripts_detected );
80
- $iframe_detected = count( $page->iframe_detected );
81
- $iframe_converted = count( $page->iframe_converted );
82
- $script_inline_converted = count( $page->scripts_inline_converted );
83
- $script_converted = count( $page->scripts_converted );
84
 
85
- 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>";
 
 
 
 
 
 
86
 
87
- echo "<H3>DETAILS</H3>";
88
 
89
- echo "<H4>iubenda comments stuff</h4>";
90
- print_stuff( $page->iub_comments_detected );
91
 
92
- echo "<H4>Script detected</h4>";
93
- print_stuff( $page->scripts_detected );
94
- echo "<H4>Script converted</h4>";
95
- print_stuff( $page->scripts_converted );
96
- echo "<H4>Script inline converted</h4>";
97
- print_stuff( $page->scripts_inline_converted );
 
 
 
 
 
 
 
 
98
 
99
- echo "<H4>Iframe detected</h4>";
100
- print_stuff( $page->iframe_detected );
101
- echo "<H4>Iframe converted</h4>";
102
- print_stuff( $page->iframe_converted );
103
-
104
-
105
-
106
- echo "</div>";
107
- }
108
- ?>
109
- </div>
110
- </div>
111
 
112
- </body>
113
  </html>
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
+ ini_set( 'max_execution_time', 300 );
 
20
  ?>
21
 
22
  <html>
23
+ <head>
24
+ <!-- Latest compiled and minified CSS -->
25
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
26
+
27
+ <!-- Optional theme -->
28
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
29
+ <style>
30
+ ul { margin: 0; padding: 0;}
31
+ ul li { list-style-type: none; }
32
+ </style>
33
+ </head>
34
+ <body>
35
+ <div class="container">
36
+ <div class="row">
37
+ <div class="col-md-12">
38
+ <h1>iubenda class test</h1>
39
+ <form action="" method="POST">
40
+ <strong>URL WEBSITE</strong><BR>
41
+ <input type="text" name="url">
42
+ <input type="submit" class="btn" value="Analyze">
43
+ </form>
44
+ </div>
45
+
46
+ <?php
47
+ if ( ! empty( $_POST['url'] ) )
48
+ $url = $_POST['url'];
49
+ else
50
+ $url = '';
51
+
52
+ if ( $url ) {
53
+
54
+ function print_stuff( $array ) {
55
+ if ( count( $array ) ) {
56
+ echo "<ul>";
57
+ foreach ( $array as $r ) {
58
+ echo "<li><pre><code>" . htmlspecialchars( $r ) . "</code></pre></li>";
59
+ }
60
+ echo "</ul>";
61
+ } else {
62
+ echo "<p>Nothing</p>";
63
+ }
64
  }
 
 
 
 
 
65
 
66
+ echo '<div class="col-md-12" style="padding-bottom:150px;"><h2>RESULTS</H2>';
 
 
 
67
 
68
+ include_once( 'iubenda.class.php' );
 
 
 
 
69
 
70
+ $content = file_get_contents( $url );
 
71
 
72
+ $type = isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'page', 'faster' ), true ) ? $_GET['type'] : 'page';
73
+ $iubenda = new iubendaParser( $content, array( 'type' => $type ) );
74
+ $iubenda->parse();
 
 
 
75
 
76
+ $iub_comments_detected = count( $iubenda->iub_comments_detected );
77
+ $scripts_detected = count( $iubenda->scripts_detected );
78
+ $iframes_detected = count( $iubenda->iframes_detected );
79
+ $iframes_converted = count( $iubenda->iframes_converted );
80
+ $script_inline_detected = count( $iubenda->scripts_inline_detected );
81
+ $script_inline_converted = count( $iubenda->scripts_inline_converted );
82
+ $script_converted = count( $iubenda->scripts_converted );
83
 
84
+ echo "<p>Iubenda comments detected: $iub_comments_detected<br>Iubenda automatic stuff<br>Iframe detected: $iframes_detected<br>Iframe autoconverted: $iframes_converted<br>Scripts detected: $scripts_detected<br>Scripts autoconverted: $script_converted<br>Inline scripts detected: $script_inline_detected<br>Inline scripts autoconverted: $script_inline_converted</p>";
85
 
86
+ echo "<H3>DETAILS</H3>";
 
87
 
88
+ echo "<H4>iubenda comments stuff</h4>";
89
+ print_stuff( $iubenda->iub_comments_detected );
90
+ echo "<H4>Script detected</h4>";
91
+ print_stuff( $iubenda->scripts_detected );
92
+ echo "<H4>Script converted</h4>";
93
+ print_stuff( $iubenda->scripts_converted );
94
+ echo "<H4>Script inline detected</h4>";
95
+ print_stuff( $iubenda->scripts_inline_detected );
96
+ echo "<H4>Script inline converted</h4>";
97
+ print_stuff( $iubenda->scripts_inline_converted );
98
+ echo "<H4>Iframe detected</h4>";
99
+ print_stuff( $iubenda->iframes_detected );
100
+ echo "<H4>Iframe converted</h4>";
101
+ print_stuff( $iubenda->iframes_converted );
102
 
103
+ echo "</div>";
104
+ }
105
+ ?>
106
+ </div>
107
+ </div>
 
 
 
 
 
 
 
108
 
109
+ </body>
110
  </html>
iubenda-cookie-class/usage.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * usage.php
4
  * @author: Copyright 2018 iubenda
@@ -16,25 +17,18 @@
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
  if ( empty( $html ) )
24
  return;
25
 
26
- // separator
27
- if ( ! function_exists( "file_get_html" ) ) {
28
- require_once("simple_html_dom.php");
29
- }
30
-
31
- require_once("iubenda.class.php");
32
 
33
  // separator
34
- if ( ! Page::consent_given() && ! Page::bot_detected() ) {
35
- $page = new Page( $html );
36
- $page->parse();
37
- $html = $page->get_converted_page();
38
  }
39
 
40
  // finished
@@ -45,6 +39,6 @@ function iubenda_system( $html ) {
45
  *
46
  * Example:
47
  *
48
- * echo iubenda_system("<html> ...content... </html>");
49
  *
50
  */
1
  <?php
2
+
3
  /**
4
  * usage.php
5
  * @author: Copyright 2018 iubenda
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
  // the "$html" parameter must contain the content of the web page with the iubenda JavaScript banner/policy included
21
 
22
+ function iubenda_system( $html, $type = 'page' ) {
23
  if ( empty( $html ) )
24
  return;
25
 
26
+ require_once( 'iubenda.class.php' );
 
 
 
 
 
27
 
28
  // separator
29
+ if ( ! iubendaParser::consent_given() && ! iubendaParser::bot_detected() ) {
30
+ $iubenda = new iubendaParser( $html, array( 'type' => in_array( $type, array( 'page', 'faster' ), true ) ? $type : 'page' ) );
31
+ $html = $iubenda->parse();
 
32
  }
33
 
34
  // finished
39
  *
40
  * Example:
41
  *
42
+ * echo iubenda_system( "<html> ...content... </html>", 'faster' );
43
  *
44
  */
iubenda_cookie_solution.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: iubenda Cookie Solution for GDPR
4
  Plugin URI: https://www.iubenda.com
5
  Description: iubenda Cookie Solution allows you to make your website GDPR compliant and manage all aspects of cookie law on WP.
6
- Version: 1.15.1
7
  Author: iubenda
8
  Author URI: https://www.iubenda.com
9
  License: MIT License
@@ -35,7 +35,7 @@ $iubenda_cookie_law_solution = new iubenda_Cookie_Law_Solution();
35
  * iubenda_Cookie_Law_Solution final class.
36
  *
37
  * @class iubenda_Cookie_Law_Solution
38
- * @version 1.15.1
39
  */
40
  class iubenda_Cookie_Law_Solution {
41
 
@@ -51,7 +51,7 @@ class iubenda_Cookie_Law_Solution {
51
  'menu_position' => 'topmenu',
52
  'deactivation' => false
53
  );
54
- public $version = '1.15.1';
55
  public $no_html = false;
56
  public $links = array();
57
  public $multilang = false;
@@ -91,12 +91,11 @@ class iubenda_Cookie_Law_Solution {
91
  * @return void
92
  */
93
  public function init() {
94
-
95
  // check if WPML or Polylang is active
96
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
97
 
98
  // Polylang support
99
- if ( is_plugin_active( 'polylang/polylang.php' ) && function_exists( 'PLL' ) ) {
100
  $this->multilang = true;
101
 
102
  // get registered languages
@@ -128,13 +127,7 @@ class iubenda_Cookie_Law_Solution {
128
  $this->lang_default = $sitepress->get_default_language();
129
  }
130
 
131
- // load Simple HTML DOM if needed
132
- if ( ! function_exists( 'file_get_html' ) ) {
133
- require_once( dirname( __FILE__ ) . '/iubenda-cookie-class/simple_html_dom.php' );
134
- }
135
-
136
- // load plugin class
137
- require_once( dirname( __FILE__ ) . '/iubenda-cookie-class/iubenda.class.faster.php' );
138
  require_once( dirname( __FILE__ ) . '/iubenda-cookie-class/iubenda.class.php' );
139
 
140
  $links = array(
@@ -243,6 +236,8 @@ class iubenda_Cookie_Law_Solution {
243
 
244
  /**
245
  * Register shortcode function.
 
 
246
  */
247
  public function register_shortcode() {
248
  add_shortcode( 'iub-cookie-policy', array( $this, 'shortcode' ) );
@@ -261,6 +256,8 @@ class iubenda_Cookie_Law_Solution {
261
 
262
  /**
263
  * Add submenu.
 
 
264
  */
265
  public function admin_menu_options() {
266
  if ( $this->options['menu_position'] === 'submenu' ) {
@@ -278,6 +275,8 @@ class iubenda_Cookie_Law_Solution {
278
 
279
  /**
280
  * Load textdomain.
 
 
281
  */
282
  public function load_textdomain() {
283
  load_plugin_textdomain( 'iubenda-cookie-law-solution', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
@@ -322,6 +321,7 @@ class iubenda_Cookie_Law_Solution {
322
  * Redirect to the correct urle after switching menu position.
323
  *
324
  * @global string $pagenow
 
325
  */
326
  public function admin_page_redirect() {
327
  if ( ! empty( $_GET['settings-updated'] ) && ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'iubenda-cookie-law-solution' ) ) ) {
@@ -349,40 +349,32 @@ class iubenda_Cookie_Law_Solution {
349
  /**
350
  * Add wp_head content.
351
  *
352
- * @return mixed
353
  */
354
  public function wp_head() {
355
- /* check if user is logged in, then disable the banner.
356
- if ( is_user_logged_in() ) {
357
- return;
358
- }
359
- */
360
-
361
  // break on admin side
362
- if ( is_admin() ) {
363
  return;
364
- }
365
 
366
  // check content type
367
  if ( (bool) $this->options['ctype'] == true ) {
368
  $iub_headers = headers_list();
369
  $destroy = true;
370
 
371
- foreach ( $iub_headers as $h ) {
372
- if ( strpos( $h, "Content-Type: text/html" ) !== false || strpos( $h, "Content-type: text/html" ) !== false ) {
373
  $destroy = false;
 
374
  }
375
  }
376
 
377
- if ( $destroy ) {
378
  $this->no_html = true;
379
- }
380
  }
381
 
382
  // is post or not html content type?
383
- if ( $_POST || $this->no_html ) {
384
  return;
385
- }
386
 
387
  // initial head output
388
  $iubenda_code = "";
@@ -394,9 +386,8 @@ class iubenda_Cookie_Law_Solution {
394
  if ( ! $iubenda_code ) {
395
  $iubenda_code .= $this->options['code_default'];
396
  }
397
- } else {
398
  $iubenda_code .= $this->options['code_default'];
399
- }
400
 
401
  $iubenda_code .= "\n
402
  <script>
@@ -410,9 +401,9 @@ class iubenda_Cookie_Law_Solution {
410
  _iub.csConfiguration.callback.onConsentGiven = function() {
411
  iCallback();
412
 
413
- /* separator */
414
- jQuery('noscript._no_script_iub').each(function (a, b) { var el = jQuery(b); el.after(el.html()); });
415
- }
416
  }
417
  }
418
  </script>";
@@ -426,9 +417,8 @@ class iubenda_Cookie_Law_Solution {
426
  * @return void
427
  */
428
  public function output_start() {
429
- if ( ! is_admin() ) {
430
  ob_start( array( $this, 'output_callback' ) );
431
- }
432
  }
433
 
434
  /**
@@ -437,9 +427,8 @@ class iubenda_Cookie_Law_Solution {
437
  * @return void
438
  */
439
  public function output_end() {
440
- if ( ! is_admin() && ob_get_level() ) {
441
  ob_end_flush();
442
- }
443
  }
444
 
445
  /**
@@ -450,64 +439,49 @@ class iubenda_Cookie_Law_Solution {
450
  */
451
  public function output_callback( $output ) {
452
  // break on ajax, xmlrpc or iub_no_parse request
453
- if (
454
  ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST )
455
  || ( defined( 'DOING_AJAX' ) && DOING_AJAX )
456
  || isset( $_SERVER["HTTP_X_REQUESTED_WITH"] )
457
  || isset( $_GET['iub_no_parse'] )
458
- ) {
459
  return $output;
460
- }
461
 
462
  // break on admin side
463
- if ( is_admin() ) {
464
  return $output;
465
- }
466
-
467
- // break for logged in users?
468
- /* if ( is_user_logged_in() ) {
469
- return $output;
470
- }
471
- */
472
 
473
  // break on rss feed
474
- if ( is_feed() && $this->options['output_feed'] ) {
475
  return $output;
476
- }
477
 
478
- if ( strpos( $output, "<html" ) === false ) {
479
  return $output;
480
- } elseif ( strpos( $output, "<html" ) > 200 ) {
481
  return $output;
482
- }
483
 
484
  // check whether to run parser or not
485
- if (
486
- ! $this->options['parse'] || ( iubendaPage::consent_given() && $this->options['skip_parsing'] ) || iubendaPage::bot_detected() || $_POST || $this->no_html ) {
487
-
488
  return $output;
489
- }
490
 
491
  $startime = microtime( true );
492
-
493
  $output = apply_filters( 'iubenda_initial_output', $output );
494
 
495
  // experimental class
496
  if ( $this->options['parser_engine'] == 'new' ) {
497
- $faster = new iubendaFaster;
498
 
499
  // render output
500
- $output = $faster->isParse( mb_convert_encoding( $output, 'HTML-ENTITIES', 'UTF-8' ) );
501
 
502
  // append signature
503
  $output .= '<!-- Parsed with iubenda experimental class in ' . round( microtime( true ) - $startime, 4 ) . ' sec. -->';
504
- // default class
505
  } else {
506
- $page = new iubendaPage( $output );
507
- $page->parse();
508
 
509
  // render output
510
- $output = $page->get_converted_page();
511
 
512
  // append signature
513
  $output .= '<!-- Parsed with iubenda default class in ' . round( microtime( true ) - $startime, 4 ) . ' sec. -->';
@@ -518,6 +492,8 @@ class iubenda_Cookie_Law_Solution {
518
 
519
  /**
520
  * Register plugin options.
 
 
521
  */
522
  public function register_options() {
523
  register_setting( 'iubenda_cookie_law_solution', 'iubenda_cookie_law_solution', array( $this, 'save_options' ) );
@@ -606,8 +582,8 @@ class iubenda_Cookie_Law_Solution {
606
  <p class="description">' . '(' . sprintf( __( "see <a href=\"%s\" target=\"_blank\">our documentation</a> for the list of detected scripts.", 'iubenda-cookie-law-solution' ), $this->links['documentation'] ) . ')' . '</p>
607
  <div id="iub_parser_engine_container"' . ( $this->options['parse'] === false ? ' style="display: none;"' : '' ) . '>
608
  <div>
609
- <label><input id="iub_parser_engine-default" type="radio" name="iubenda_cookie_law_solution[parser_engine]" value="default" ' . checked( 'default', $this->options['parser_engine'], false ) . ' />' . __( 'Default', 'iubenda-cookie-law-solution' ) . '</label>
610
- <label><input id="iub_parser_engine-new" type="radio" name="iubenda_cookie_law_solution[parser_engine]" value="new" ' . checked( 'new', $this->options['parser_engine'], false ) . ' />' . __( 'Experimental', 'iubenda-cookie-law-solution' ) . '</label>
611
  <p class="description">' . __( 'Select parsing engine.', 'iubenda-cookie-law-solution' ) . '</p>
612
  </div>
613
  <div>
3
  Plugin Name: iubenda Cookie Solution for GDPR
4
  Plugin URI: https://www.iubenda.com
5
  Description: iubenda Cookie Solution allows you to make your website GDPR compliant and manage all aspects of cookie law on WP.
6
+ Version: 1.15.2
7
  Author: iubenda
8
  Author URI: https://www.iubenda.com
9
  License: MIT License
35
  * iubenda_Cookie_Law_Solution final class.
36
  *
37
  * @class iubenda_Cookie_Law_Solution
38
+ * @version 1.15.2
39
  */
40
  class iubenda_Cookie_Law_Solution {
41
 
51
  'menu_position' => 'topmenu',
52
  'deactivation' => false
53
  );
54
+ public $version = '1.15.2';
55
  public $no_html = false;
56
  public $links = array();
57
  public $multilang = false;
91
  * @return void
92
  */
93
  public function init() {
 
94
  // check if WPML or Polylang is active
95
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
96
 
97
  // Polylang support
98
+ if ( ( is_plugin_active( 'polylang/polylang.php' ) || is_plugin_active( 'polylang-pro/polylang.php' ) ) && function_exists( 'PLL' ) ) {
99
  $this->multilang = true;
100
 
101
  // get registered languages
127
  $this->lang_default = $sitepress->get_default_language();
128
  }
129
 
130
+ // load iubenda parser
 
 
 
 
 
 
131
  require_once( dirname( __FILE__ ) . '/iubenda-cookie-class/iubenda.class.php' );
132
 
133
  $links = array(
236
 
237
  /**
238
  * Register shortcode function.
239
+ *
240
+ * @return void
241
  */
242
  public function register_shortcode() {
243
  add_shortcode( 'iub-cookie-policy', array( $this, 'shortcode' ) );
256
 
257
  /**
258
  * Add submenu.
259
+ *
260
+ * @return void
261
  */
262
  public function admin_menu_options() {
263
  if ( $this->options['menu_position'] === 'submenu' ) {
275
 
276
  /**
277
  * Load textdomain.
278
+ *
279
+ * @return void
280
  */
281
  public function load_textdomain() {
282
  load_plugin_textdomain( 'iubenda-cookie-law-solution', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
321
  * Redirect to the correct urle after switching menu position.
322
  *
323
  * @global string $pagenow
324
+ * @return void
325
  */
326
  public function admin_page_redirect() {
327
  if ( ! empty( $_GET['settings-updated'] ) && ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'iubenda-cookie-law-solution' ) ) ) {
349
  /**
350
  * Add wp_head content.
351
  *
352
+ * @return void
353
  */
354
  public function wp_head() {
 
 
 
 
 
 
355
  // break on admin side
356
+ if ( is_admin() )
357
  return;
 
358
 
359
  // check content type
360
  if ( (bool) $this->options['ctype'] == true ) {
361
  $iub_headers = headers_list();
362
  $destroy = true;
363
 
364
+ foreach ( $iub_headers as $header ) {
365
+ if ( strpos( $header, "Content-Type: text/html" ) !== false || strpos( $header, "Content-type: text/html" ) !== false ) {
366
  $destroy = false;
367
+ break;
368
  }
369
  }
370
 
371
+ if ( $destroy )
372
  $this->no_html = true;
 
373
  }
374
 
375
  // is post or not html content type?
376
+ if ( $_POST || $this->no_html )
377
  return;
 
378
 
379
  // initial head output
380
  $iubenda_code = "";
386
  if ( ! $iubenda_code ) {
387
  $iubenda_code .= $this->options['code_default'];
388
  }
389
+ } else
390
  $iubenda_code .= $this->options['code_default'];
 
391
 
392
  $iubenda_code .= "\n
393
  <script>
401
  _iub.csConfiguration.callback.onConsentGiven = function() {
402
  iCallback();
403
 
404
+ /* separator */
405
+ jQuery('noscript._no_script_iub').each(function (a, b) { var el = jQuery(b); el.after(el.html()); });
406
+ }
407
  }
408
  }
409
  </script>";
417
  * @return void
418
  */
419
  public function output_start() {
420
+ if ( ! is_admin() )
421
  ob_start( array( $this, 'output_callback' ) );
 
422
  }
423
 
424
  /**
427
  * @return void
428
  */
429
  public function output_end() {
430
+ if ( ! is_admin() && ob_get_level() )
431
  ob_end_flush();
 
432
  }
433
 
434
  /**
439
  */
440
  public function output_callback( $output ) {
441
  // break on ajax, xmlrpc or iub_no_parse request
442
+ if (
443
  ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST )
444
  || ( defined( 'DOING_AJAX' ) && DOING_AJAX )
445
  || isset( $_SERVER["HTTP_X_REQUESTED_WITH"] )
446
  || isset( $_GET['iub_no_parse'] )
447
+ )
448
  return $output;
 
449
 
450
  // break on admin side
451
+ if ( is_admin() )
452
  return $output;
 
 
 
 
 
 
 
453
 
454
  // break on rss feed
455
+ if ( is_feed() && $this->options['output_feed'] )
456
  return $output;
 
457
 
458
+ if ( strpos( $output, "<html" ) === false )
459
  return $output;
460
+ elseif ( strpos( $output, "<html" ) > 200 )
461
  return $output;
 
462
 
463
  // check whether to run parser or not
464
+ if ( ! $this->options['parse'] || ( iubendaParser::consent_given() && $this->options['skip_parsing'] ) || iubendaParser::bot_detected() || $_POST || $this->no_html )
 
 
465
  return $output;
 
466
 
467
  $startime = microtime( true );
 
468
  $output = apply_filters( 'iubenda_initial_output', $output );
469
 
470
  // experimental class
471
  if ( $this->options['parser_engine'] == 'new' ) {
472
+ $iubenda = new iubendaParser( mb_convert_encoding( $output, 'HTML-ENTITIES', 'UTF-8' ), array( 'type' => 'faster' ) );
473
 
474
  // render output
475
+ $output = $iubenda->parse();
476
 
477
  // append signature
478
  $output .= '<!-- Parsed with iubenda experimental class in ' . round( microtime( true ) - $startime, 4 ) . ' sec. -->';
479
+ // default class
480
  } else {
481
+ $iubenda = new iubendaParser( $output, array( 'type' => 'page' ) );
 
482
 
483
  // render output
484
+ $output = $iubenda->parse();
485
 
486
  // append signature
487
  $output .= '<!-- Parsed with iubenda default class in ' . round( microtime( true ) - $startime, 4 ) . ' sec. -->';
492
 
493
  /**
494
  * Register plugin options.
495
+ *
496
+ * @return void
497
  */
498
  public function register_options() {
499
  register_setting( 'iubenda_cookie_law_solution', 'iubenda_cookie_law_solution', array( $this, 'save_options' ) );
582
  <p class="description">' . '(' . sprintf( __( "see <a href=\"%s\" target=\"_blank\">our documentation</a> for the list of detected scripts.", 'iubenda-cookie-law-solution' ), $this->links['documentation'] ) . ')' . '</p>
583
  <div id="iub_parser_engine_container"' . ( $this->options['parse'] === false ? ' style="display: none;"' : '' ) . '>
584
  <div>
585
+ <label><input id="iub_parser_engine-new" type="radio" name="iubenda_cookie_law_solution[parser_engine]" value="new" ' . checked( 'new', $this->options['parser_engine'], false ) . ' />' . __( 'Primary', 'iubenda-cookie-law-solution' ) . '</label>
586
+ <label><input id="iub_parser_engine-default" type="radio" name="iubenda_cookie_law_solution[parser_engine]" value="default" ' . checked( 'default', $this->options['parser_engine'], false ) . ' />' . __( 'Secondary', 'iubenda-cookie-law-solution' ) . '</label>
587
  <p class="description">' . __( 'Select parsing engine.', 'iubenda-cookie-law-solution' ) . '</p>
588
  </div>
589
  <div>
languages/iubenda-cookie-law-solution-it_IT.mo CHANGED
Binary file
languages/iubenda-cookie-law-solution-it_IT.po CHANGED
@@ -1,59 +1,59 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Iubenda Cookie Solution\n"
4
- "POT-Creation-Date: 2018-04-26 17:32+0200\n"
5
- "PO-Revision-Date: 2018-05-09 12:30+0200\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: it\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.0.7\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
  "X-Poedit-KeywordsList: __\n"
17
  "X-Poedit-SearchPath-0: .\n"
18
 
19
- #: iubenda_cookie_solution.php:526
20
  msgid "Code"
21
  msgstr "Codice"
22
 
23
- #: iubenda_cookie_solution.php:527
24
  msgid "Scripts blocking"
25
  msgstr "Blocco preventivo dei codici"
26
 
27
- #: iubenda_cookie_solution.php:528
28
  msgid "Content type"
29
  msgstr "Tipo di contenuto"
30
 
31
- #: iubenda_cookie_solution.php:529
32
  msgid "RSS feed"
33
  msgstr "Feed RSS"
34
 
35
- #: iubenda_cookie_solution.php:530
36
  msgid "Menu position"
37
  msgstr "Posizione menu"
38
 
39
- #: iubenda_cookie_solution.php:531
40
  msgid "Deactivation"
41
  msgstr "Disattivazione"
42
 
43
- #: iubenda_cookie_solution.php:581
44
  #, php-format
45
  msgid "Enter the iubenda code for %s."
46
  msgstr "Inserire il codice di iubenda per %s."
47
 
48
- #: iubenda_cookie_solution.php:592
49
  msgid "Enter the iubenda code."
50
  msgstr "Inserire il codice di iubenda."
51
 
52
- #: iubenda_cookie_solution.php:605
53
  msgid "Automatically block scripts detected by the plugin."
54
  msgstr "Blocca automaticamente gli script rilevati dal plugin."
55
 
56
- #: iubenda_cookie_solution.php:606
57
  #, php-format
58
  msgid ""
59
  "see <a href=\"%s\" target=\"_blank\">our documentation</a> for the list of "
@@ -62,26 +62,26 @@ msgstr ""
62
  "visita <a href=\"%s\" target=\"_blank\">la nostra documentazione</a> per la "
63
  "lista degli script rilevati automaticamente dal plugin."
64
 
65
- #: iubenda_cookie_solution.php:609
66
- msgid "Default"
67
- msgstr "Default"
68
 
69
- #: iubenda_cookie_solution.php:610
70
- msgid "Experimental"
71
- msgstr "Sperimentale"
72
 
73
- #: iubenda_cookie_solution.php:611
74
  msgid "Select parsing engine."
75
  msgstr "Seleziona il motore di parsing."
76
 
77
- #: iubenda_cookie_solution.php:614
78
  msgid ""
79
  "Leave scripts untouched on the page if the user has already given consent"
80
  msgstr ""
81
  "Lascia gli script intatti sulla pagina se l'utente ha già prestato il "
82
  "consenso"
83
 
84
- #: iubenda_cookie_solution.php:615
85
  msgid ""
86
  "improves performance, highly recommended, to be deactivated only if your "
87
  "site uses a caching system"
@@ -89,7 +89,7 @@ msgstr ""
89
  "migliora le prestazioni, altamente consigliato, da disattivare solo qualora "
90
  "il tuo sito utilizzi un sistema di cache"
91
 
92
- #: iubenda_cookie_solution.php:629
93
  msgid ""
94
  "Restrict the plugin to run only for requests that have \"Content-type: "
95
  "text / html\" (recommended)"
@@ -97,19 +97,19 @@ msgstr ""
97
  "Restringi l'esecuzione del plugin alle sole richieste che presentano "
98
  "\"Content-type: text/html\" (consigliato)"
99
 
100
- #: iubenda_cookie_solution.php:641
101
  msgid "Do not run the plugin inside the RSS feed (recommended)"
102
  msgstr "Non eseguire il plugin all'interno dei Feed RSS (consigliato)"
103
 
104
- #: iubenda_cookie_solution.php:653
105
  msgid "Top menu"
106
  msgstr "Menu principale"
107
 
108
- #: iubenda_cookie_solution.php:654
109
  msgid "Submenu"
110
  msgstr "Sottomenu"
111
 
112
- #: iubenda_cookie_solution.php:655
113
  msgid ""
114
  "Select whether to display iubenda in a top admin menu or the Settings "
115
  "submenu."
@@ -117,24 +117,24 @@ msgstr ""
117
  "Scegli se visualizzare iubenda in una voce di menu principale del pannello "
118
  "admin o in un sottomenu della scheda Impostazioni."
119
 
120
- #: iubenda_cookie_solution.php:667
121
  msgid "Delete all plugin data upon deactivation?"
122
  msgstr ""
123
  "Vuoi eliminare tutti i dati del plugin al momento della disattivazione?"
124
 
125
- #: iubenda_cookie_solution.php:704
126
  msgid "Settings saved."
127
  msgstr "Impostazioni salvate."
128
 
129
- #: iubenda_cookie_solution.php:715
130
  msgid "Settings restored to defaults."
131
  msgstr "Impostazioni di default ripristinate."
132
 
133
- #: iubenda_cookie_solution.php:728
134
  msgid "You don't have permission to access this page."
135
  msgstr "Non disponi dell'autorizzazione per accedere a questa pagina."
136
 
137
- #: iubenda_cookie_solution.php:737
138
  msgid ""
139
  "This plugin is the easiest and most comprehensive way to adapt your "
140
  "WordPress site to the European cookie law. Upon your user's first visit, the "
@@ -152,11 +152,11 @@ msgstr ""
152
  "il semplice scroll (il metodo più efficace) e la riattivazione senza il "
153
  "refresh della pagina."
154
 
155
- #: iubenda_cookie_solution.php:740
156
  msgid "Would you like to know more about the cookie law?"
157
  msgstr "Vuoi capire di più sulla cookie law?"
158
 
159
- #: iubenda_cookie_solution.php:741
160
  #, php-format
161
  msgid ""
162
  "Read our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">complete "
@@ -165,11 +165,11 @@ msgstr ""
165
  "Consulta la nostra <a href=\"%s\" class=\"iubenda-url\" target=\"_blank"
166
  "\">guida completa alla cookie law</a>"
167
 
168
- #: iubenda_cookie_solution.php:744
169
  msgid "What is the full functionality of the plugin?"
170
  msgstr "Qual è la completa funzionalità del plugin?"
171
 
172
- #: iubenda_cookie_solution.php:745
173
  #, php-format
174
  msgid ""
175
  "Visit our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">plugin page."
@@ -178,11 +178,11 @@ msgstr ""
178
  "Visita la <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">nostra "
179
  "pagina dedicata</a> al plugin"
180
 
181
- #: iubenda_cookie_solution.php:748
182
  msgid "Enter the iubenda code for the Cookie Solution below."
183
  msgstr "Inserisci qui sotto il codice di iubenda per la Cookie Solution."
184
 
185
- #: iubenda_cookie_solution.php:749
186
  #, php-format
187
  msgid ""
188
  "In order to run the plugin, you need to enter the iubenda code that "
@@ -195,15 +195,15 @@ msgstr ""
195
  "codice può essere generato su www.iubenda.com, <a href=\"%s\" class="
196
  "\"iubenda-url\" target=\"_blank\">seguendo questa guida.</a>"
197
 
198
- #: iubenda_cookie_solution.php:760
199
  msgid "Reset to defaults"
200
  msgstr "Ripristina le impostazioni di default"
201
 
202
- #: iubenda_cookie_solution.php:766
203
  msgid "Need support for this plugin?"
204
  msgstr "Hai bisogno di supporto su questo plugin?"
205
 
206
- #: iubenda_cookie_solution.php:767
207
  #, php-format
208
  msgid ""
209
  "Visit our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">support "
@@ -212,13 +212,13 @@ msgstr ""
212
  "Visita il nostro <a href=\"%s\" class=\"iubenda-url\" target=\"_blank"
213
  "\">forum di supporto</a>"
214
 
215
- #: iubenda_cookie_solution.php:770
216
  msgid "Want to try a beta version of this plugin with the latest features?"
217
  msgstr ""
218
  "Vuoi provare una versione Beta di questo plugin, con le funzionalità più "
219
  "recenti?"
220
 
221
- #: iubenda_cookie_solution.php:771
222
  #, php-format
223
  msgid ""
224
  "Visit our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank"
@@ -228,6 +228,12 @@ msgstr ""
228
  "Visita la <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">nostra "
229
  "documentazione</a> e segui le istruzioni per installare una versione Beta."
230
 
 
 
 
 
 
 
231
  #~ msgid "What’s the full functionality of the plugin?"
232
  #~ msgstr "Quali sono le funzionalità complete del plugin?"
233
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Iubenda Cookie Solution\n"
4
+ "POT-Creation-Date: 2018-09-28 09:53+0200\n"
5
+ "PO-Revision-Date: 2018-09-28 10:45+0200\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: it\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.1.1\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
  "X-Poedit-KeywordsList: __\n"
17
  "X-Poedit-SearchPath-0: .\n"
18
 
19
+ #: iubenda_cookie_solution.php:502
20
  msgid "Code"
21
  msgstr "Codice"
22
 
23
+ #: iubenda_cookie_solution.php:503
24
  msgid "Scripts blocking"
25
  msgstr "Blocco preventivo dei codici"
26
 
27
+ #: iubenda_cookie_solution.php:504
28
  msgid "Content type"
29
  msgstr "Tipo di contenuto"
30
 
31
+ #: iubenda_cookie_solution.php:505
32
  msgid "RSS feed"
33
  msgstr "Feed RSS"
34
 
35
+ #: iubenda_cookie_solution.php:506
36
  msgid "Menu position"
37
  msgstr "Posizione menu"
38
 
39
+ #: iubenda_cookie_solution.php:507
40
  msgid "Deactivation"
41
  msgstr "Disattivazione"
42
 
43
+ #: iubenda_cookie_solution.php:557
44
  #, php-format
45
  msgid "Enter the iubenda code for %s."
46
  msgstr "Inserire il codice di iubenda per %s."
47
 
48
+ #: iubenda_cookie_solution.php:568
49
  msgid "Enter the iubenda code."
50
  msgstr "Inserire il codice di iubenda."
51
 
52
+ #: iubenda_cookie_solution.php:581
53
  msgid "Automatically block scripts detected by the plugin."
54
  msgstr "Blocca automaticamente gli script rilevati dal plugin."
55
 
56
+ #: iubenda_cookie_solution.php:582
57
  #, php-format
58
  msgid ""
59
  "see <a href=\"%s\" target=\"_blank\">our documentation</a> for the list of "
62
  "visita <a href=\"%s\" target=\"_blank\">la nostra documentazione</a> per la "
63
  "lista degli script rilevati automaticamente dal plugin."
64
 
65
+ #: iubenda_cookie_solution.php:585
66
+ msgid "Primary"
67
+ msgstr "Prima"
68
 
69
+ #: iubenda_cookie_solution.php:586
70
+ msgid "Secondary"
71
+ msgstr "Seconda"
72
 
73
+ #: iubenda_cookie_solution.php:587
74
  msgid "Select parsing engine."
75
  msgstr "Seleziona il motore di parsing."
76
 
77
+ #: iubenda_cookie_solution.php:590
78
  msgid ""
79
  "Leave scripts untouched on the page if the user has already given consent"
80
  msgstr ""
81
  "Lascia gli script intatti sulla pagina se l'utente ha già prestato il "
82
  "consenso"
83
 
84
+ #: iubenda_cookie_solution.php:591
85
  msgid ""
86
  "improves performance, highly recommended, to be deactivated only if your "
87
  "site uses a caching system"
89
  "migliora le prestazioni, altamente consigliato, da disattivare solo qualora "
90
  "il tuo sito utilizzi un sistema di cache"
91
 
92
+ #: iubenda_cookie_solution.php:605
93
  msgid ""
94
  "Restrict the plugin to run only for requests that have \"Content-type: "
95
  "text / html\" (recommended)"
97
  "Restringi l'esecuzione del plugin alle sole richieste che presentano "
98
  "\"Content-type: text/html\" (consigliato)"
99
 
100
+ #: iubenda_cookie_solution.php:617
101
  msgid "Do not run the plugin inside the RSS feed (recommended)"
102
  msgstr "Non eseguire il plugin all'interno dei Feed RSS (consigliato)"
103
 
104
+ #: iubenda_cookie_solution.php:629
105
  msgid "Top menu"
106
  msgstr "Menu principale"
107
 
108
+ #: iubenda_cookie_solution.php:630
109
  msgid "Submenu"
110
  msgstr "Sottomenu"
111
 
112
+ #: iubenda_cookie_solution.php:631
113
  msgid ""
114
  "Select whether to display iubenda in a top admin menu or the Settings "
115
  "submenu."
117
  "Scegli se visualizzare iubenda in una voce di menu principale del pannello "
118
  "admin o in un sottomenu della scheda Impostazioni."
119
 
120
+ #: iubenda_cookie_solution.php:643
121
  msgid "Delete all plugin data upon deactivation?"
122
  msgstr ""
123
  "Vuoi eliminare tutti i dati del plugin al momento della disattivazione?"
124
 
125
+ #: iubenda_cookie_solution.php:680
126
  msgid "Settings saved."
127
  msgstr "Impostazioni salvate."
128
 
129
+ #: iubenda_cookie_solution.php:691
130
  msgid "Settings restored to defaults."
131
  msgstr "Impostazioni di default ripristinate."
132
 
133
+ #: iubenda_cookie_solution.php:737
134
  msgid "You don't have permission to access this page."
135
  msgstr "Non disponi dell'autorizzazione per accedere a questa pagina."
136
 
137
+ #: iubenda_cookie_solution.php:746
138
  msgid ""
139
  "This plugin is the easiest and most comprehensive way to adapt your "
140
  "WordPress site to the European cookie law. Upon your user's first visit, the "
152
  "il semplice scroll (il metodo più efficace) e la riattivazione senza il "
153
  "refresh della pagina."
154
 
155
+ #: iubenda_cookie_solution.php:749
156
  msgid "Would you like to know more about the cookie law?"
157
  msgstr "Vuoi capire di più sulla cookie law?"
158
 
159
+ #: iubenda_cookie_solution.php:750
160
  #, php-format
161
  msgid ""
162
  "Read our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">complete "
165
  "Consulta la nostra <a href=\"%s\" class=\"iubenda-url\" target=\"_blank"
166
  "\">guida completa alla cookie law</a>"
167
 
168
+ #: iubenda_cookie_solution.php:753
169
  msgid "What is the full functionality of the plugin?"
170
  msgstr "Qual è la completa funzionalità del plugin?"
171
 
172
+ #: iubenda_cookie_solution.php:754
173
  #, php-format
174
  msgid ""
175
  "Visit our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">plugin page."
178
  "Visita la <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">nostra "
179
  "pagina dedicata</a> al plugin"
180
 
181
+ #: iubenda_cookie_solution.php:757
182
  msgid "Enter the iubenda code for the Cookie Solution below."
183
  msgstr "Inserisci qui sotto il codice di iubenda per la Cookie Solution."
184
 
185
+ #: iubenda_cookie_solution.php:758
186
  #, php-format
187
  msgid ""
188
  "In order to run the plugin, you need to enter the iubenda code that "
195
  "codice può essere generato su www.iubenda.com, <a href=\"%s\" class="
196
  "\"iubenda-url\" target=\"_blank\">seguendo questa guida.</a>"
197
 
198
+ #: iubenda_cookie_solution.php:769
199
  msgid "Reset to defaults"
200
  msgstr "Ripristina le impostazioni di default"
201
 
202
+ #: iubenda_cookie_solution.php:775
203
  msgid "Need support for this plugin?"
204
  msgstr "Hai bisogno di supporto su questo plugin?"
205
 
206
+ #: iubenda_cookie_solution.php:776
207
  #, php-format
208
  msgid ""
209
  "Visit our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">support "
212
  "Visita il nostro <a href=\"%s\" class=\"iubenda-url\" target=\"_blank"
213
  "\">forum di supporto</a>"
214
 
215
+ #: iubenda_cookie_solution.php:779
216
  msgid "Want to try a beta version of this plugin with the latest features?"
217
  msgstr ""
218
  "Vuoi provare una versione Beta di questo plugin, con le funzionalità più "
219
  "recenti?"
220
 
221
+ #: iubenda_cookie_solution.php:780
222
  #, php-format
223
  msgid ""
224
  "Visit our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank"
228
  "Visita la <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">nostra "
229
  "documentazione</a> e segui le istruzioni per installare una versione Beta."
230
 
231
+ #~ msgid "Default"
232
+ #~ msgstr "Default"
233
+
234
+ #~ msgid "Experimental"
235
+ #~ msgstr "Sperimentale"
236
+
237
  #~ msgid "What’s the full functionality of the plugin?"
238
  #~ msgstr "Quali sono le funzionalità complete del plugin?"
239
 
languages/iubenda-cookie-law-solution.pot CHANGED
@@ -2,128 +2,128 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Iubenda Cookie Solution\n"
5
- "POT-Creation-Date: 2018-04-26 17:32+0200\n"
6
  "PO-Revision-Date: 2015-08-12 10:36+0200\n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.0.7\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
  "X-Poedit-KeywordsList: __\n"
17
  "X-Poedit-SearchPath-0: .\n"
18
 
19
- #: iubenda_cookie_solution.php:526
20
  msgid "Code"
21
  msgstr ""
22
 
23
- #: iubenda_cookie_solution.php:527
24
  msgid "Scripts blocking"
25
  msgstr ""
26
 
27
- #: iubenda_cookie_solution.php:528
28
  msgid "Content type"
29
  msgstr ""
30
 
31
- #: iubenda_cookie_solution.php:529
32
  msgid "RSS feed"
33
  msgstr ""
34
 
35
- #: iubenda_cookie_solution.php:530
36
  msgid "Menu position"
37
  msgstr ""
38
 
39
- #: iubenda_cookie_solution.php:531
40
  msgid "Deactivation"
41
  msgstr ""
42
 
43
- #: iubenda_cookie_solution.php:581
44
  #, php-format
45
  msgid "Enter the iubenda code for %s."
46
  msgstr ""
47
 
48
- #: iubenda_cookie_solution.php:592
49
  msgid "Enter the iubenda code."
50
  msgstr ""
51
 
52
- #: iubenda_cookie_solution.php:605
53
  msgid "Automatically block scripts detected by the plugin."
54
  msgstr ""
55
 
56
- #: iubenda_cookie_solution.php:606
57
  #, php-format
58
  msgid ""
59
  "see <a href=\"%s\" target=\"_blank\">our documentation</a> for the list of "
60
  "detected scripts."
61
  msgstr ""
62
 
63
- #: iubenda_cookie_solution.php:609
64
- msgid "Default"
65
  msgstr ""
66
 
67
- #: iubenda_cookie_solution.php:610
68
- msgid "Experimental"
69
  msgstr ""
70
 
71
- #: iubenda_cookie_solution.php:611
72
  msgid "Select parsing engine."
73
  msgstr ""
74
 
75
- #: iubenda_cookie_solution.php:614
76
  msgid ""
77
  "Leave scripts untouched on the page if the user has already given consent"
78
  msgstr ""
79
 
80
- #: iubenda_cookie_solution.php:615
81
  msgid ""
82
  "improves performance, highly recommended, to be deactivated only if your "
83
  "site uses a caching system"
84
  msgstr ""
85
 
86
- #: iubenda_cookie_solution.php:629
87
  msgid ""
88
  "Restrict the plugin to run only for requests that have \"Content-type: "
89
  "text / html\" (recommended)"
90
  msgstr ""
91
 
92
- #: iubenda_cookie_solution.php:641
93
  msgid "Do not run the plugin inside the RSS feed (recommended)"
94
  msgstr ""
95
 
96
- #: iubenda_cookie_solution.php:653
97
  msgid "Top menu"
98
  msgstr ""
99
 
100
- #: iubenda_cookie_solution.php:654
101
  msgid "Submenu"
102
  msgstr ""
103
 
104
- #: iubenda_cookie_solution.php:655
105
  msgid ""
106
  "Select whether to display iubenda in a top admin menu or the Settings "
107
  "submenu."
108
  msgstr ""
109
 
110
- #: iubenda_cookie_solution.php:667
111
  msgid "Delete all plugin data upon deactivation?"
112
  msgstr ""
113
 
114
- #: iubenda_cookie_solution.php:704
115
  msgid "Settings saved."
116
  msgstr ""
117
 
118
- #: iubenda_cookie_solution.php:715
119
  msgid "Settings restored to defaults."
120
  msgstr ""
121
 
122
- #: iubenda_cookie_solution.php:728
123
  msgid "You don't have permission to access this page."
124
  msgstr ""
125
 
126
- #: iubenda_cookie_solution.php:737
127
  msgid ""
128
  "This plugin is the easiest and most comprehensive way to adapt your "
129
  "WordPress site to the European cookie law. Upon your user's first visit, "
@@ -134,33 +134,33 @@ msgid ""
134
  "script reactivation without refreshing the page."
135
  msgstr ""
136
 
137
- #: iubenda_cookie_solution.php:740
138
  msgid "Would you like to know more about the cookie law?"
139
  msgstr ""
140
 
141
- #: iubenda_cookie_solution.php:741
142
  #, php-format
143
  msgid ""
144
  "Read our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">complete "
145
  "guide to the cookie law.</a>"
146
  msgstr ""
147
 
148
- #: iubenda_cookie_solution.php:744
149
  msgid "What is the full functionality of the plugin?"
150
  msgstr ""
151
 
152
- #: iubenda_cookie_solution.php:745
153
  #, php-format
154
  msgid ""
155
  "Visit our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">plugin "
156
  "page.</a>"
157
  msgstr ""
158
 
159
- #: iubenda_cookie_solution.php:748
160
  msgid "Enter the iubenda code for the Cookie Solution below."
161
  msgstr ""
162
 
163
- #: iubenda_cookie_solution.php:749
164
  #, php-format
165
  msgid ""
166
  "In order to run the plugin, you need to enter the iubenda code that "
@@ -169,26 +169,26 @@ msgid ""
169
  "class=\"iubenda-url\" target=\"_blank\">this guide.</a>"
170
  msgstr ""
171
 
172
- #: iubenda_cookie_solution.php:760
173
  msgid "Reset to defaults"
174
  msgstr ""
175
 
176
- #: iubenda_cookie_solution.php:766
177
  msgid "Need support for this plugin?"
178
  msgstr ""
179
 
180
- #: iubenda_cookie_solution.php:767
181
  #, php-format
182
  msgid ""
183
  "Visit our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">support "
184
  "forum.</a>"
185
  msgstr ""
186
 
187
- #: iubenda_cookie_solution.php:770
188
  msgid "Want to try a beta version of this plugin with the latest features?"
189
  msgstr ""
190
 
191
- #: iubenda_cookie_solution.php:771
192
  #, php-format
193
  msgid ""
194
  "Visit our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank"
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Iubenda Cookie Solution\n"
5
+ "POT-Creation-Date: 2018-09-25 13:30+0200\n"
6
  "PO-Revision-Date: 2015-08-12 10:36+0200\n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.1.1\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
  "X-Poedit-KeywordsList: __\n"
17
  "X-Poedit-SearchPath-0: .\n"
18
 
19
+ #: iubenda_cookie_solution.php:502
20
  msgid "Code"
21
  msgstr ""
22
 
23
+ #: iubenda_cookie_solution.php:503
24
  msgid "Scripts blocking"
25
  msgstr ""
26
 
27
+ #: iubenda_cookie_solution.php:504
28
  msgid "Content type"
29
  msgstr ""
30
 
31
+ #: iubenda_cookie_solution.php:505
32
  msgid "RSS feed"
33
  msgstr ""
34
 
35
+ #: iubenda_cookie_solution.php:506
36
  msgid "Menu position"
37
  msgstr ""
38
 
39
+ #: iubenda_cookie_solution.php:507
40
  msgid "Deactivation"
41
  msgstr ""
42
 
43
+ #: iubenda_cookie_solution.php:557
44
  #, php-format
45
  msgid "Enter the iubenda code for %s."
46
  msgstr ""
47
 
48
+ #: iubenda_cookie_solution.php:568
49
  msgid "Enter the iubenda code."
50
  msgstr ""
51
 
52
+ #: iubenda_cookie_solution.php:581
53
  msgid "Automatically block scripts detected by the plugin."
54
  msgstr ""
55
 
56
+ #: iubenda_cookie_solution.php:582
57
  #, php-format
58
  msgid ""
59
  "see <a href=\"%s\" target=\"_blank\">our documentation</a> for the list of "
60
  "detected scripts."
61
  msgstr ""
62
 
63
+ #: iubenda_cookie_solution.php:585
64
+ msgid "Primary"
65
  msgstr ""
66
 
67
+ #: iubenda_cookie_solution.php:586
68
+ msgid "Secondary"
69
  msgstr ""
70
 
71
+ #: iubenda_cookie_solution.php:587
72
  msgid "Select parsing engine."
73
  msgstr ""
74
 
75
+ #: iubenda_cookie_solution.php:590
76
  msgid ""
77
  "Leave scripts untouched on the page if the user has already given consent"
78
  msgstr ""
79
 
80
+ #: iubenda_cookie_solution.php:591
81
  msgid ""
82
  "improves performance, highly recommended, to be deactivated only if your "
83
  "site uses a caching system"
84
  msgstr ""
85
 
86
+ #: iubenda_cookie_solution.php:605
87
  msgid ""
88
  "Restrict the plugin to run only for requests that have \"Content-type: "
89
  "text / html\" (recommended)"
90
  msgstr ""
91
 
92
+ #: iubenda_cookie_solution.php:617
93
  msgid "Do not run the plugin inside the RSS feed (recommended)"
94
  msgstr ""
95
 
96
+ #: iubenda_cookie_solution.php:629
97
  msgid "Top menu"
98
  msgstr ""
99
 
100
+ #: iubenda_cookie_solution.php:630
101
  msgid "Submenu"
102
  msgstr ""
103
 
104
+ #: iubenda_cookie_solution.php:631
105
  msgid ""
106
  "Select whether to display iubenda in a top admin menu or the Settings "
107
  "submenu."
108
  msgstr ""
109
 
110
+ #: iubenda_cookie_solution.php:643
111
  msgid "Delete all plugin data upon deactivation?"
112
  msgstr ""
113
 
114
+ #: iubenda_cookie_solution.php:680
115
  msgid "Settings saved."
116
  msgstr ""
117
 
118
+ #: iubenda_cookie_solution.php:691
119
  msgid "Settings restored to defaults."
120
  msgstr ""
121
 
122
+ #: iubenda_cookie_solution.php:737
123
  msgid "You don't have permission to access this page."
124
  msgstr ""
125
 
126
+ #: iubenda_cookie_solution.php:746
127
  msgid ""
128
  "This plugin is the easiest and most comprehensive way to adapt your "
129
  "WordPress site to the European cookie law. Upon your user's first visit, "
134
  "script reactivation without refreshing the page."
135
  msgstr ""
136
 
137
+ #: iubenda_cookie_solution.php:749
138
  msgid "Would you like to know more about the cookie law?"
139
  msgstr ""
140
 
141
+ #: iubenda_cookie_solution.php:750
142
  #, php-format
143
  msgid ""
144
  "Read our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">complete "
145
  "guide to the cookie law.</a>"
146
  msgstr ""
147
 
148
+ #: iubenda_cookie_solution.php:753
149
  msgid "What is the full functionality of the plugin?"
150
  msgstr ""
151
 
152
+ #: iubenda_cookie_solution.php:754
153
  #, php-format
154
  msgid ""
155
  "Visit our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">plugin "
156
  "page.</a>"
157
  msgstr ""
158
 
159
+ #: iubenda_cookie_solution.php:757
160
  msgid "Enter the iubenda code for the Cookie Solution below."
161
  msgstr ""
162
 
163
+ #: iubenda_cookie_solution.php:758
164
  #, php-format
165
  msgid ""
166
  "In order to run the plugin, you need to enter the iubenda code that "
169
  "class=\"iubenda-url\" target=\"_blank\">this guide.</a>"
170
  msgstr ""
171
 
172
+ #: iubenda_cookie_solution.php:769
173
  msgid "Reset to defaults"
174
  msgstr ""
175
 
176
+ #: iubenda_cookie_solution.php:775
177
  msgid "Need support for this plugin?"
178
  msgstr ""
179
 
180
+ #: iubenda_cookie_solution.php:776
181
  #, php-format
182
  msgid ""
183
  "Visit our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank\">support "
184
  "forum.</a>"
185
  msgstr ""
186
 
187
+ #: iubenda_cookie_solution.php:779
188
  msgid "Want to try a beta version of this plugin with the latest features?"
189
  msgstr ""
190
 
191
+ #: iubenda_cookie_solution.php:780
192
  #, php-format
193
  msgid ""
194
  "Visit our <a href=\"%s\" class=\"iubenda-url\" target=\"_blank"
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link:
4
  Tags: cookies, cookie law, cookie policy, cookie banner, cookie block, privacy policy, cookie consent, privacy
5
  Requires at least: 4.0
6
  Requires PHP: 5.2.4
7
- Tested up to: 4.9.6
8
- Stable tag: 1.15.1
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
11
 
@@ -113,6 +113,10 @@ We will be very happy to receive feedback here: [Uservoice forum](http://support
113
 
114
  == Changelog ==
115
 
 
 
 
 
116
  = 1.15.1 =
117
  * Fix: iubenda code field removing HTML tags on save
118
  * Tweak: Adjusted the script blocking regex in shortcode
@@ -301,6 +305,5 @@ We will be very happy to receive feedback here: [Uservoice forum](http://support
301
 
302
  == Upgrade Notice ==
303
 
304
- = 1.15.1 =
305
- * Fix: iubenda code field removing HTML tags on save
306
- * Tweak: Adjusted the script blocking regex in shortcode
4
  Tags: cookies, cookie law, cookie policy, cookie banner, cookie block, privacy policy, cookie consent, privacy
5
  Requires at least: 4.0
6
  Requires PHP: 5.2.4
7
+ Tested up to: 4.9.8
8
+ Stable tag: 1.15.2
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
11
 
113
 
114
  == Changelog ==
115
 
116
+ = 1.15.2 =
117
+ * Tweak: Update and unify iubenda parsing engine
118
+ * Tweak: Polylang Pro support
119
+
120
  = 1.15.1 =
121
  * Fix: iubenda code field removing HTML tags on save
122
  * Tweak: Adjusted the script blocking regex in shortcode
305
 
306
  == Upgrade Notice ==
307
 
308
+ = 1.15.2 =
309
+ * Tweak: Polylang Pro support