Version Description
- New: Introducing a way to skip specific script parsing
- Fix: Google ReCaptcha with Contact Form 7 initialization issue
- Fix: Improved handling of iubenda script HTML
- Tweak: Support links update
Download this release
Release Info
Developer | dfactory |
Plugin | iubenda Cookie Solution for GDPR |
Version | 1.15.8 |
Comparing to | |
See all releases |
Code changes from version 1.15.7 to 1.15.8
- iubenda-cookie-class/README.md +6 -0
- iubenda-cookie-class/iubenda.class.php +142 -12
- iubenda_cookie_solution.php +68 -21
- readme.txt +12 -5
iubenda-cookie-class/README.md
CHANGED
@@ -98,6 +98,12 @@ These operations take place in accordance with the rules explained in [this guid
|
|
98 |
|
99 |
## Changelog
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
##### 3.1.1
|
102 |
* Tweak: Update composer.json autoloader
|
103 |
|
98 |
|
99 |
## Changelog
|
100 |
|
101 |
+
##### 3.2.0
|
102 |
+
* New: Introducing a way to skip specific script parsing
|
103 |
+
|
104 |
+
##### 3.1.2
|
105 |
+
* Tweak: Improved Youtube and Google Maps support
|
106 |
+
|
107 |
##### 3.1.1
|
108 |
* Tweak: Update composer.json autoloader
|
109 |
|
iubenda-cookie-class/iubenda.class.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* iubenda.class.php
|
4 |
-
* version: 3.
|
5 |
* @author: Copyright 2019 iubenda
|
6 |
* @license GNU/GPL
|
7 |
* This program is free software: you can redistribute it and/or modify
|
@@ -23,6 +23,7 @@ class iubendaParser {
|
|
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(
|
@@ -132,15 +133,20 @@ class iubendaParser {
|
|
132 |
|
133 |
private $type = 'page';
|
134 |
public $iub_comments_detected = array();
|
|
|
|
|
135 |
public $iframes_detected = array();
|
136 |
public $iframes_converted = array();
|
|
|
137 |
public $scripts_detected = array();
|
138 |
public $scripts_converted = array();
|
|
|
139 |
public $scripts_inline_detected = array();
|
140 |
public $scripts_inline_converted = array();
|
141 |
private $iub_empty = '//cdn.iubenda.com/cookie_solution/empty.html';
|
142 |
private $iub_class = '_iub_cs_activate';
|
143 |
private $iub_class_inline = '_iub_cs_activate-inline';
|
|
|
144 |
|
145 |
/**
|
146 |
* Construct: the whole HTML output of the page
|
@@ -250,7 +256,46 @@ class iubendaParser {
|
|
250 |
break;
|
251 |
|
252 |
default:
|
253 |
-
$js = $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
break;
|
255 |
}
|
256 |
}
|
@@ -275,9 +320,25 @@ class iubendaParser {
|
|
275 |
|
276 |
if ( is_array( $scripts ) ) {
|
277 |
$count = count( $scripts );
|
|
|
278 |
|
279 |
for ( $j = 0; $j < $count; $j ++ ) {
|
280 |
$s = $scripts[$j];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
|
282 |
if ( ! empty( $s->innertext ) ) {
|
283 |
$this->scripts_inline_detected[] = $s->innertext;
|
@@ -400,6 +461,7 @@ class iubendaParser {
|
|
400 |
$script_tags = $this->auto_script_tags;
|
401 |
$class = $this->iub_class;
|
402 |
$class_inline = $this->iub_class_inline;
|
|
|
403 |
|
404 |
// create new DOM document
|
405 |
$document = new DOMDocument();
|
@@ -418,6 +480,23 @@ class iubendaParser {
|
|
418 |
if ( ! empty( $scripts ) && is_object( $scripts ) ) {
|
419 |
foreach ( $scripts as $script ) {
|
420 |
$src = $script->getAttribute( 'src' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
421 |
|
422 |
// add script as detected
|
423 |
if ( ! empty( $src ) )
|
@@ -467,12 +546,26 @@ class iubendaParser {
|
|
467 |
|
468 |
if ( is_object( $html ) ) {
|
469 |
$iframes = $html->find( 'iframe' );
|
470 |
-
|
471 |
if ( is_array( $iframes ) ) {
|
472 |
$count = count( $iframes );
|
473 |
-
|
|
|
474 |
for ( $j = 0; $j < $count; $j ++ ) {
|
475 |
$i = $iframes[$j];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
476 |
$src = $i->src;
|
477 |
$this->iframes_detected[] = $src;
|
478 |
|
@@ -497,6 +590,7 @@ class iubendaParser {
|
|
497 |
$iframe_tags = $this->auto_iframe_tags;
|
498 |
$empty = $this->iub_empty;
|
499 |
$class = $this->iub_class;
|
|
|
500 |
|
501 |
// create new DOM document
|
502 |
$document = new DOMDocument();
|
@@ -515,6 +609,18 @@ class iubendaParser {
|
|
515 |
if ( ! empty( $iframes ) && is_object( $iframes ) ) {
|
516 |
foreach ( $iframes as $iframe ) {
|
517 |
$src = $iframe->getAttribute( 'src' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
|
519 |
// add iframe as detected
|
520 |
$this->iframes_detected[] = $src;
|
@@ -522,7 +628,7 @@ class iubendaParser {
|
|
522 |
if ( self::strpos_array( $src, $iframe_tags ) ) {
|
523 |
$iframe->setAttribute( 'src', $empty );
|
524 |
$iframe->setAttribute( 'suppressedsrc', $src );
|
525 |
-
$iframe->setAttribute( 'class', $
|
526 |
|
527 |
// add iframe as converted
|
528 |
$this->iframes_converted[] = $src;
|
@@ -542,11 +648,36 @@ class iubendaParser {
|
|
542 |
}
|
543 |
|
544 |
/**
|
545 |
-
* Parse all IUBENDAs
|
546 |
*
|
547 |
-
* @return
|
548 |
*/
|
549 |
public function parse_comments() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
550 |
foreach ( array( 'IUB_REGEX_PATTERN', 'IUB_REGEX_PATTERN_2' ) as $pattern ) {
|
551 |
preg_match_all( constant( 'self::' . $pattern ), $this->content_page, $scripts );
|
552 |
|
@@ -557,17 +688,16 @@ class iubendaParser {
|
|
557 |
|
558 |
for ( $j = 0; $j < $count; $j++ ) {
|
559 |
$this->iub_comments_detected[] = $scripts[1][$j];
|
|
|
560 |
// get HTML dom from string
|
561 |
$html = str_get_html( $scripts[1][$j], $lowercase = true, $force_tags_closed = true, $strip = false );
|
|
|
562 |
// convert scripts, iframes and other code inside IUBENDAs comment in text/plain to not generate cookies
|
563 |
$js_scripts[] = $this->create_tags( $html );
|
564 |
}
|
565 |
|
566 |
-
if ( is_array( $scripts[1] ) && is_array( $js_scripts ) )
|
567 |
-
|
568 |
-
$this->content_page = strtr( $this->content_page, array_combine( $scripts[1], $js_scripts ) );
|
569 |
-
}
|
570 |
-
}
|
571 |
}
|
572 |
}
|
573 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* iubenda.class.php
|
4 |
+
* version: 3.2.0
|
5 |
* @author: Copyright 2019 iubenda
|
6 |
* @license GNU/GPL
|
7 |
* This program is free software: you can redistribute it and/or modify
|
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 |
+
const IUB_REGEX_SKIP_PATTERN = '/<!--\s*IUB-COOKIE-BLOCK-SKIP-START\s*-->(.*?)<!--\s*IUB-COOKIE-BLOCK-SKIP-END\s*-->/s';
|
27 |
|
28 |
// scripts
|
29 |
public $auto_script_tags = array(
|
133 |
|
134 |
private $type = 'page';
|
135 |
public $iub_comments_detected = array();
|
136 |
+
public $skipped_comments_detected = array();
|
137 |
+
public $iframes_skipped = array();
|
138 |
public $iframes_detected = array();
|
139 |
public $iframes_converted = array();
|
140 |
+
public $scripts_skipped = array();
|
141 |
public $scripts_detected = array();
|
142 |
public $scripts_converted = array();
|
143 |
+
public $scripts_inline_skipped = array();
|
144 |
public $scripts_inline_detected = array();
|
145 |
public $scripts_inline_converted = array();
|
146 |
private $iub_empty = '//cdn.iubenda.com/cookie_solution/empty.html';
|
147 |
private $iub_class = '_iub_cs_activate';
|
148 |
private $iub_class_inline = '_iub_cs_activate-inline';
|
149 |
+
private $iub_class_skip = '_iub_cs_skip';
|
150 |
|
151 |
/**
|
152 |
* Construct: the whole HTML output of the page
|
256 |
break;
|
257 |
|
258 |
default:
|
259 |
+
$js = $e->outertext;
|
260 |
+
break;
|
261 |
+
}
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
return $js;
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Skip scripts and iframes inside IUBENDAs comments.
|
270 |
+
*
|
271 |
+
* @param string $content
|
272 |
+
* @return string
|
273 |
+
*/
|
274 |
+
public function skip_tags( $content ) {
|
275 |
+
$elements = $content->find( "*" );
|
276 |
+
$js = '';
|
277 |
+
|
278 |
+
if ( is_array( $elements ) ) {
|
279 |
+
$count = count( $elements );
|
280 |
+
|
281 |
+
for ( $j = 0; $j < $count; $j++ ) {
|
282 |
+
$element = $elements[$j];
|
283 |
+
|
284 |
+
switch ( $element->tag ) {
|
285 |
+
case 'script':
|
286 |
+
$class = trim( $element->class );
|
287 |
+
$element->class = ( $class !== '' ? $class . ' ' : '' ) . $this->iub_class_skip;
|
288 |
+
$js .= $element->outertext;
|
289 |
+
break;
|
290 |
+
|
291 |
+
case 'iframe':
|
292 |
+
$class = trim( $element->class );
|
293 |
+
$element->class = ( $class !== '' ? $class . ' ' : '' ) . $this->iub_class_skip;
|
294 |
+
$js .= $element->outertext;
|
295 |
+
break;
|
296 |
+
|
297 |
+
default:
|
298 |
+
$js .= $element->outertext;
|
299 |
break;
|
300 |
}
|
301 |
}
|
320 |
|
321 |
if ( is_array( $scripts ) ) {
|
322 |
$count = count( $scripts );
|
323 |
+
$class_skip = $this->iub_class_skip;
|
324 |
|
325 |
for ( $j = 0; $j < $count; $j ++ ) {
|
326 |
$s = $scripts[$j];
|
327 |
+
$script_class = trim( $s->class );
|
328 |
+
|
329 |
+
if ( $script_class !== '' ) {
|
330 |
+
$classes = explode( ' ', $script_class );
|
331 |
+
|
332 |
+
if ( in_array( $class_skip, $classes, true ) ) {
|
333 |
+
// add script as skipped
|
334 |
+
if ( ! empty( $s->innertext ) )
|
335 |
+
$this->scripts_inline_skipped[] = $s->innertext;
|
336 |
+
else
|
337 |
+
$this->scripts_skipped[] = $s->src;
|
338 |
+
|
339 |
+
continue;
|
340 |
+
}
|
341 |
+
}
|
342 |
|
343 |
if ( ! empty( $s->innertext ) ) {
|
344 |
$this->scripts_inline_detected[] = $s->innertext;
|
461 |
$script_tags = $this->auto_script_tags;
|
462 |
$class = $this->iub_class;
|
463 |
$class_inline = $this->iub_class_inline;
|
464 |
+
$class_skip = $this->iub_class_skip;
|
465 |
|
466 |
// create new DOM document
|
467 |
$document = new DOMDocument();
|
480 |
if ( ! empty( $scripts ) && is_object( $scripts ) ) {
|
481 |
foreach ( $scripts as $script ) {
|
482 |
$src = $script->getAttribute( 'src' );
|
483 |
+
$script_class = trim( $script->getAttribute( 'class' ) );
|
484 |
+
|
485 |
+
if ( $script_class !== '' ) {
|
486 |
+
$classes = explode( ' ', $script_class );
|
487 |
+
|
488 |
+
if ( in_array( $class_skip, $classes, true ) ) {
|
489 |
+
// add script as skipped
|
490 |
+
if ( ! empty( $src ) )
|
491 |
+
$this->scripts_skipped[] = $src;
|
492 |
+
|
493 |
+
// add inline script as skipped
|
494 |
+
if ( ! empty( $script->nodeValue ) )
|
495 |
+
$this->scripts_inline_skipped[] = $script->nodeValue;
|
496 |
+
|
497 |
+
continue;
|
498 |
+
}
|
499 |
+
}
|
500 |
|
501 |
// add script as detected
|
502 |
if ( ! empty( $src ) )
|
546 |
|
547 |
if ( is_object( $html ) ) {
|
548 |
$iframes = $html->find( 'iframe' );
|
549 |
+
|
550 |
if ( is_array( $iframes ) ) {
|
551 |
$count = count( $iframes );
|
552 |
+
$class_skip = $this->iub_class_skip;
|
553 |
+
|
554 |
for ( $j = 0; $j < $count; $j ++ ) {
|
555 |
$i = $iframes[$j];
|
556 |
+
$iframe_class = trim( $i->class );
|
557 |
+
|
558 |
+
if ( $iframe_class !== '' ) {
|
559 |
+
$classes = explode( ' ', $iframe_class );
|
560 |
+
|
561 |
+
if ( in_array( $class_skip, $classes, true ) ) {
|
562 |
+
// add iframe as skipped
|
563 |
+
$this->iframes_skipped[] = $i->src;
|
564 |
+
|
565 |
+
continue;
|
566 |
+
}
|
567 |
+
}
|
568 |
+
|
569 |
$src = $i->src;
|
570 |
$this->iframes_detected[] = $src;
|
571 |
|
590 |
$iframe_tags = $this->auto_iframe_tags;
|
591 |
$empty = $this->iub_empty;
|
592 |
$class = $this->iub_class;
|
593 |
+
$class_skip = $this->iub_class_skip;
|
594 |
|
595 |
// create new DOM document
|
596 |
$document = new DOMDocument();
|
609 |
if ( ! empty( $iframes ) && is_object( $iframes ) ) {
|
610 |
foreach ( $iframes as $iframe ) {
|
611 |
$src = $iframe->getAttribute( 'src' );
|
612 |
+
$iframe_class = trim( $iframe->getAttribute( 'class' ) );
|
613 |
+
|
614 |
+
if ( $iframe_class !== '' ) {
|
615 |
+
$classes = explode( ' ', $iframe_class );
|
616 |
+
|
617 |
+
if ( in_array( $class_skip, $classes, true ) ) {
|
618 |
+
// add iframe as skipped
|
619 |
+
$this->iframes_skipped[] = $src;
|
620 |
+
|
621 |
+
continue;
|
622 |
+
}
|
623 |
+
}
|
624 |
|
625 |
// add iframe as detected
|
626 |
$this->iframes_detected[] = $src;
|
628 |
if ( self::strpos_array( $src, $iframe_tags ) ) {
|
629 |
$iframe->setAttribute( 'src', $empty );
|
630 |
$iframe->setAttribute( 'suppressedsrc', $src );
|
631 |
+
$iframe->setAttribute( 'class', $iframe_class . ' ' . $class );
|
632 |
|
633 |
// add iframe as converted
|
634 |
$this->iframes_converted[] = $src;
|
648 |
}
|
649 |
|
650 |
/**
|
651 |
+
* Parse all IUBENDAs comments.
|
652 |
*
|
653 |
+
* @return void
|
654 |
*/
|
655 |
public function parse_comments() {
|
656 |
+
// skip
|
657 |
+
preg_match_all( constant( 'self::IUB_REGEX_SKIP_PATTERN' ), $this->content_page, $scripts );
|
658 |
+
|
659 |
+
// found any content?
|
660 |
+
if ( is_array( $scripts[1] ) ) {
|
661 |
+
$count = count( $scripts[1] );
|
662 |
+
$js_scripts = array();
|
663 |
+
|
664 |
+
for ( $j = 0; $j < $count; $j++ ) {
|
665 |
+
$this->skipped_comments_detected[] = $scripts[1][$j];
|
666 |
+
|
667 |
+
// get HTML dom from string
|
668 |
+
$html = str_get_html( $scripts[1][$j], true, true, false );
|
669 |
+
|
670 |
+
// skip scripts and iframes inside IUBENDAs comments
|
671 |
+
$js_scripts[] = $this->skip_tags( $html );
|
672 |
+
}
|
673 |
+
|
674 |
+
if ( ( is_array( $scripts[1] ) && is_array( $js_scripts ) ) && ( $count >= 1 && count( $js_scripts ) >= 1 ) )
|
675 |
+
$this->content_page = strtr( $this->content_page, array_combine( $scripts[1], $js_scripts ) );
|
676 |
+
}
|
677 |
+
|
678 |
+
unset( $scripts );
|
679 |
+
|
680 |
+
// block
|
681 |
foreach ( array( 'IUB_REGEX_PATTERN', 'IUB_REGEX_PATTERN_2' ) as $pattern ) {
|
682 |
preg_match_all( constant( 'self::' . $pattern ), $this->content_page, $scripts );
|
683 |
|
688 |
|
689 |
for ( $j = 0; $j < $count; $j++ ) {
|
690 |
$this->iub_comments_detected[] = $scripts[1][$j];
|
691 |
+
|
692 |
// get HTML dom from string
|
693 |
$html = str_get_html( $scripts[1][$j], $lowercase = true, $force_tags_closed = true, $strip = false );
|
694 |
+
|
695 |
// convert scripts, iframes and other code inside IUBENDAs comment in text/plain to not generate cookies
|
696 |
$js_scripts[] = $this->create_tags( $html );
|
697 |
}
|
698 |
|
699 |
+
if ( ( is_array( $scripts[1] ) && is_array( $js_scripts ) ) && ( $count >= 1 && count( $js_scripts ) >= 1 ) )
|
700 |
+
$this->content_page = strtr( $this->content_page, array_combine( $scripts[1], $js_scripts ) );
|
|
|
|
|
|
|
701 |
}
|
702 |
}
|
703 |
}
|
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.
|
7 |
Author: iubenda
|
8 |
Author URI: https://www.iubenda.com
|
9 |
License: MIT License
|
@@ -53,7 +53,7 @@ class iubenda_Cookie_Law_Solution {
|
|
53 |
'custom_iframes' => array(),
|
54 |
'deactivation' => false
|
55 |
);
|
56 |
-
public $version = '1.15.
|
57 |
public $no_html = false;
|
58 |
public $links = array();
|
59 |
public $multilang = false;
|
@@ -131,23 +131,19 @@ class iubenda_Cookie_Law_Solution {
|
|
131 |
// load iubenda parser
|
132 |
require_once( dirname( __FILE__ ) . '/iubenda-cookie-class/iubenda.class.php' );
|
133 |
|
134 |
-
// google recaptcha v3 compatibility
|
135 |
-
if ( class_exists( 'WPCF7' ) && (int) WPCF7::get_option( 'iqfix_recaptcha' ) === 0 && ! iubendaParser::consent_given() )
|
136 |
-
$this->options['custom_scripts'][] = 'grecaptcha';
|
137 |
-
|
138 |
$links = array(
|
139 |
'en' => array(
|
140 |
'guide' => 'https://www.iubenda.com/en/iubenda-cookie-law-solution',
|
141 |
'plugin_page' => 'https://www.iubenda.com/en/help/posts/1215',
|
142 |
'generating_code' => 'https://www.iubenda.com/en/help/posts/1177',
|
143 |
-
'support_forum' => 'https://support.iubenda.com/
|
144 |
'documentation' => 'https://www.iubenda.com/en/help/posts/1215'
|
145 |
),
|
146 |
'it' => array(
|
147 |
'guide' => 'https://www.iubenda.com/it/soluzione-cookie-law',
|
148 |
'plugin_page' => 'https://www.iubenda.com/it/help/posts/810',
|
149 |
'generating_code' => 'https://www.iubenda.com/it/help/posts/680',
|
150 |
-
'support_forum' => 'https://support.iubenda.com/
|
151 |
'documentation' => 'https://www.iubenda.com/it/help/posts/810',
|
152 |
)
|
153 |
);
|
@@ -245,19 +241,32 @@ class iubenda_Cookie_Law_Solution {
|
|
245 |
* @return void
|
246 |
*/
|
247 |
public function register_shortcode() {
|
248 |
-
add_shortcode( 'iub-cookie-policy', array( $this, '
|
|
|
|
|
249 |
}
|
250 |
|
251 |
/**
|
252 |
-
* Handle shortcode function.
|
253 |
*
|
254 |
* @param array $atts
|
255 |
* @param mixed $content
|
256 |
* @return mixed
|
257 |
*/
|
258 |
-
public function
|
259 |
return '<!--IUB-COOKIE-BLOCK-START-->' . do_shortcode( $content ) . '<!--IUB-COOKIE-BLOCK-END-->';
|
260 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
|
262 |
/**
|
263 |
* Add submenu.
|
@@ -393,7 +402,7 @@ class iubenda_Cookie_Law_Solution {
|
|
393 |
} else
|
394 |
$iubenda_code .= $this->options['code_default'];
|
395 |
|
396 |
-
$iubenda_code =
|
397 |
|
398 |
if ( $iubenda_code !== '' ) {
|
399 |
$iubenda_code .= "\n
|
@@ -415,7 +424,7 @@ class iubenda_Cookie_Law_Solution {
|
|
415 |
}
|
416 |
</script>";
|
417 |
|
418 |
-
echo $iubenda_code;
|
419 |
}
|
420 |
}
|
421 |
|
@@ -482,6 +491,10 @@ class iubenda_Cookie_Law_Solution {
|
|
482 |
if ( iubendaParser::bot_detected() || $_POST || $this->no_html )
|
483 |
return $output;
|
484 |
|
|
|
|
|
|
|
|
|
485 |
$startime = microtime( true );
|
486 |
$output = apply_filters( 'iubenda_initial_output', $output );
|
487 |
|
@@ -566,9 +579,9 @@ class iubenda_Cookie_Law_Solution {
|
|
566 |
<div id="contextual-help-tabs-wrap" class="contextual-help-tabs-wrap">';
|
567 |
foreach ( $this->languages as $lang_id => $lang_name ) {
|
568 |
// get code for the language
|
569 |
-
$code = ! empty( $this->options['code_' . $lang_id] ) ? html_entity_decode(
|
570 |
// handle default, if empty
|
571 |
-
$code = empty( $code ) && $lang_id == $this->lang_default ? html_entity_decode(
|
572 |
|
573 |
echo '
|
574 |
<div id="tab-panel-' . $lang_id . '" class="help-tab-content' . ( $this->lang_default == $lang_id ? ' active' : '' ) . '">
|
@@ -583,7 +596,7 @@ class iubenda_Cookie_Law_Solution {
|
|
583 |
} else {
|
584 |
echo '
|
585 |
<div id="iub_code_default">
|
586 |
-
<textarea name="iubenda_cookie_law_solution[code_default]" class="large-text" cols="50" rows="10">' . html_entity_decode(
|
587 |
<p class="description">' . __( 'Enter the iubenda code.', 'iubenda-cookie-law-solution' ) . '</p>
|
588 |
</div>';
|
589 |
}
|
@@ -719,16 +732,15 @@ class iubenda_Cookie_Law_Solution {
|
|
719 |
// multilang support
|
720 |
if ( $this->multilang && ! empty( $this->languages ) ) {
|
721 |
foreach ( $this->languages as $lang_id => $lang_name ) {
|
722 |
-
$input['code_' . $lang_id] = ! empty( $input['code_' . $lang_id] ) ?
|
723 |
|
724 |
// handle default lang too
|
725 |
if ( $lang_id == $this->lang_default ) {
|
726 |
-
$input['code_default'] = ! empty( $input['code_' . $lang_id] ) ?
|
727 |
}
|
728 |
}
|
729 |
-
} else
|
730 |
-
$input['code_default'] = ! empty( $input['code_default'] ) ?
|
731 |
-
}
|
732 |
|
733 |
// scripts
|
734 |
if ( isset( $input['custom_scripts'] ) ) {
|
@@ -763,12 +775,47 @@ class iubenda_Cookie_Law_Solution {
|
|
763 |
$input['code_' . $lang_id] = '';
|
764 |
}
|
765 |
}
|
|
|
766 |
add_settings_error( 'iub_settings_errors', 'iub_settings_restored', __( 'Settings restored to defaults.', 'iubenda-cookie-law-solution' ), 'updated' );
|
767 |
}
|
768 |
|
769 |
return $input;
|
770 |
}
|
771 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
772 |
/**
|
773 |
* Get allowed iubenda script HTML.
|
774 |
*
|
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.8
|
7 |
Author: iubenda
|
8 |
Author URI: https://www.iubenda.com
|
9 |
License: MIT License
|
53 |
'custom_iframes' => array(),
|
54 |
'deactivation' => false
|
55 |
);
|
56 |
+
public $version = '1.15.8';
|
57 |
public $no_html = false;
|
58 |
public $links = array();
|
59 |
public $multilang = false;
|
131 |
// load iubenda parser
|
132 |
require_once( dirname( __FILE__ ) . '/iubenda-cookie-class/iubenda.class.php' );
|
133 |
|
|
|
|
|
|
|
|
|
134 |
$links = array(
|
135 |
'en' => array(
|
136 |
'guide' => 'https://www.iubenda.com/en/iubenda-cookie-law-solution',
|
137 |
'plugin_page' => 'https://www.iubenda.com/en/help/posts/1215',
|
138 |
'generating_code' => 'https://www.iubenda.com/en/help/posts/1177',
|
139 |
+
'support_forum' => 'https://support.iubenda.com/support/home',
|
140 |
'documentation' => 'https://www.iubenda.com/en/help/posts/1215'
|
141 |
),
|
142 |
'it' => array(
|
143 |
'guide' => 'https://www.iubenda.com/it/soluzione-cookie-law',
|
144 |
'plugin_page' => 'https://www.iubenda.com/it/help/posts/810',
|
145 |
'generating_code' => 'https://www.iubenda.com/it/help/posts/680',
|
146 |
+
'support_forum' => 'https://support.iubenda.com/support/home',
|
147 |
'documentation' => 'https://www.iubenda.com/it/help/posts/810',
|
148 |
)
|
149 |
);
|
241 |
* @return void
|
242 |
*/
|
243 |
public function register_shortcode() {
|
244 |
+
add_shortcode( 'iub-cookie-policy', array( $this, 'block_shortcode' ) );
|
245 |
+
add_shortcode( 'iub-cookie-block', array( $this, 'block_shortcode' ) );
|
246 |
+
add_shortcode( 'iub-cookie-skip', array( $this, 'skip_shortcode' ) );
|
247 |
}
|
248 |
|
249 |
/**
|
250 |
+
* Handle block shortcode function.
|
251 |
*
|
252 |
* @param array $atts
|
253 |
* @param mixed $content
|
254 |
* @return mixed
|
255 |
*/
|
256 |
+
public function block_shortcode( $atts, $content = '' ) {
|
257 |
return '<!--IUB-COOKIE-BLOCK-START-->' . do_shortcode( $content ) . '<!--IUB-COOKIE-BLOCK-END-->';
|
258 |
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Handle skip shortcode function.
|
262 |
+
*
|
263 |
+
* @param array $atts
|
264 |
+
* @param mixed $content
|
265 |
+
* @return mixed
|
266 |
+
*/
|
267 |
+
public function skip_shortcode( $atts, $content = '' ) {
|
268 |
+
return '<!--IUB-COOKIE-BLOCK-SKIP-START-->' . do_shortcode( $content ) . '<!--IUB-COOKIE-BLOCK-SKIP-END-->';
|
269 |
+
}
|
270 |
|
271 |
/**
|
272 |
* Add submenu.
|
402 |
} else
|
403 |
$iubenda_code .= $this->options['code_default'];
|
404 |
|
405 |
+
$iubenda_code = $this->parse_code( $iubenda_code, true );
|
406 |
|
407 |
if ( $iubenda_code !== '' ) {
|
408 |
$iubenda_code .= "\n
|
424 |
}
|
425 |
</script>";
|
426 |
|
427 |
+
echo '<!--IUB-COOKIE-SKIP-START-->' . $iubenda_code . '<!--IUB-COOKIE-SKIP-END-->';
|
428 |
}
|
429 |
}
|
430 |
|
491 |
if ( iubendaParser::bot_detected() || $_POST || $this->no_html )
|
492 |
return $output;
|
493 |
|
494 |
+
// google recaptcha v3 compatibility
|
495 |
+
if ( class_exists( 'WPCF7' ) && (int) WPCF7::get_option( 'iqfix_recaptcha' ) === 0 && ! iubendaParser::consent_given() )
|
496 |
+
$this->options['custom_scripts'][] = 'grecaptcha';
|
497 |
+
|
498 |
$startime = microtime( true );
|
499 |
$output = apply_filters( 'iubenda_initial_output', $output );
|
500 |
|
579 |
<div id="contextual-help-tabs-wrap" class="contextual-help-tabs-wrap">';
|
580 |
foreach ( $this->languages as $lang_id => $lang_name ) {
|
581 |
// get code for the language
|
582 |
+
$code = ! empty( $this->options['code_' . $lang_id] ) ? html_entity_decode( $this->parse_code( $this->options['code_' . $lang_id] ) ) : '';
|
583 |
// handle default, if empty
|
584 |
+
$code = empty( $code ) && $lang_id == $this->lang_default ? html_entity_decode( $this->parse_code( $this->options['code_default'] ) ) : $code;
|
585 |
|
586 |
echo '
|
587 |
<div id="tab-panel-' . $lang_id . '" class="help-tab-content' . ( $this->lang_default == $lang_id ? ' active' : '' ) . '">
|
596 |
} else {
|
597 |
echo '
|
598 |
<div id="iub_code_default">
|
599 |
+
<textarea name="iubenda_cookie_law_solution[code_default]" class="large-text" cols="50" rows="10">' . html_entity_decode( $this->parse_code( $this->options['code_default'] ) ) . '</textarea>
|
600 |
<p class="description">' . __( 'Enter the iubenda code.', 'iubenda-cookie-law-solution' ) . '</p>
|
601 |
</div>';
|
602 |
}
|
732 |
// multilang support
|
733 |
if ( $this->multilang && ! empty( $this->languages ) ) {
|
734 |
foreach ( $this->languages as $lang_id => $lang_name ) {
|
735 |
+
$input['code_' . $lang_id] = ! empty( $input['code_' . $lang_id] ) ? $this->parse_code( $input['code_' . $lang_id] ) : '';
|
736 |
|
737 |
// handle default lang too
|
738 |
if ( $lang_id == $this->lang_default ) {
|
739 |
+
$input['code_default'] = ! empty( $input['code_' . $lang_id] ) ? $this->parse_code( $input['code_' . $lang_id] ) : $this->options['code_default'];
|
740 |
}
|
741 |
}
|
742 |
+
} else
|
743 |
+
$input['code_default'] = ! empty( $input['code_default'] ) ? $this->parse_code( $input['code_default'] ) : '';
|
|
|
744 |
|
745 |
// scripts
|
746 |
if ( isset( $input['custom_scripts'] ) ) {
|
775 |
$input['code_' . $lang_id] = '';
|
776 |
}
|
777 |
}
|
778 |
+
|
779 |
add_settings_error( 'iub_settings_errors', 'iub_settings_restored', __( 'Settings restored to defaults.', 'iubenda-cookie-law-solution' ), 'updated' );
|
780 |
}
|
781 |
|
782 |
return $input;
|
783 |
}
|
784 |
|
785 |
+
/**
|
786 |
+
* Parse iubenda code.
|
787 |
+
*
|
788 |
+
* @param string $source
|
789 |
+
* @param bool $display
|
790 |
+
* @return string
|
791 |
+
*/
|
792 |
+
public function parse_code( $source, $display = false ) {
|
793 |
+
// return $source;
|
794 |
+
$source = trim( $source );
|
795 |
+
|
796 |
+
preg_match_all( '/(\"(?:html|content)\"(?:\s+)?\:(?:\s+)?)\"((?:.*?)(?:[^\\\\]))\"/s', $source, $matches );
|
797 |
+
|
798 |
+
// found subgroup?
|
799 |
+
if ( ! empty( $matches[1] ) && ! empty( $matches[2] ) ) {
|
800 |
+
foreach ( $matches[2] as $no => $match ) {
|
801 |
+
$source = str_replace( $matches[0][$no], $matches[1][$no] . '[[IUBENDA_TAG_START]]' . $match . '[[IUBENDA_TAG_END]]', $source );
|
802 |
+
}
|
803 |
+
|
804 |
+
// kses it
|
805 |
+
$source = wp_kses( $source, $this->get_allowed_html() );
|
806 |
+
|
807 |
+
preg_match_all( '/\[\[IUBENDA_TAG_START\]\](.*?)\[\[IUBENDA_TAG_END\]\]/s', $source, $matches_tags );
|
808 |
+
|
809 |
+
if ( ! empty( $matches_tags[1] ) ) {
|
810 |
+
foreach ( $matches_tags[1] as $no => $match ) {
|
811 |
+
$source = str_replace( $matches_tags[0][$no], '"' . ( $display ? str_replace( '</', '<\/', $matches[2][$no] ) : $matches[2][$no] ) . '"', $source );
|
812 |
+
}
|
813 |
+
}
|
814 |
+
}
|
815 |
+
|
816 |
+
return $source;
|
817 |
+
}
|
818 |
+
|
819 |
/**
|
820 |
* Get allowed iubenda script HTML.
|
821 |
*
|
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: 5.
|
8 |
-
Stable tag: 1.15.
|
9 |
License: MIT License
|
10 |
License URI: http://opensource.org/licenses/MIT
|
11 |
|
@@ -141,6 +141,12 @@ We will be very happy to receive feedback here: [Uservoice forum](http://support
|
|
141 |
|
142 |
== Changelog ==
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
= 1.15.7 =
|
145 |
* Fix: Google ReCaptcha loading issue with Contact Form 7
|
146 |
* Tweak: Improved Youtube and Google Maps script blocking
|
@@ -352,6 +358,7 @@ We will be very happy to receive feedback here: [Uservoice forum](http://support
|
|
352 |
|
353 |
== Upgrade Notice ==
|
354 |
|
355 |
-
= 1.15.
|
356 |
-
*
|
357 |
-
*
|
|
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: 5.2
|
8 |
+
Stable tag: 1.15.8
|
9 |
License: MIT License
|
10 |
License URI: http://opensource.org/licenses/MIT
|
11 |
|
141 |
|
142 |
== Changelog ==
|
143 |
|
144 |
+
= 1.15.8 =
|
145 |
+
* New: Introducing a way to skip specific script parsing
|
146 |
+
* Fix: Google ReCaptcha with Contact Form 7 initialization issue
|
147 |
+
* Fix: Improved handling of iubenda script HTML
|
148 |
+
* Tweak: Support links update
|
149 |
+
|
150 |
= 1.15.7 =
|
151 |
* Fix: Google ReCaptcha loading issue with Contact Form 7
|
152 |
* Tweak: Improved Youtube and Google Maps script blocking
|
358 |
|
359 |
== Upgrade Notice ==
|
360 |
|
361 |
+
= 1.15.8 =
|
362 |
+
* New: Introducing a way to skip specific script parsing
|
363 |
+
* Fix: Google ReCaptcha with Contact Form 7 initialization issue
|
364 |
+
* Fix: Improved handling of iubenda script HTML
|