Version Description
- Fixed a series of conflicts with AJAX requests, which were conflicting with Contact Form 7 and other plugins
Download this release
Release Info
Developer | Facens |
Plugin | iubenda Cookie Solution for GDPR |
Version | 1.10.19 |
Comparing to | |
See all releases |
Code changes from version 1.10.11 to 1.10.19
- iubenda-cookie-class/iubenda.class.php +79 -69
- iubenda-cookie-class/test.php +38 -20
- iubenda-cookie-class/usage.php +26 -9
- iubenda_cookie_solution.php +185 -106
- readme.txt +15 -11
iubenda-cookie-class/iubenda.class.php
CHANGED
@@ -1,17 +1,27 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
class Page {
|
12 |
-
|
13 |
const IUB_REGEX_PATTERN = '/<!--\s*IUB_COOKIE_POLICY_START\s*-->(.*?)<!--\s*IUB_COOKIE_POLICY_END\s*-->/sU';
|
14 |
-
|
15 |
public $auto_script_tags = array(
|
16 |
'platform.twitter.com/widgets.js',
|
17 |
'apis.google.com/js/plusone.js',
|
@@ -34,7 +44,7 @@
|
|
34 |
'maps.google.it/maps',
|
35 |
'www.google.com/maps/embed'
|
36 |
);
|
37 |
-
|
38 |
public $iub_comments_detected = array();
|
39 |
public $iframe_detected = array();
|
40 |
public $iframe_converted = array();
|
@@ -42,8 +52,8 @@
|
|
42 |
public $scripts_inline_detected = array();
|
43 |
public $scripts_inline_converted = array();
|
44 |
public $scripts_converted = array();
|
45 |
-
|
46 |
-
|
47 |
/*
|
48 |
construct: the whole HTML output of the page
|
49 |
*/
|
@@ -51,37 +61,37 @@
|
|
51 |
$this->original_content_page = $content_page;
|
52 |
$this->content_page = $content_page;
|
53 |
}
|
54 |
-
|
55 |
/*
|
56 |
print iubenda banner, parameter: the script code of iubenda to print the banner
|
57 |
*/
|
58 |
-
public function print_banner($banner){
|
59 |
return $banner.= "\n
|
60 |
<script>
|
61 |
var iCallback = function(){};
|
62 |
-
|
63 |
if('callback' in _iub.csConfiguration) {
|
64 |
if('onConsentGiven' in _iub.csConfiguration.callback) iCallback = _iub.csConfiguration.callback.onConsentGiven;
|
65 |
-
|
66 |
_iub.csConfiguration.callback.onConsentGiven = function()
|
67 |
{
|
68 |
iCallback();
|
69 |
-
|
70 |
/*
|
71 |
* Separator
|
72 |
*/
|
73 |
-
|
74 |
jQuery('noscript._no_script_iub').each(function (a, b) { var el = jQuery(b); el.after(el.html()); });
|
75 |
};
|
76 |
};
|
77 |
</script>";
|
78 |
}
|
79 |
-
|
80 |
/*
|
81 |
Static, detect bot & crawler
|
82 |
*/
|
83 |
static function bot_detected() {
|
84 |
-
return (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider/i', $_SERVER['HTTP_USER_AGENT']));
|
85 |
}
|
86 |
|
87 |
/*
|
@@ -93,6 +103,7 @@ if('callback' in _iub.csConfiguration) {
|
|
93 |
return true;
|
94 |
}
|
95 |
}
|
|
|
96 |
}
|
97 |
/*
|
98 |
Static, utility function: strpos for array
|
@@ -111,14 +122,14 @@ if('callback' in _iub.csConfiguration) {
|
|
111 |
}
|
112 |
return false;
|
113 |
}
|
114 |
-
|
115 |
|
116 |
/* Convert scripts, iframe and other code inside IUBENDAs comment in text/plain to not generate cookies */
|
117 |
public function create_tags($html){
|
118 |
-
|
119 |
$elements = $html->find("*");
|
120 |
$js = '';
|
121 |
-
|
122 |
if(is_array($elements)){
|
123 |
$count = count($elements);
|
124 |
for($j=0; $j<$count; $j++){
|
@@ -127,30 +138,28 @@ if('callback' in _iub.csConfiguration) {
|
|
127 |
case 'script':
|
128 |
$class = $e->class;
|
129 |
$e->class = $class . ' _iub_cs_activate';
|
130 |
-
$e->type = 'text/plain';
|
131 |
$js.= $e->outertext;
|
132 |
break;
|
133 |
-
|
134 |
case 'iframe':
|
135 |
$new_src = "//cdn.iubenda.com/cookie_solution/empty.html";
|
136 |
$class = $e->class;
|
137 |
$e->suppressedsrc = $e->src;
|
138 |
$e->src = $new_src;
|
139 |
-
$e->class = $class . ' _iub_cs_activate';
|
140 |
$js.= $e->outertext;
|
141 |
break;
|
142 |
-
|
143 |
default:
|
144 |
-
$js
|
145 |
-
$js.= $e->outertext;
|
146 |
-
$js.= '</noscript>';
|
147 |
break;
|
148 |
-
}
|
149 |
}
|
150 |
}
|
151 |
return $js;
|
152 |
}
|
153 |
-
|
154 |
/* Parse all IUBENDAs comment and convert the code inside with create_tags method */
|
155 |
public function parse_iubenda_comments(){
|
156 |
preg_match_all(self::IUB_REGEX_PATTERN, $this->content_page, $scripts);
|
@@ -158,20 +167,20 @@ if('callback' in _iub.csConfiguration) {
|
|
158 |
$count = count($scripts[1]);
|
159 |
$js_scripts = array();
|
160 |
for($j=0; $j<$count; $j++){
|
161 |
-
$this->iub_comments_detected[] = $scripts[1][$j];
|
162 |
$html = str_get_html($scripts[1][$j], $lowercase=true, $forceTagsClosed=true, $stripRN=false);
|
163 |
$js_scripts[] = $this->create_tags($html);
|
164 |
}
|
165 |
-
|
166 |
if(is_array($scripts[1]) && is_array($js_scripts)){
|
167 |
if(count($scripts[1]) >= 1 && count($js_scripts) >= 1){
|
168 |
$this->content_page = strtr($this->content_page, array_combine($scripts[1], $js_scripts));
|
169 |
}
|
170 |
-
}
|
171 |
-
}
|
172 |
}
|
173 |
-
|
174 |
-
/* Parse automatically all the scripts in the page and converts it in text/plain
|
175 |
if src or the whole output has inside one of the elements in $auto_script_tags array */
|
176 |
public function parse_scripts(){
|
177 |
|
@@ -188,7 +197,7 @@ if('callback' in _iub.csConfiguration) {
|
|
188 |
$class = $s->class;
|
189 |
$s->class = $class . ' _iub_cs_activate-inline';
|
190 |
$s->type = 'text/plain';
|
191 |
-
$this->scripts_converted[] = $s->innertext;
|
192 |
}
|
193 |
}else{
|
194 |
$src = $s->src;
|
@@ -208,9 +217,9 @@ if('callback' in _iub.csConfiguration) {
|
|
208 |
/*
|
209 |
* AdSense check by Peste Vasile Alexandru, AdSense here
|
210 |
*/
|
211 |
-
|
212 |
$ad_found = false;
|
213 |
-
|
214 |
while(preg_match("#google_ad_client =(.*?);#i", $html))
|
215 |
{
|
216 |
$ad_found = true;
|
@@ -219,49 +228,49 @@ if('callback' in _iub.csConfiguration) {
|
|
219 |
$ad_width = null;
|
220 |
$ad_height = null;
|
221 |
$ad_block = null;
|
222 |
-
|
223 |
/**/
|
224 |
-
|
225 |
preg_match("#google_ad_client =(.*?);#i", $html, $ad_client);
|
226 |
preg_match("#google_ad_slot =(.*?);#i", $html, $ad_slot);
|
227 |
preg_match("#google_ad_width =(.*?);#i", $html, $ad_width);
|
228 |
preg_match("#google_ad_height =(.*?);#i", $html, $ad_height);
|
229 |
-
|
230 |
/**/
|
231 |
-
|
232 |
$html = preg_replace("#google_ad_client =(.*?);#i", "", $html, 1);
|
233 |
$html = preg_replace("#google_ad_slot =(.*?);#i", "", $html, 1);
|
234 |
$html = preg_replace("#google_ad_width =(.*?);#i", "", $html, 1);
|
235 |
$html = preg_replace("#google_ad_height =(.*?);#i", "", $html, 1);
|
236 |
-
|
237 |
/**/
|
238 |
-
|
239 |
$ad_client = trim($ad_client[1]);
|
240 |
$ad_slot = trim($ad_slot[1]);
|
241 |
$ad_width = trim($ad_width[1]);
|
242 |
$ad_height = trim($ad_height[1]);
|
243 |
-
|
244 |
/**/
|
245 |
-
|
246 |
$ad_class = 'class="_iub_cs_activate_google_ads"';
|
247 |
$ad_style = 'style="width:'.$ad_width.'px; height:'.$ad_height.'px;"';
|
248 |
-
|
249 |
$ad_client = 'data-client='.$ad_client;
|
250 |
$ad_slot = 'data-slot='.$ad_slot;
|
251 |
$ad_width = 'data-width="'.$ad_width.'"';
|
252 |
$ad_height = 'data-height="'.$ad_height.'"';
|
253 |
-
|
254 |
/**/
|
255 |
-
|
256 |
$ad_block = "<div $ad_style $ad_class $ad_width $ad_height $ad_slot $ad_client></div>";
|
257 |
-
|
258 |
/**/
|
259 |
-
|
260 |
$html = preg_replace('#(<[^>]+) src="//pagead2.googlesyndication.com/pagead/show_ads.js"(.*?)</script>#i', $ad_block, $html, 1);
|
261 |
}
|
262 |
-
|
263 |
/**/
|
264 |
-
|
265 |
if($ad_found)
|
266 |
{
|
267 |
$adsense_callback =
|
@@ -302,34 +311,34 @@ if('callback' in _iub.csConfiguration) {
|
|
302 |
else
|
303 |
{
|
304 |
_iub.csConfiguration.callback = {};
|
305 |
-
|
306 |
_iub.csConfiguration.callback.onConsentGiven = iubenda_adsense_unblock;
|
307 |
}
|
308 |
</script>
|
309 |
";
|
310 |
-
|
311 |
$html = str_replace("</body>", $adsense_callback."</body>", $html);
|
312 |
}
|
313 |
-
|
314 |
/**/
|
315 |
-
|
316 |
$this->content_page = $html;
|
317 |
}
|
318 |
}
|
319 |
|
320 |
/* Parse automatically all the iframe in the page and change the src to suppressedsrc
|
321 |
-
if src has inside one of the elements in $auto_iframe_tags array */
|
322 |
public function parse_iframe(){
|
323 |
$html = str_get_html($this->content_page, $lowercase=true, $forceTagsClosed=true, $stripRN=false);
|
324 |
if(is_object($html)){
|
325 |
-
$iframes = $html->find("iframe");
|
326 |
if(is_array($iframes)){
|
327 |
$count = count($iframes);
|
328 |
for($j=0; $j<$count; $j++){
|
329 |
$i = $iframes[$j];
|
330 |
$src = $i->src;
|
331 |
$this->iframe_detected[] = $src;
|
332 |
-
if (Page::strpos_array($src, $this->auto_iframe_tags) !== false){
|
333 |
$new_src = "//cdn.iubenda.com/cookie_solution/empty.html";
|
334 |
$class = $i->class;
|
335 |
$i->suppressedsrc = $src;
|
@@ -342,23 +351,24 @@ if('callback' in _iub.csConfiguration) {
|
|
342 |
$this->content_page = $html;
|
343 |
}
|
344 |
}
|
345 |
-
|
346 |
/*
|
347 |
Call three methods to parse the page, iubendas comment, scripts + iframe
|
348 |
*/
|
349 |
-
public function parse()
|
|
|
350 |
$this->parse_iubenda_comments();
|
351 |
$this->parse_scripts();
|
352 |
$this->parse_iframe();
|
353 |
}
|
354 |
-
|
355 |
/*
|
356 |
Return the final page to output
|
357 |
*/
|
358 |
public function get_converted_page(){
|
359 |
return $this->content_page;
|
360 |
}
|
361 |
-
|
362 |
}
|
363 |
|
364 |
-
?>
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* iubenda.class.php
|
4 |
+
* version: 1.0.0.4
|
5 |
+
* @author: Copyright 2015 iubenda
|
6 |
+
* @license GNU/GPL
|
7 |
+
* This program is free software: you can redistribute it and/or modify
|
8 |
+
* it under the terms of the GNU General Public License as published by
|
9 |
+
* the Free Software Foundation, either version 3 of the License, or
|
10 |
+
* (at your option) any later version.
|
11 |
+
*
|
12 |
+
* This program is distributed in the hope that it will be useful,
|
13 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
+
* GNU General Public License for more details.
|
16 |
+
*
|
17 |
+
* You should have received a copy of the GNU General Public License
|
18 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19 |
+
*/
|
20 |
|
21 |
class Page {
|
22 |
+
|
23 |
const IUB_REGEX_PATTERN = '/<!--\s*IUB_COOKIE_POLICY_START\s*-->(.*?)<!--\s*IUB_COOKIE_POLICY_END\s*-->/sU';
|
24 |
+
|
25 |
public $auto_script_tags = array(
|
26 |
'platform.twitter.com/widgets.js',
|
27 |
'apis.google.com/js/plusone.js',
|
44 |
'maps.google.it/maps',
|
45 |
'www.google.com/maps/embed'
|
46 |
);
|
47 |
+
|
48 |
public $iub_comments_detected = array();
|
49 |
public $iframe_detected = array();
|
50 |
public $iframe_converted = array();
|
52 |
public $scripts_inline_detected = array();
|
53 |
public $scripts_inline_converted = array();
|
54 |
public $scripts_converted = array();
|
55 |
+
|
56 |
+
|
57 |
/*
|
58 |
construct: the whole HTML output of the page
|
59 |
*/
|
61 |
$this->original_content_page = $content_page;
|
62 |
$this->content_page = $content_page;
|
63 |
}
|
64 |
+
|
65 |
/*
|
66 |
print iubenda banner, parameter: the script code of iubenda to print the banner
|
67 |
*/
|
68 |
+
public function print_banner($banner){
|
69 |
return $banner.= "\n
|
70 |
<script>
|
71 |
var iCallback = function(){};
|
72 |
+
|
73 |
if('callback' in _iub.csConfiguration) {
|
74 |
if('onConsentGiven' in _iub.csConfiguration.callback) iCallback = _iub.csConfiguration.callback.onConsentGiven;
|
75 |
+
|
76 |
_iub.csConfiguration.callback.onConsentGiven = function()
|
77 |
{
|
78 |
iCallback();
|
79 |
+
|
80 |
/*
|
81 |
* Separator
|
82 |
*/
|
83 |
+
|
84 |
jQuery('noscript._no_script_iub').each(function (a, b) { var el = jQuery(b); el.after(el.html()); });
|
85 |
};
|
86 |
};
|
87 |
</script>";
|
88 |
}
|
89 |
+
|
90 |
/*
|
91 |
Static, detect bot & crawler
|
92 |
*/
|
93 |
static function bot_detected() {
|
94 |
+
return (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider|google|yahoo/i', $_SERVER['HTTP_USER_AGENT']));
|
95 |
}
|
96 |
|
97 |
/*
|
103 |
return true;
|
104 |
}
|
105 |
}
|
106 |
+
return false;
|
107 |
}
|
108 |
/*
|
109 |
Static, utility function: strpos for array
|
122 |
}
|
123 |
return false;
|
124 |
}
|
125 |
+
|
126 |
|
127 |
/* Convert scripts, iframe and other code inside IUBENDAs comment in text/plain to not generate cookies */
|
128 |
public function create_tags($html){
|
129 |
+
|
130 |
$elements = $html->find("*");
|
131 |
$js = '';
|
132 |
+
|
133 |
if(is_array($elements)){
|
134 |
$count = count($elements);
|
135 |
for($j=0; $j<$count; $j++){
|
138 |
case 'script':
|
139 |
$class = $e->class;
|
140 |
$e->class = $class . ' _iub_cs_activate';
|
141 |
+
$e->type = 'text/plain';
|
142 |
$js.= $e->outertext;
|
143 |
break;
|
144 |
+
|
145 |
case 'iframe':
|
146 |
$new_src = "//cdn.iubenda.com/cookie_solution/empty.html";
|
147 |
$class = $e->class;
|
148 |
$e->suppressedsrc = $e->src;
|
149 |
$e->src = $new_src;
|
150 |
+
$e->class = $class . ' _iub_cs_activate';
|
151 |
$js.= $e->outertext;
|
152 |
break;
|
153 |
+
|
154 |
default:
|
155 |
+
$js = $html;
|
|
|
|
|
156 |
break;
|
157 |
+
}
|
158 |
}
|
159 |
}
|
160 |
return $js;
|
161 |
}
|
162 |
+
|
163 |
/* Parse all IUBENDAs comment and convert the code inside with create_tags method */
|
164 |
public function parse_iubenda_comments(){
|
165 |
preg_match_all(self::IUB_REGEX_PATTERN, $this->content_page, $scripts);
|
167 |
$count = count($scripts[1]);
|
168 |
$js_scripts = array();
|
169 |
for($j=0; $j<$count; $j++){
|
170 |
+
$this->iub_comments_detected[] = $scripts[1][$j];
|
171 |
$html = str_get_html($scripts[1][$j], $lowercase=true, $forceTagsClosed=true, $stripRN=false);
|
172 |
$js_scripts[] = $this->create_tags($html);
|
173 |
}
|
174 |
+
|
175 |
if(is_array($scripts[1]) && is_array($js_scripts)){
|
176 |
if(count($scripts[1]) >= 1 && count($js_scripts) >= 1){
|
177 |
$this->content_page = strtr($this->content_page, array_combine($scripts[1], $js_scripts));
|
178 |
}
|
179 |
+
}
|
180 |
+
}
|
181 |
}
|
182 |
+
|
183 |
+
/* Parse automatically all the scripts in the page and converts it in text/plain
|
184 |
if src or the whole output has inside one of the elements in $auto_script_tags array */
|
185 |
public function parse_scripts(){
|
186 |
|
197 |
$class = $s->class;
|
198 |
$s->class = $class . ' _iub_cs_activate-inline';
|
199 |
$s->type = 'text/plain';
|
200 |
+
$this->scripts_converted[] = $s->innertext;
|
201 |
}
|
202 |
}else{
|
203 |
$src = $s->src;
|
217 |
/*
|
218 |
* AdSense check by Peste Vasile Alexandru, AdSense here
|
219 |
*/
|
220 |
+
|
221 |
$ad_found = false;
|
222 |
+
|
223 |
while(preg_match("#google_ad_client =(.*?);#i", $html))
|
224 |
{
|
225 |
$ad_found = true;
|
228 |
$ad_width = null;
|
229 |
$ad_height = null;
|
230 |
$ad_block = null;
|
231 |
+
|
232 |
/**/
|
233 |
+
|
234 |
preg_match("#google_ad_client =(.*?);#i", $html, $ad_client);
|
235 |
preg_match("#google_ad_slot =(.*?);#i", $html, $ad_slot);
|
236 |
preg_match("#google_ad_width =(.*?);#i", $html, $ad_width);
|
237 |
preg_match("#google_ad_height =(.*?);#i", $html, $ad_height);
|
238 |
+
|
239 |
/**/
|
240 |
+
|
241 |
$html = preg_replace("#google_ad_client =(.*?);#i", "", $html, 1);
|
242 |
$html = preg_replace("#google_ad_slot =(.*?);#i", "", $html, 1);
|
243 |
$html = preg_replace("#google_ad_width =(.*?);#i", "", $html, 1);
|
244 |
$html = preg_replace("#google_ad_height =(.*?);#i", "", $html, 1);
|
245 |
+
|
246 |
/**/
|
247 |
+
|
248 |
$ad_client = trim($ad_client[1]);
|
249 |
$ad_slot = trim($ad_slot[1]);
|
250 |
$ad_width = trim($ad_width[1]);
|
251 |
$ad_height = trim($ad_height[1]);
|
252 |
+
|
253 |
/**/
|
254 |
+
|
255 |
$ad_class = 'class="_iub_cs_activate_google_ads"';
|
256 |
$ad_style = 'style="width:'.$ad_width.'px; height:'.$ad_height.'px;"';
|
257 |
+
|
258 |
$ad_client = 'data-client='.$ad_client;
|
259 |
$ad_slot = 'data-slot='.$ad_slot;
|
260 |
$ad_width = 'data-width="'.$ad_width.'"';
|
261 |
$ad_height = 'data-height="'.$ad_height.'"';
|
262 |
+
|
263 |
/**/
|
264 |
+
|
265 |
$ad_block = "<div $ad_style $ad_class $ad_width $ad_height $ad_slot $ad_client></div>";
|
266 |
+
|
267 |
/**/
|
268 |
+
|
269 |
$html = preg_replace('#(<[^>]+) src="//pagead2.googlesyndication.com/pagead/show_ads.js"(.*?)</script>#i', $ad_block, $html, 1);
|
270 |
}
|
271 |
+
|
272 |
/**/
|
273 |
+
|
274 |
if($ad_found)
|
275 |
{
|
276 |
$adsense_callback =
|
311 |
else
|
312 |
{
|
313 |
_iub.csConfiguration.callback = {};
|
314 |
+
|
315 |
_iub.csConfiguration.callback.onConsentGiven = iubenda_adsense_unblock;
|
316 |
}
|
317 |
</script>
|
318 |
";
|
319 |
+
|
320 |
$html = str_replace("</body>", $adsense_callback."</body>", $html);
|
321 |
}
|
322 |
+
|
323 |
/**/
|
324 |
+
|
325 |
$this->content_page = $html;
|
326 |
}
|
327 |
}
|
328 |
|
329 |
/* Parse automatically all the iframe in the page and change the src to suppressedsrc
|
330 |
+
if src has inside one of the elements in $auto_iframe_tags array */
|
331 |
public function parse_iframe(){
|
332 |
$html = str_get_html($this->content_page, $lowercase=true, $forceTagsClosed=true, $stripRN=false);
|
333 |
if(is_object($html)){
|
334 |
+
$iframes = $html->find("iframe");
|
335 |
if(is_array($iframes)){
|
336 |
$count = count($iframes);
|
337 |
for($j=0; $j<$count; $j++){
|
338 |
$i = $iframes[$j];
|
339 |
$src = $i->src;
|
340 |
$this->iframe_detected[] = $src;
|
341 |
+
if (Page::strpos_array($src, $this->auto_iframe_tags) !== false){
|
342 |
$new_src = "//cdn.iubenda.com/cookie_solution/empty.html";
|
343 |
$class = $i->class;
|
344 |
$i->suppressedsrc = $src;
|
351 |
$this->content_page = $html;
|
352 |
}
|
353 |
}
|
354 |
+
|
355 |
/*
|
356 |
Call three methods to parse the page, iubendas comment, scripts + iframe
|
357 |
*/
|
358 |
+
public function parse()
|
359 |
+
{
|
360 |
$this->parse_iubenda_comments();
|
361 |
$this->parse_scripts();
|
362 |
$this->parse_iframe();
|
363 |
}
|
364 |
+
|
365 |
/*
|
366 |
Return the final page to output
|
367 |
*/
|
368 |
public function get_converted_page(){
|
369 |
return $this->content_page;
|
370 |
}
|
371 |
+
|
372 |
}
|
373 |
|
374 |
+
?>
|
iubenda-cookie-class/test.php
CHANGED
@@ -1,4 +1,22 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
ini_set('max_execution_time', 300);
|
3 |
?>
|
4 |
|
@@ -25,12 +43,12 @@ ul li { list-style-type: none; }
|
|
25 |
<input type="submit" class="btn" value="Analyze">
|
26 |
</form>
|
27 |
</div>
|
28 |
-
|
29 |
<?php
|
30 |
-
|
31 |
$url = $_POST['url'];
|
32 |
if($url || $_GET['url']){
|
33 |
-
|
34 |
function print_stuff($array){
|
35 |
if(count($array)){
|
36 |
echo "<ul>";
|
@@ -42,17 +60,17 @@ ul li { list-style-type: none; }
|
|
42 |
echo "<p>Nothing</p>";
|
43 |
}
|
44 |
}
|
45 |
-
|
46 |
echo '<div class="col-md-12" style="padding-bottom:150px;"><h2>RESULTS</H2>';
|
47 |
include_once 'iubenda.class.php';
|
48 |
include_once 'simple_html_dom.php';
|
49 |
-
|
50 |
if($_GET['url']){
|
51 |
$content = file_get_contents('A');
|
52 |
}else{
|
53 |
$content = file_get_contents($url);
|
54 |
}
|
55 |
-
|
56 |
$page = new Page($content);
|
57 |
$page->parse();
|
58 |
|
@@ -62,39 +80,39 @@ ul li { list-style-type: none; }
|
|
62 |
$iframe_converted = count($page->iframe_converted);
|
63 |
$script_inline_converted = count($page->scripts_inline_converted);
|
64 |
$script_converted = count($page->scripts_converted);
|
65 |
-
|
66 |
echo "<p>Iubenda comments detected: $iub_comments_detected<br>Iubenda automatic stuff<br>Iframe detected: $iframe_detected<br>Iframe autoconverted: $iframe_converted<br>Scripts detected: $scripts_detected<br>Inline scripts autoconverted: $script_inline_converted<br>Scripts autoconverted: $script_converted</p>";
|
67 |
-
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
72 |
echo "<H3>DETAILS</H3>";
|
73 |
-
|
74 |
echo "<H4>iubenda comments stuff</h4>";
|
75 |
print_stuff($page->iub_comments_detected);
|
76 |
-
|
77 |
echo "<H4>Script detected</h4>";
|
78 |
print_stuff($page->scripts_detected);
|
79 |
echo "<H4>Script converted</h4>";
|
80 |
print_stuff($page->scripts_converted);
|
81 |
echo "<H4>Script inline converted</h4>";
|
82 |
print_stuff($page->scripts_inline_converted);
|
83 |
-
|
84 |
echo "<H4>Iframe detected</h4>";
|
85 |
print_stuff($page->iframe_detected);
|
86 |
echo "<H4>Iframe converted</h4>";
|
87 |
print_stuff($page->iframe_converted);
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
echo "</div>";
|
92 |
-
|
93 |
-
|
94 |
}
|
95 |
?>
|
96 |
</div>
|
97 |
</div>
|
98 |
|
99 |
</body>
|
100 |
-
</html>
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* test.php
|
4 |
+
* @author: Copyright 2015 iubenda
|
5 |
+
* @license GNU/GPL
|
6 |
+
* This program is free software: you can redistribute it and/or modify
|
7 |
+
* it under the terms of the GNU General Public License as published by
|
8 |
+
* the Free Software Foundation, either version 3 of the License, or
|
9 |
+
* (at your option) any later version.
|
10 |
+
*
|
11 |
+
* This program is distributed in the hope that it will be useful,
|
12 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
+
* GNU General Public License for more details.
|
15 |
+
*
|
16 |
+
* You should have received a copy of the GNU General Public License
|
17 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18 |
+
*/
|
19 |
+
|
20 |
ini_set('max_execution_time', 300);
|
21 |
?>
|
22 |
|
43 |
<input type="submit" class="btn" value="Analyze">
|
44 |
</form>
|
45 |
</div>
|
46 |
+
|
47 |
<?php
|
48 |
+
|
49 |
$url = $_POST['url'];
|
50 |
if($url || $_GET['url']){
|
51 |
+
|
52 |
function print_stuff($array){
|
53 |
if(count($array)){
|
54 |
echo "<ul>";
|
60 |
echo "<p>Nothing</p>";
|
61 |
}
|
62 |
}
|
63 |
+
|
64 |
echo '<div class="col-md-12" style="padding-bottom:150px;"><h2>RESULTS</H2>';
|
65 |
include_once 'iubenda.class.php';
|
66 |
include_once 'simple_html_dom.php';
|
67 |
+
|
68 |
if($_GET['url']){
|
69 |
$content = file_get_contents('A');
|
70 |
}else{
|
71 |
$content = file_get_contents($url);
|
72 |
}
|
73 |
+
|
74 |
$page = new Page($content);
|
75 |
$page->parse();
|
76 |
|
80 |
$iframe_converted = count($page->iframe_converted);
|
81 |
$script_inline_converted = count($page->scripts_inline_converted);
|
82 |
$script_converted = count($page->scripts_converted);
|
83 |
+
|
84 |
echo "<p>Iubenda comments detected: $iub_comments_detected<br>Iubenda automatic stuff<br>Iframe detected: $iframe_detected<br>Iframe autoconverted: $iframe_converted<br>Scripts detected: $scripts_detected<br>Inline scripts autoconverted: $script_inline_converted<br>Scripts autoconverted: $script_converted</p>";
|
|
|
85 |
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
echo "<H3>DETAILS</H3>";
|
91 |
+
|
92 |
echo "<H4>iubenda comments stuff</h4>";
|
93 |
print_stuff($page->iub_comments_detected);
|
94 |
+
|
95 |
echo "<H4>Script detected</h4>";
|
96 |
print_stuff($page->scripts_detected);
|
97 |
echo "<H4>Script converted</h4>";
|
98 |
print_stuff($page->scripts_converted);
|
99 |
echo "<H4>Script inline converted</h4>";
|
100 |
print_stuff($page->scripts_inline_converted);
|
101 |
+
|
102 |
echo "<H4>Iframe detected</h4>";
|
103 |
print_stuff($page->iframe_detected);
|
104 |
echo "<H4>Iframe converted</h4>";
|
105 |
print_stuff($page->iframe_converted);
|
106 |
+
|
107 |
+
|
108 |
+
|
109 |
echo "</div>";
|
110 |
+
|
111 |
+
|
112 |
}
|
113 |
?>
|
114 |
</div>
|
115 |
</div>
|
116 |
|
117 |
</body>
|
118 |
+
</html>
|
iubenda-cookie-class/usage.php
CHANGED
@@ -1,33 +1,50 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
// the "$html" parameter must contain the content of the web page with the iubenda JavaScript banner/policy included
|
4 |
-
|
5 |
function iubenda_system($html)
|
6 |
{
|
7 |
if(empty($html)) return;
|
8 |
-
|
9 |
/*
|
10 |
* Separator
|
11 |
*/
|
12 |
-
|
13 |
if(!function_exists("file_get_html")) {
|
14 |
require_once("simple_html_dom.php");
|
15 |
}
|
16 |
-
|
17 |
require_once("iubenda.class.php");
|
18 |
-
|
19 |
/*
|
20 |
* Separator
|
21 |
*/
|
22 |
-
|
23 |
if(!Page::consent_given() && !Page::bot_detected()) {
|
24 |
$page = new Page($html);
|
25 |
$page->parse();
|
26 |
$html = $page->get_converted_page();
|
27 |
}
|
28 |
-
|
29 |
/* Finished */
|
30 |
-
|
31 |
return $html;
|
32 |
}
|
33 |
|
@@ -39,4 +56,4 @@ function iubenda_system($html)
|
|
39 |
*
|
40 |
*/
|
41 |
|
42 |
-
?>
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* usage.php
|
4 |
+
* @author: Copyright 2015 iubenda
|
5 |
+
* @license GNU/GPL
|
6 |
+
* This program is free software: you can redistribute it and/or modify
|
7 |
+
* it under the terms of the GNU General Public License as published by
|
8 |
+
* the Free Software Foundation, either version 3 of the License, or
|
9 |
+
* (at your option) any later version.
|
10 |
+
*
|
11 |
+
* This program is distributed in the hope that it will be useful,
|
12 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
+
* GNU General Public License for more details.
|
15 |
+
*
|
16 |
+
* You should have received a copy of the GNU General Public License
|
17 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18 |
+
*/
|
19 |
|
20 |
// the "$html" parameter must contain the content of the web page with the iubenda JavaScript banner/policy included
|
21 |
+
|
22 |
function iubenda_system($html)
|
23 |
{
|
24 |
if(empty($html)) return;
|
25 |
+
|
26 |
/*
|
27 |
* Separator
|
28 |
*/
|
29 |
+
|
30 |
if(!function_exists("file_get_html")) {
|
31 |
require_once("simple_html_dom.php");
|
32 |
}
|
33 |
+
|
34 |
require_once("iubenda.class.php");
|
35 |
+
|
36 |
/*
|
37 |
* Separator
|
38 |
*/
|
39 |
+
|
40 |
if(!Page::consent_given() && !Page::bot_detected()) {
|
41 |
$page = new Page($html);
|
42 |
$page->parse();
|
43 |
$html = $page->get_converted_page();
|
44 |
}
|
45 |
+
|
46 |
/* Finished */
|
47 |
+
|
48 |
return $html;
|
49 |
}
|
50 |
|
56 |
*
|
57 |
*/
|
58 |
|
59 |
+
?>
|
iubenda_cookie_solution.php
CHANGED
@@ -1,60 +1,127 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
* Plugin Name: Iubenda Cookie Solution
|
4 |
* Plugin URI: https://www.iubenda.com
|
5 |
* Description: Iubenda Cookie Solution permette di gestire tutti gli aspetti della cookie law su WP.
|
6 |
* Author: iubenda
|
7 |
-
* Version: 1.10.
|
8 |
* Text Domain: iubenda-cookie-wp-plugin
|
9 |
* Author URI: https://www.iubenda.com
|
10 |
*/
|
11 |
|
12 |
-
define(
|
13 |
-
define(
|
14 |
|
15 |
-
|
|
|
|
|
16 |
|
17 |
-
if(isset($_GET["iub_no_parse"])
|
|
|
18 |
return;
|
19 |
}
|
20 |
|
21 |
-
|
|
|
|
|
22 |
|
23 |
function iubenda_load_admin_panel()
|
24 |
{
|
25 |
-
|
26 |
-
|
27 |
-
*/
|
28 |
-
|
29 |
-
if(function_exists('icl_object_id')) {
|
30 |
-
define("IUBENDA_WPML", true);
|
31 |
-
}
|
32 |
-
|
33 |
-
/*
|
34 |
-
* Check for SimpleHTMLDom
|
35 |
-
*/
|
36 |
-
|
37 |
-
if(!function_exists('file_get_html')){
|
38 |
-
include_once dirname(__FILE__) . '/iubenda-cookie-class/simple_html_dom.php';
|
39 |
-
}
|
40 |
-
|
41 |
-
/*
|
42 |
-
* Import iubenda CLASS
|
43 |
*/
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
|
54 |
add_action("plugins_loaded", "iubenda_load_admin_panel");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
function __iubenda_buffer_head()
|
57 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
/*
|
59 |
* __iubenda_buffer_head
|
60 |
*/
|
@@ -63,10 +130,11 @@
|
|
63 |
|
64 |
/**/
|
65 |
|
66 |
-
if(get_option("iub_code"))
|
|
|
67 |
$wpml_old = html_entity_decode(stripslashes(get_option("iub_code")));
|
68 |
|
69 |
-
$iubenda_languages = array("it", "de", "en", "es", "pt-br", "ru", "fr");
|
70 |
|
71 |
foreach($iubenda_languages as $iubenda_language)
|
72 |
{
|
@@ -92,25 +160,24 @@
|
|
92 |
|
93 |
$iubenda_code .= "\n
|
94 |
<script>
|
95 |
-
|
96 |
-
|
97 |
-
if('callback' in _iub.csConfiguration) {
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
/*
|
105 |
-
* Separator
|
106 |
-
*/
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
111 |
</script>";
|
112 |
|
113 |
-
|
114 |
/**/
|
115 |
|
116 |
echo $iubenda_code;
|
@@ -120,35 +187,46 @@ if('callback' in _iub.csConfiguration) {
|
|
120 |
|
121 |
add_action("wp_head", "__iubenda_buffer_head", 99);
|
122 |
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
126 |
|
127 |
-
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
|
133 |
-
|
134 |
-
|
|
|
135 |
|
136 |
// add_action("shutdown", "__iubenda_shutdown", 0);
|
137 |
|
138 |
-
function __iubenda_setup_output()
|
139 |
-
|
140 |
-
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
}
|
143 |
|
144 |
add_action("registered_taxonomy", "__iubenda_setup_output", 0);
|
145 |
|
146 |
function __iubenda_final_output($output)
|
147 |
{
|
148 |
-
if(Page::consent_given() && get_option("skip_parsing") || Page::bot_detected()) {
|
149 |
-
return $output;
|
150 |
-
}
|
151 |
-
|
152 |
$page = new Page($output);
|
153 |
$page->parse();
|
154 |
|
@@ -165,33 +243,29 @@ if('callback' in _iub.csConfiguration) {
|
|
165 |
return '<!--IUB_COOKIE_POLICY_START-->'.do_shortcode($content).'<!--IUB_COOKIE_POLICY_END-->';
|
166 |
}
|
167 |
|
168 |
-
|
169 |
add_shortcode('iub-cookie-policy', 'iub_func');
|
170 |
|
171 |
-
|
172 |
/***********************************
|
173 |
*
|
174 |
* Add menù item on the admin
|
175 |
*
|
176 |
************************************/
|
177 |
|
178 |
-
|
179 |
-
function iub_admin()
|
180 |
-
{
|
181 |
add_menu_page("Iubenda - Settings", "Iubenda", "administrator", __FILE__, "__iub_admin_load");
|
182 |
}
|
183 |
|
184 |
-
|
185 |
/*
|
186 |
-
|
187 |
-
*
|
188 |
*/
|
|
|
189 |
function __iub_admin_load(){
|
190 |
|
191 |
-
if(get_option("iub_code"))
|
|
|
192 |
$wpml_old = html_entity_decode(stripslashes(get_option("iub_code")));
|
193 |
|
194 |
-
$iubenda_languages = array("it", "de", "en", "es", "pt-br", "ru", "fr");
|
195 |
|
196 |
foreach($iubenda_languages as $iubenda_language)
|
197 |
{
|
@@ -207,37 +281,36 @@ if('callback' in _iub.csConfiguration) {
|
|
207 |
update_option("iub_code", false);
|
208 |
}
|
209 |
|
210 |
-
// Only for debug purposes
|
211 |
-
// *Don't touch*
|
212 |
-
// delete_option('iub_cp_default');
|
213 |
-
// delete_option('iub_cp');
|
214 |
-
|
215 |
-
/***************************************************************************
|
216 |
-
*
|
217 |
-
* Style for messages
|
218 |
-
*
|
219 |
-
***************************************************************************/
|
220 |
-
|
221 |
-
|
222 |
if ( ! current_user_can( 'manage_options' ) && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
|
223 |
wp_die( __( 'You are not allowed to access this part of the site' ) );
|
224 |
}
|
225 |
|
226 |
-
$iubenda_language = array("it", "de", "en", "es", "pt-br", "ru", "fr", "default");
|
227 |
|
228 |
if($_POST)
|
229 |
{
|
230 |
if(!empty($_POST['skip_parsing'])) {
|
231 |
-
update_option("skip_parsing",
|
232 |
}
|
233 |
else {
|
234 |
update_option("skip_parsing", null);
|
235 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
}
|
237 |
|
238 |
if(!get_option("default_skip_parsing")) {
|
239 |
update_option("default_skip_parsing", true);
|
240 |
-
update_option("skip_parsing",
|
|
|
|
|
|
|
|
|
241 |
}
|
242 |
|
243 |
/**/
|
@@ -254,14 +327,15 @@ if('callback' in _iub.csConfiguration) {
|
|
254 |
/* */
|
255 |
|
256 |
$checked = "";
|
|
|
257 |
|
258 |
if(get_option("skip_parsing")) $checked = 'checked="true"';
|
|
|
259 |
|
260 |
/* */
|
261 |
|
262 |
|
263 |
echo '
|
264 |
-
|
265 |
<style>
|
266 |
#iubenda-tabs
|
267 |
{
|
@@ -298,7 +372,7 @@ if('callback' in _iub.csConfiguration) {
|
|
298 |
border-color: transparent transparent;
|
299 |
}
|
300 |
|
301 |
-
#iubenda-code-it, #iubenda-code-de, #iubenda-code-ru, #iubenda-code-es, #iubenda-code-pt-br, #iubenda-code-en, #iubenda-code-fr {
|
302 |
display: none;
|
303 |
|
304 |
width: 100%;
|
@@ -420,7 +494,7 @@ if('callback' in _iub.csConfiguration) {
|
|
420 |
</style>
|
421 |
<script>
|
422 |
function iubendaGetLanguage(str) {
|
423 |
-
var languages = ["it", "de", "en", "es", "pt-br", "ru", "fr"];
|
424 |
|
425 |
for(var i = 0; i < languages.length; i++) {
|
426 |
var tab = document.getElementById("iubenda-code-" + languages[i]);
|
@@ -511,19 +585,24 @@ if('callback' in _iub.csConfiguration) {
|
|
511 |
{
|
512 |
echo '<textarea class="iubenda-textarea iubenda-textarea-single" name="iubenda-code-default">'.stripslashes(get_option("iubenda-code-default")).'</textarea>';
|
513 |
}
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
<input type="checkbox" name="skip_parsing" value="skip" '.$checked.'>
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
|
|
|
|
|
|
|
|
|
|
528 |
}
|
529 |
?>
|
1 |
<?php
|
2 |
+
|
3 |
/*
|
4 |
* Plugin Name: Iubenda Cookie Solution
|
5 |
* Plugin URI: https://www.iubenda.com
|
6 |
* Description: Iubenda Cookie Solution permette di gestire tutti gli aspetti della cookie law su WP.
|
7 |
* Author: iubenda
|
8 |
+
* Version: 1.10.19
|
9 |
* Text Domain: iubenda-cookie-wp-plugin
|
10 |
* Author URI: https://www.iubenda.com
|
11 |
*/
|
12 |
|
13 |
+
define("DEBUG", 0);
|
14 |
+
define("IUB_REGEX_PATTERN", "/<!--IUB_COOKIE_POLICY_START-->(.*)<!--IUB_COOKIE_POLICY_END-->/sU");
|
15 |
|
16 |
+
/*
|
17 |
+
Deactivate the plugin if the request is XMLRPC or we have a POST form a Visitor, or if the iub_no_parse parameter exists
|
18 |
+
*/
|
19 |
|
20 |
+
if(isset($_GET["iub_no_parse"]) || isset($_SERVER["HTTP_X_REQUESTED_WITH"]) || defined("XMLRPC_REQUEST") && XMLRPC_REQUEST || defined("DOING_AJAX") && DOING_AJAX)
|
21 |
+
{
|
22 |
return;
|
23 |
}
|
24 |
|
25 |
+
/*
|
26 |
+
Methods
|
27 |
+
*/
|
28 |
|
29 |
function iubenda_load_admin_panel()
|
30 |
{
|
31 |
+
/*
|
32 |
+
Check for WPML
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*/
|
34 |
|
35 |
+
if(function_exists("icl_object_id"))
|
36 |
+
{
|
37 |
+
define("IUBENDA_WPML", true);
|
38 |
+
}
|
39 |
+
|
40 |
+
/**/
|
41 |
+
|
42 |
+
if(is_user_logged_in())
|
43 |
+
{
|
44 |
+
/*
|
45 |
+
Settings panel
|
46 |
+
*/
|
47 |
|
48 |
+
add_action("admin_menu", "iub_admin");
|
49 |
+
}
|
50 |
+
else
|
51 |
+
{
|
52 |
+
/*
|
53 |
+
Check for SimpleHTMLDOM
|
54 |
+
*/
|
55 |
+
|
56 |
+
if(!function_exists("file_get_html")) {
|
57 |
+
|
58 |
+
require(dirname(__FILE__)."/iubenda-cookie-class/simple_html_dom.php");
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
/*
|
63 |
+
Import iubenda class
|
64 |
+
*/
|
65 |
+
|
66 |
+
require(dirname(__FILE__)."/iubenda-cookie-class/iubenda.class.php");
|
67 |
+
}
|
68 |
}
|
69 |
|
70 |
add_action("plugins_loaded", "iubenda_load_admin_panel");
|
71 |
+
|
72 |
+
function __iubenda_content_type()
|
73 |
+
{
|
74 |
+
if(!is_user_logged_in() && get_option("iubenda_ctype"))
|
75 |
+
{
|
76 |
+
$iub_headers = headers_list();
|
77 |
+
$destroy = true;
|
78 |
+
|
79 |
+
/**/
|
80 |
+
|
81 |
+
foreach($iub_headers as $h)
|
82 |
+
{
|
83 |
+
if(strpos($h, "Content-Type: text/html") !== false || strpos($h, "Content-type: text/html") !== false) {
|
84 |
+
$destroy = false;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
/**/
|
89 |
+
|
90 |
+
if($destroy) {
|
91 |
+
|
92 |
+
define("IUBENDA_NO_HTML_TYPE", true);
|
93 |
+
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
|
98 |
function __iubenda_buffer_head()
|
99 |
{
|
100 |
+
/*
|
101 |
+
Settings
|
102 |
+
*/
|
103 |
+
|
104 |
+
if(!get_option("default_skip_parsing")) {
|
105 |
+
update_option("default_skip_parsing", true);
|
106 |
+
update_option("skip_parsing", true);
|
107 |
+
}
|
108 |
+
if(!get_option("default_iubendactype")) {
|
109 |
+
update_option("default_iubendactype", true);
|
110 |
+
update_option("iubenda_ctype", true);
|
111 |
+
}
|
112 |
+
|
113 |
+
/**/
|
114 |
+
|
115 |
+
__iubenda_content_type();
|
116 |
+
|
117 |
+
/**/
|
118 |
+
|
119 |
+
if(is_user_logged_in() || $_POST || defined("IUBENDA_NO_HTML_TYPE")) {
|
120 |
+
|
121 |
+
return;
|
122 |
+
|
123 |
+
}
|
124 |
+
|
125 |
/*
|
126 |
* __iubenda_buffer_head
|
127 |
*/
|
130 |
|
131 |
/**/
|
132 |
|
133 |
+
if(get_option("iub_code"))
|
134 |
+
{
|
135 |
$wpml_old = html_entity_decode(stripslashes(get_option("iub_code")));
|
136 |
|
137 |
+
$iubenda_languages = array("it", "de", "en", "es", "pt-br", "ru", "fr", "nl");
|
138 |
|
139 |
foreach($iubenda_languages as $iubenda_language)
|
140 |
{
|
160 |
|
161 |
$iubenda_code .= "\n
|
162 |
<script>
|
163 |
+
var iCallback = function(){};
|
164 |
+
|
165 |
+
if('callback' in _iub.csConfiguration) {
|
166 |
+
if('onConsentGiven' in _iub.csConfiguration.callback) iCallback = _iub.csConfiguration.callback.onConsentGiven;
|
167 |
+
|
168 |
+
_iub.csConfiguration.callback.onConsentGiven = function()
|
169 |
+
{
|
170 |
+
iCallback();
|
|
|
|
|
|
|
|
|
171 |
|
172 |
+
/*
|
173 |
+
* Separator
|
174 |
+
*/
|
175 |
+
|
176 |
+
jQuery('noscript._no_script_iub').each(function (a, b) { var el = jQuery(b); el.after(el.html()); });
|
177 |
+
};
|
178 |
+
};
|
179 |
</script>";
|
180 |
|
|
|
181 |
/**/
|
182 |
|
183 |
echo $iubenda_code;
|
187 |
|
188 |
add_action("wp_head", "__iubenda_buffer_head", 99);
|
189 |
|
190 |
+
/*
|
191 |
+
function __iubenda_shutdown()
|
192 |
+
{
|
193 |
+
$final = "";
|
194 |
|
195 |
+
$levels = ob_get_level();
|
196 |
|
197 |
+
for($i = 0; $i < $levels; $i++){
|
198 |
+
$final .= ob_get_clean();
|
199 |
+
}
|
200 |
|
201 |
+
echo apply_filters("final_output", $final);
|
202 |
+
}
|
203 |
+
*/
|
204 |
|
205 |
// add_action("shutdown", "__iubenda_shutdown", 0);
|
206 |
|
207 |
+
function __iubenda_setup_output()
|
208 |
+
{
|
209 |
+
if(is_user_logged_in() || $_POST || defined("IUBENDA_NO_HTML_TYPE")) {
|
210 |
+
|
211 |
+
return;
|
212 |
+
|
213 |
+
}
|
214 |
+
|
215 |
+
if(Page::consent_given() && get_option("skip_parsing") || Page::bot_detected()) {
|
216 |
+
|
217 |
+
return;
|
218 |
+
|
219 |
+
}
|
220 |
+
|
221 |
+
/**/
|
222 |
+
|
223 |
+
ob_start("__iubenda_final_output");
|
224 |
}
|
225 |
|
226 |
add_action("registered_taxonomy", "__iubenda_setup_output", 0);
|
227 |
|
228 |
function __iubenda_final_output($output)
|
229 |
{
|
|
|
|
|
|
|
|
|
230 |
$page = new Page($output);
|
231 |
$page->parse();
|
232 |
|
243 |
return '<!--IUB_COOKIE_POLICY_START-->'.do_shortcode($content).'<!--IUB_COOKIE_POLICY_END-->';
|
244 |
}
|
245 |
|
|
|
246 |
add_shortcode('iub-cookie-policy', 'iub_func');
|
247 |
|
|
|
248 |
/***********************************
|
249 |
*
|
250 |
* Add menù item on the admin
|
251 |
*
|
252 |
************************************/
|
253 |
|
254 |
+
function iub_admin() {
|
|
|
|
|
255 |
add_menu_page("Iubenda - Settings", "Iubenda", "administrator", __FILE__, "__iub_admin_load");
|
256 |
}
|
257 |
|
|
|
258 |
/*
|
259 |
+
* Iub admin forms
|
|
|
260 |
*/
|
261 |
+
|
262 |
function __iub_admin_load(){
|
263 |
|
264 |
+
if(get_option("iub_code"))
|
265 |
+
{
|
266 |
$wpml_old = html_entity_decode(stripslashes(get_option("iub_code")));
|
267 |
|
268 |
+
$iubenda_languages = array("it", "de", "en", "es", "pt-br", "ru", "fr", "nl");
|
269 |
|
270 |
foreach($iubenda_languages as $iubenda_language)
|
271 |
{
|
281 |
update_option("iub_code", false);
|
282 |
}
|
283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
if ( ! current_user_can( 'manage_options' ) && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
|
285 |
wp_die( __( 'You are not allowed to access this part of the site' ) );
|
286 |
}
|
287 |
|
288 |
+
$iubenda_language = array("it", "de", "en", "es", "pt-br", "ru", "fr", "nl", "default");
|
289 |
|
290 |
if($_POST)
|
291 |
{
|
292 |
if(!empty($_POST['skip_parsing'])) {
|
293 |
+
update_option("skip_parsing", true);
|
294 |
}
|
295 |
else {
|
296 |
update_option("skip_parsing", null);
|
297 |
}
|
298 |
+
|
299 |
+
if(!empty($_POST['iubenda_ctype'])) {
|
300 |
+
update_option("iubenda_ctype", true);
|
301 |
+
}
|
302 |
+
else {
|
303 |
+
update_option("iubenda_ctype", null);
|
304 |
+
}
|
305 |
}
|
306 |
|
307 |
if(!get_option("default_skip_parsing")) {
|
308 |
update_option("default_skip_parsing", true);
|
309 |
+
update_option("skip_parsing", true);
|
310 |
+
}
|
311 |
+
if(!get_option("default_iubendactype")) {
|
312 |
+
update_option("default_iubendactype", true);
|
313 |
+
update_option("iubenda_ctype", true);
|
314 |
}
|
315 |
|
316 |
/**/
|
327 |
/* */
|
328 |
|
329 |
$checked = "";
|
330 |
+
$checked_ctype = "";
|
331 |
|
332 |
if(get_option("skip_parsing")) $checked = 'checked="true"';
|
333 |
+
if(get_option("iubenda_ctype")) $checked_ctype = 'checked="true"';
|
334 |
|
335 |
/* */
|
336 |
|
337 |
|
338 |
echo '
|
|
|
339 |
<style>
|
340 |
#iubenda-tabs
|
341 |
{
|
372 |
border-color: transparent transparent;
|
373 |
}
|
374 |
|
375 |
+
#iubenda-code-it, #iubenda-code-de, #iubenda-code-ru, #iubenda-code-es, #iubenda-code-pt-br, #iubenda-code-en, #iubenda-code-fr, #iubenda-code-nl {
|
376 |
display: none;
|
377 |
|
378 |
width: 100%;
|
494 |
</style>
|
495 |
<script>
|
496 |
function iubendaGetLanguage(str) {
|
497 |
+
var languages = ["it", "de", "en", "es", "pt-br", "ru", "fr", "nl"];
|
498 |
|
499 |
for(var i = 0; i < languages.length; i++) {
|
500 |
var tab = document.getElementById("iubenda-code-" + languages[i]);
|
585 |
{
|
586 |
echo '<textarea class="iubenda-textarea iubenda-textarea-single" name="iubenda-code-default">'.stripslashes(get_option("iubenda-code-default")).'</textarea>';
|
587 |
}
|
588 |
+
|
589 |
+
echo '
|
590 |
+
<p>
|
591 |
<input type="checkbox" name="skip_parsing" value="skip" '.$checked.'>
|
592 |
+
Lascia intatti gli script della pagina se l\'utente ha già dato il consenso (migliora le prestazioni, altamente consigliato, da disattivare solo qualora il tuo sito utilizzi un sistema di cache)
|
593 |
+
</p>
|
594 |
+
<p>
|
595 |
+
<input type="checkbox" name="iubenda_ctype" value="enabled" '.$checked_ctype.'>
|
596 |
+
Restringi l\'esecuzione del plugin alle sole richieste che presentano "Content-type: text/html" (consigliato)
|
597 |
+
</p>
|
598 |
+
<p>
|
599 |
+
<input type="submit" value="Salva" id="iubenda-save">
|
600 |
+
</p>
|
601 |
+
</form>
|
602 |
+
<p class="iubenda-text">
|
603 |
+
<span class="iubenda-title">Hai bisogno di supporto su questo plugin?</span>
|
604 |
+
Visita il nostro <a href="//support.iubenda.com/forums/314835-general/suggestions/9670701-discussion-regarding-the-iubenda-cookie-law-soluti" class="iubenda-url" target="_blank">forum di supporto</a>.
|
605 |
+
</p>
|
606 |
+
';
|
607 |
}
|
608 |
?>
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: iubenda
|
|
3 |
Donate link:
|
4 |
Tags: cookies, cookie law, cookie policy, cookie banner, cookie block, privacy policy, cookie consent, privacy
|
5 |
Requires at least: 3.0.1
|
6 |
-
Tested up to: 4.4.
|
7 |
Stable tag: 1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -34,6 +34,7 @@ This plugin works with the Iubenda Cookie Law Solution and allows to block the m
|
|
34 |
* YouTube widgets
|
35 |
* AddThis widgets
|
36 |
* ShareThis widgets
|
|
|
37 |
|
38 |
**Some background information**
|
39 |
|
@@ -75,6 +76,7 @@ La soluzione cookie sviluppata da iubenda permette di gestire con facilità l’
|
|
75 |
* YouTube widget
|
76 |
* AddThis widget
|
77 |
* ShareThis widget
|
|
|
78 |
|
79 |
**Alcune informazioni aggiuntive**
|
80 |
|
@@ -125,6 +127,18 @@ Il plugin Wordpress di iubenda permette di semplificare l’adeguamento del prop
|
|
125 |
|
126 |
== Changelog ==
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
= 1.10.11 =
|
129 |
* iub_no_parse parameter reintroduced
|
130 |
* added XMLRPC control
|
@@ -280,12 +294,6 @@ For articles, however, there's a shortcode available:
|
|
280 |
|
281 |
In case of continued browsing, the preferences of your users for the use of cookies will be set on "OK" to clear the banner and unlock the cookies. Moreover, banners and the blocking codes will not be delivered to subsequent visits by users who have already given their consent (and such preference will be updated at each subsequent visit for the future).
|
282 |
|
283 |
-
== Further notes ==
|
284 |
-
|
285 |
-
At the moment the automatic blocking of the YouTube video player and social widgets are done only if these scripts are located after the function wp_head(). The solution is the first version. Test it and contact us to report any errors.
|
286 |
-
|
287 |
-
Header image for this plugin page [graciously provided by this person](http://www.sketchappsources.com/free-source/1012-minimal-lines-device-icons-sketch-freebie-resource.html).
|
288 |
-
|
289 |
== Bug reports ==
|
290 |
|
291 |
* The best way you can help us is by providing as much information as possible, including the use of wp_debug https://codex.wordpress.org/Debugging_in_WordPress.
|
@@ -321,10 +329,6 @@ Per gli articoli, invece, è disponibile uno shortcode:
|
|
321 |
|
322 |
In caso di proseguimento della navigazione, le preferenze dei tuoi utenti circa l’installazione dei cookie verranno settate sul si in modo da far scomparire il banner e da sbloccare i cookie. Inoltre, banner e blocco codici non verranno erogati alle successive visite da parte degli utenti che hanno già prestato il proprio consenso (e tale preferenza verrà aggiornata ad ogni successiva visita).
|
323 |
|
324 |
-
== Note ulteriori ==
|
325 |
-
|
326 |
-
Al momento il blocco automatico dei video player di YouTube e dei widget sociali avviene solo se questi script si trovano dopo la funzione wp_head(). La soluzione è alla prima versione. Testatela e contattateci per segnalare eventuali errori.
|
327 |
-
|
328 |
== Segnalazioni di bug ==
|
329 |
|
330 |
* Il modo migliore per aiutarci è quello di fornire quante più informazioni possibili, compreso l'uso di wp_debug https://codex.wordpress.org/Debugging_in_WordPress.
|
3 |
Donate link:
|
4 |
Tags: cookies, cookie law, cookie policy, cookie banner, cookie block, privacy policy, cookie consent, privacy
|
5 |
Requires at least: 3.0.1
|
6 |
+
Tested up to: 4.4.0
|
7 |
Stable tag: 1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
34 |
* YouTube widgets
|
35 |
* AddThis widgets
|
36 |
* ShareThis widgets
|
37 |
+
* Google Maps widgets
|
38 |
|
39 |
**Some background information**
|
40 |
|
76 |
* YouTube widget
|
77 |
* AddThis widget
|
78 |
* ShareThis widget
|
79 |
+
* Google Maps widget
|
80 |
|
81 |
**Alcune informazioni aggiuntive**
|
82 |
|
127 |
|
128 |
== Changelog ==
|
129 |
|
130 |
+
|
131 |
+
= 1.10.19 =
|
132 |
+
* Fixed a series of conflicts with AJAX requests, which were conflicting with Contact Form 7 and other plugins
|
133 |
+
|
134 |
+
= 1.10.18 =
|
135 |
+
* More bugs fixed
|
136 |
+
* The content-type restriction option is now on by default
|
137 |
+
|
138 |
+
= 1.10.17 =
|
139 |
+
* Added filter that only activates the plugin when the Content Type is text/html
|
140 |
+
* Loads of bug fixes and speed improvements
|
141 |
+
|
142 |
= 1.10.11 =
|
143 |
* iub_no_parse parameter reintroduced
|
144 |
* added XMLRPC control
|
294 |
|
295 |
In case of continued browsing, the preferences of your users for the use of cookies will be set on "OK" to clear the banner and unlock the cookies. Moreover, banners and the blocking codes will not be delivered to subsequent visits by users who have already given their consent (and such preference will be updated at each subsequent visit for the future).
|
296 |
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
== Bug reports ==
|
298 |
|
299 |
* The best way you can help us is by providing as much information as possible, including the use of wp_debug https://codex.wordpress.org/Debugging_in_WordPress.
|
329 |
|
330 |
In caso di proseguimento della navigazione, le preferenze dei tuoi utenti circa l’installazione dei cookie verranno settate sul si in modo da far scomparire il banner e da sbloccare i cookie. Inoltre, banner e blocco codici non verranno erogati alle successive visite da parte degli utenti che hanno già prestato il proprio consenso (e tale preferenza verrà aggiornata ad ogni successiva visita).
|
331 |
|
|
|
|
|
|
|
|
|
332 |
== Segnalazioni di bug ==
|
333 |
|
334 |
* Il modo migliore per aiutarci è quello di fornire quante più informazioni possibili, compreso l'uso di wp_debug https://codex.wordpress.org/Debugging_in_WordPress.
|