Version Description
- New: Use the new check consent end point
Download this release
Release Info
Developer | iubenda |
Plugin | iubenda Cookie Solution for GDPR |
Version | 2.3.17-beta |
Comparing to | |
See all releases |
Code changes from version 2.3.11 to 2.3.17-beta
- includes/amp.php +113 -120
- includes/settings.php +13 -3
- iubenda-cookie-class/README.md +10 -0
- iubenda-cookie-class/iubenda.class.php +62 -4
- iubenda-cookie-class/listeners/GoogleAnalyticsListener.php +72 -0
- iubenda-cookie-class/listeners/GoogleTagManagerListener.php +80 -0
- iubenda_cookie_solution.php +67 -13
- languages/iubenda-cookie-law-solution-it_IT.po +4 -0
- readme.txt +25 -5
includes/amp.php
CHANGED
@@ -10,16 +10,63 @@ if ( ! defined( 'ABSPATH' ) )
|
|
10 |
*/
|
11 |
class iubenda_AMP {
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
/**
|
14 |
* Class constructor.
|
15 |
*/
|
16 |
public function __construct() {
|
17 |
// actions
|
18 |
add_action( 'wp_head', array( $this, 'wp_head_amp' ), 100 );
|
|
|
19 |
add_action( 'wp_footer', array( $this, 'wp_footer_amp' ), 100 );
|
20 |
-
add_action( 'amp_post_template_css', array( $this, 'amp_post_template_css' ), 100 );
|
21 |
add_action( 'amp_post_template_footer', array( $this, 'wp_footer_amp' ), 100 );
|
22 |
-
add_action( 'amp_post_template_footer', array( $this, 'fix_analytics_amp_for_wp' ), 1 );
|
|
|
23 |
|
24 |
// filters
|
25 |
add_filter( 'amp_post_template_data', array( $this, 'amp_post_template_data' ), 100 );
|
@@ -35,10 +82,9 @@ class iubenda_AMP {
|
|
35 |
if ( iubenda()->options['cs']['amp_support'] === false )
|
36 |
return;
|
37 |
|
38 |
-
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint()
|
39 |
echo '
|
40 |
-
<script async custom-element="amp-consent" src="https://cdn.ampproject.org/v0/amp-consent-latest.js"></script>
|
41 |
-
<script async custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/amp-iframe-latest.js"></script>';
|
42 |
|
43 |
// optional geo support
|
44 |
if ( iubenda()->multilang && ! empty( iubenda()->lang_current ) ) {
|
@@ -54,28 +100,22 @@ class iubenda_AMP {
|
|
54 |
<script async custom-element="amp-geo" src="https://cdn.ampproject.org/v0/amp-geo-0.1.js"></script>';
|
55 |
}
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
}
|
70 |
-
amp-consent.amp-active {
|
71 |
-
position:fixed;
|
72 |
-
top: 0;
|
73 |
-
bottom: 0;
|
74 |
-
left: 0;
|
75 |
-
right: 0;
|
76 |
-
}
|
77 |
-
</style>';
|
78 |
}
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
/**
|
@@ -121,24 +161,23 @@ class iubenda_AMP {
|
|
121 |
return;
|
122 |
|
123 |
echo '
|
124 |
-
<amp-consent id="
|
125 |
<script type="application/json">
|
126 |
{
|
127 |
-
"
|
128 |
-
"
|
129 |
-
"checkConsentHref": "https://amp.iubenda.com/cs/amp/checkConsent",
|
130 |
-
"promptUI": "myConsentFlow"
|
131 |
}
|
132 |
</script>
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
|
|
142 |
}
|
143 |
}
|
144 |
|
@@ -155,43 +194,11 @@ class iubenda_AMP {
|
|
155 |
$data['amp_component_scripts'] = array_merge( $data['amp_component_scripts'],
|
156 |
array( 'amp-consent' => 'https://cdn.ampproject.org/v0/amp-consent-latest.js' )
|
157 |
);
|
158 |
-
$data['amp_component_scripts'] = array_merge( $data['amp_component_scripts'],
|
159 |
-
array( 'amp-iframe' => 'https://cdn.ampproject.org/v0/amp-iframe-latest.js' )
|
160 |
-
);
|
161 |
}
|
162 |
|
163 |
return $data;
|
164 |
}
|
165 |
|
166 |
-
/**
|
167 |
-
* Add CSS to AMP for WP plugin and WP AMP plugin in Standard mode.
|
168 |
-
*
|
169 |
-
* @return mixed
|
170 |
-
*/
|
171 |
-
public function amp_post_template_css( $data ) {
|
172 |
-
if ( iubenda()->options['cs']['amp_support'] === false )
|
173 |
-
return;
|
174 |
-
|
175 |
-
echo '
|
176 |
-
.popupOverlay {
|
177 |
-
position:fixed;
|
178 |
-
top: 0;
|
179 |
-
bottom: 0;
|
180 |
-
left: 0;
|
181 |
-
right: 0;
|
182 |
-
}
|
183 |
-
amp-iframe {
|
184 |
-
margin: 0;
|
185 |
-
}
|
186 |
-
amp-consent.amp-active {
|
187 |
-
position:fixed;
|
188 |
-
top: 0;
|
189 |
-
bottom: 0;
|
190 |
-
left: 0;
|
191 |
-
right: 0;
|
192 |
-
}';
|
193 |
-
}
|
194 |
-
|
195 |
/**
|
196 |
* Block analytics in AMP for WP plugin.
|
197 |
*
|
@@ -244,6 +251,8 @@ amp-consent.amp-active {
|
|
244 |
$html = '';
|
245 |
|
246 |
$configuration_raw = iubenda()->parse_configuration( $code );
|
|
|
|
|
247 |
|
248 |
if ( ! empty( $configuration_raw ) ) {
|
249 |
// get script
|
@@ -269,6 +278,35 @@ amp-consent.amp-active {
|
|
269 |
<meta name="robots" content="noindex">
|
270 |
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
271 |
<title>' . __( 'AMP Cookie Consent', 'iubenda' ) . '</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
<script type="text/javascript">
|
273 |
var _iub = _iub || [];
|
274 |
_iub.csConfiguration = {
|
@@ -276,55 +314,11 @@ amp-consent.amp-active {
|
|
276 |
// print configuration
|
277 |
$html .= $configuration . ',';
|
278 |
$html .= '
|
279 |
-
banner:
|
280 |
-
position: \'float-bottom-center\',
|
281 |
-
acceptButtonDisplay: true,
|
282 |
-
customizeButtonDisplay: true,
|
283 |
-
rejectButtonDisplay: true,
|
284 |
-
backgroundOverlay: true
|
285 |
-
},
|
286 |
-
callback: { // Mandatory
|
287 |
-
onPreferenceExpressed: function(preference) {
|
288 |
-
var AMP_CONSENT_STRING_MAX_LENGTH = 1024;
|
289 |
-
var consentObject = {
|
290 |
-
type: \'consent-response\',
|
291 |
-
action: preference && preference.consent ? \'accept\' : \'reject\'
|
292 |
-
};
|
293 |
-
|
294 |
-
if (typeof window.__tcfapi === \'function\') {
|
295 |
-
__tcfapi(\'getTCData\', 2, function(res) {
|
296 |
-
var consentString = res.tcString;
|
297 |
-
|
298 |
-
if (consentString.length <= AMP_CONSENT_STRING_MAX_LENGTH) {
|
299 |
-
consentObject.info = consentString;
|
300 |
-
}
|
301 |
-
|
302 |
-
console.log(\'send consent-response\', consentObject.action, \'with CMP v2 consent string\', consentString);
|
303 |
-
window.parent.postMessage(consentObject, \'*\');
|
304 |
-
});
|
305 |
-
}
|
306 |
-
else if (typeof window.__cmp === \'function\') {
|
307 |
-
__cmp(\'getConsentData\', null, function(res) {
|
308 |
-
var consentString = res.consentData;
|
309 |
-
|
310 |
-
if (consentString.length <= AMP_CONSENT_STRING_MAX_LENGTH) {
|
311 |
-
consentObject.info = consentString;
|
312 |
-
}
|
313 |
-
|
314 |
-
console.log(\'send consent-response\', consentObject.action, \'with CMP consent string\', consentString);
|
315 |
-
window.parent.postMessage(consentObject, \'*\');
|
316 |
-
});
|
317 |
-
} else {
|
318 |
-
console.log(\'send consent-response\', consentObject.action);
|
319 |
-
window.parent.postMessage(consentObject, \'*\');
|
320 |
-
}
|
321 |
-
}
|
322 |
-
}
|
323 |
};
|
324 |
</script>
|
325 |
-
<script async src="' . $script_src . '"></script>
|
326 |
-
|
327 |
-
<body></body>
|
328 |
</html>';
|
329 |
}
|
330 |
|
@@ -400,5 +394,4 @@ amp-consent.amp-active {
|
|
400 |
|
401 |
return (bool) $result;
|
402 |
}
|
403 |
-
|
404 |
}
|
10 |
*/
|
11 |
class iubenda_AMP {
|
12 |
|
13 |
+
/**
|
14 |
+
* The required banner configuration for AMP
|
15 |
+
*
|
16 |
+
* @var array
|
17 |
+
*/
|
18 |
+
private $required_banner_configuration = array(
|
19 |
+
'position' => 'float-center',
|
20 |
+
'acceptButtonDisplay' => true,
|
21 |
+
'customizeButtonDisplay' => true,
|
22 |
+
'rejectButtonDisplay' => true,
|
23 |
+
'backgroundOverlay' => true
|
24 |
+
);
|
25 |
+
|
26 |
+
/**
|
27 |
+
* AMP shared style
|
28 |
+
*
|
29 |
+
* @var string
|
30 |
+
*/
|
31 |
+
private $amp_style = "
|
32 |
+
.iubenda-tp-btn {
|
33 |
+
position: fixed;
|
34 |
+
z-index: 2147483647;
|
35 |
+
background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%231CC691' fill-rule='evenodd' d='M16 7a4 4 0 0 1 2.627 7.016L19.5 25h-7l.873-10.984A4 4 0 0 1 16 7z'/%3E%3C/svg%3E\");
|
36 |
+
background-repeat: no-repeat;
|
37 |
+
background-size: 32px 32px;
|
38 |
+
background-position: top .5px left 1px;
|
39 |
+
width: 34px;
|
40 |
+
border: none;
|
41 |
+
cursor: pointer;
|
42 |
+
margin: 16px;
|
43 |
+
padding: 0;
|
44 |
+
box-shadow: 0 0 0 1px rgba(0,0,0,.15);
|
45 |
+
background-color: #fff;
|
46 |
+
display: inline-block;
|
47 |
+
height: 34px;
|
48 |
+
min-width: 34px;
|
49 |
+
border-radius: 4px;
|
50 |
+
bottom: 0;
|
51 |
+
right: 0;
|
52 |
+
}
|
53 |
+
.iubenda-tp-btn--top-left {top: 0;left: 0;}
|
54 |
+
.iubenda-tp-btn--top-right {top: 0;right: 0;}
|
55 |
+
.iubenda-tp-btn--bottom-left {bottom: 0;left: 0;}
|
56 |
+
.iubenda-tp-btn--bottom-right {bottom: 0;right: 0;}
|
57 |
+
";
|
58 |
+
|
59 |
/**
|
60 |
* Class constructor.
|
61 |
*/
|
62 |
public function __construct() {
|
63 |
// actions
|
64 |
add_action( 'wp_head', array( $this, 'wp_head_amp' ), 100 );
|
65 |
+
add_action( 'amp_post_template_head', array( $this, 'wp_head_amp' ), 100 );
|
66 |
add_action( 'wp_footer', array( $this, 'wp_footer_amp' ), 100 );
|
|
|
67 |
add_action( 'amp_post_template_footer', array( $this, 'wp_footer_amp' ), 100 );
|
68 |
+
// add_action( 'amp_post_template_footer', array( $this, 'fix_analytics_amp_for_wp' ), 1 );
|
69 |
+
add_action( 'amp_post_template_css', array( $this, 'amp_post_template_css' ), 1 );
|
70 |
|
71 |
// filters
|
72 |
add_filter( 'amp_post_template_data', array( $this, 'amp_post_template_data' ), 100 );
|
82 |
if ( iubenda()->options['cs']['amp_support'] === false )
|
83 |
return;
|
84 |
|
85 |
+
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() || ( function_exists( 'ampforwp_is_amp_endpoint' ) && ampforwp_is_amp_endpoint() ) ) {
|
86 |
echo '
|
87 |
+
<script async custom-element="amp-consent" src="https://cdn.ampproject.org/v0/amp-consent-latest.js"></script>';
|
|
|
88 |
|
89 |
// optional geo support
|
90 |
if ( iubenda()->multilang && ! empty( iubenda()->lang_current ) ) {
|
100 |
<script async custom-element="amp-geo" src="https://cdn.ampproject.org/v0/amp-geo-0.1.js"></script>';
|
101 |
}
|
102 |
|
103 |
+
echo '<meta name="amp-consent-blocking" content="amp-analytics,amp-ad">';
|
104 |
+
|
105 |
+
// Integrate with amp-wp.org
|
106 |
+
if ( is_plugin_active( 'amp/amp.php' ) ) {
|
107 |
+
echo "<style>{$this->amp_style}</style>";
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
public function amp_post_template_css() {
|
113 |
+
if ( iubenda()->options['cs']['amp_support'] === false ) {
|
114 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
+
|
117 |
+
// CSS style
|
118 |
+
echo "{$this->amp_style}";
|
119 |
}
|
120 |
|
121 |
/**
|
161 |
return;
|
162 |
|
163 |
echo '
|
164 |
+
<amp-consent id="iubenda" layout="nodisplay" type="iubenda">
|
165 |
<script type="application/json">
|
166 |
{
|
167 |
+
"promptUISrc": "' . esc_url( $template_url ) . '",
|
168 |
+
"postPromptUI": "myConsentFlow"
|
|
|
|
|
169 |
}
|
170 |
</script>
|
171 |
+
</amp-consent>
|
172 |
+
<!-- This is the update preferences button, visible only when preferences are already expressed. -->
|
173 |
+
<div id="myConsentFlow">
|
174 |
+
<!-- You may change the position of the update preferences button. -->
|
175 |
+
<!-- Use the class "iubenda-tp-btn--bottom-left" for bottom left position, other positions:
|
176 |
+
"iubenda-tp-btn--bottom-right", "iubenda-tp-btn--top-left", "iubenda-tp-btn--top-right" -->
|
177 |
+
<button class="iubenda-tp-btn iubenda-tp-btn--bottom-right" on="tap:iubenda.prompt()"></button>
|
178 |
+
</div>
|
179 |
+
';
|
180 |
+
|
181 |
}
|
182 |
}
|
183 |
|
194 |
$data['amp_component_scripts'] = array_merge( $data['amp_component_scripts'],
|
195 |
array( 'amp-consent' => 'https://cdn.ampproject.org/v0/amp-consent-latest.js' )
|
196 |
);
|
|
|
|
|
|
|
197 |
}
|
198 |
|
199 |
return $data;
|
200 |
}
|
201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
/**
|
203 |
* Block analytics in AMP for WP plugin.
|
204 |
*
|
251 |
$html = '';
|
252 |
|
253 |
$configuration_raw = iubenda()->parse_configuration( $code );
|
254 |
+
$banner_configuration = iubenda()->parse_configuration( $code ,array('mode' => 'banner' ,'parse' => false));
|
255 |
+
$banner_configuration = json_encode(array_merge($banner_configuration, $this->required_banner_configuration));
|
256 |
|
257 |
if ( ! empty( $configuration_raw ) ) {
|
258 |
// get script
|
278 |
<meta name="robots" content="noindex">
|
279 |
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
280 |
<title>' . __( 'AMP Cookie Consent', 'iubenda' ) . '</title>
|
281 |
+
<style>
|
282 |
+
#iubenda-iframe.iubenda-iframe-visible {
|
283 |
+
background-color: transparent !important;
|
284 |
+
border-radius: 4px !important;
|
285 |
+
}
|
286 |
+
|
287 |
+
#iubenda-cs-banner .iubenda-cs-container .iubenda-cs-content {
|
288 |
+
border-radius: 4px !important;
|
289 |
+
}
|
290 |
+
|
291 |
+
.iubenda-cookie-solution #iubenda-cs-banner.iubenda-cs-default-floating.iubenda-cs-center:not(.iubenda-cs-top):not(.iubenda-cs-bottom) .iubenda-cs-container, #iubenda-cs-banner.iubenda-cs-default-floating:not(.iubenda-cs-bottom):not(.iubenda-cs-center) .iubenda-cs-container, #iubenda-cs-banner.iubenda-cs-default-floating:not(.iubenda-cs-top):not(.iubenda-cs-center) .iubenda-cs-container {
|
292 |
+
width: 100vw !important;
|
293 |
+
height: 100vh !important;
|
294 |
+
}
|
295 |
+
|
296 |
+
.iubenda-cookie-solution #iubenda-cs-banner.iubenda-cs-fix-height.iubenda-cs-default-floating .iubenda-cs-content {
|
297 |
+
height: 100% !important;
|
298 |
+
}
|
299 |
+
|
300 |
+
.iubenda-cookie-solution #iubenda-iframe-popup .iubenda-iframe-top-container.bottom-border-radius,
|
301 |
+
.iubenda-cookie-solution #iubenda-iframe-popup #iab-container,
|
302 |
+
.iubenda-cookie-solution #iubenda-iframe-popup #iub-cmp-widget,
|
303 |
+
.iubenda-cookie-solution #iubenda-iframe-popup .iubenda-iframe-footer.iubenda-iframe-footer-absolute {
|
304 |
+
border-radius: 0 0 4px 4px !important;
|
305 |
+
}
|
306 |
+
</style>
|
307 |
+
</head>
|
308 |
+
<body class="iubenda-cookie-solution">
|
309 |
+
<span class="iubenda-cs-preferences-link"></span>
|
310 |
<script type="text/javascript">
|
311 |
var _iub = _iub || [];
|
312 |
_iub.csConfiguration = {
|
314 |
// print configuration
|
315 |
$html .= $configuration . ',';
|
316 |
$html .= '
|
317 |
+
banner: ' . $banner_configuration . '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
};
|
319 |
</script>
|
320 |
+
<script async type="text/javascript" src="' . $script_src . '"></script>
|
321 |
+
</body>
|
|
|
322 |
</html>';
|
323 |
}
|
324 |
|
394 |
|
395 |
return (bool) $result;
|
396 |
}
|
|
|
397 |
}
|
includes/settings.php
CHANGED
@@ -51,7 +51,7 @@ class iubenda_Settings {
|
|
51 |
$this->legal_notices = array(
|
52 |
'privacy_policy',
|
53 |
'cookie_policy',
|
54 |
-
'
|
55 |
);
|
56 |
|
57 |
$this->tabs = array(
|
@@ -952,7 +952,7 @@ class iubenda_Settings {
|
|
952 |
echo '
|
953 |
<p class="description">' . __( 'If you\'re experiencing issues with AMP setup download the generated iubenda AMP configuration file, upload it to any SSL server and paste the file link to the field above.', 'iubenda' ) . '</p>
|
954 |
</div>
|
955 |
-
<p class="description">' . sprintf( __( 'Seeing the AMP cookie notice when testing from Google but not when visiting your AMP pages directly? <a href="%s" target="_blank">Learn how to fix it</a>.', 'iubenda' ), 'https://www.iubenda.com/en/help/
|
956 |
</div>
|
957 |
</div>';
|
958 |
}
|
@@ -1420,7 +1420,17 @@ class iubenda_Settings {
|
|
1420 |
$template_done = (bool) iubenda()->AMP->generate_amp_template( $iubenda_code );
|
1421 |
}
|
1422 |
}
|
1423 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1424 |
$input['amp_template_done'] = $template_done;
|
1425 |
|
1426 |
if ( is_array( $input['amp_template'] ) ) {
|
51 |
$this->legal_notices = array(
|
52 |
'privacy_policy',
|
53 |
'cookie_policy',
|
54 |
+
'term'
|
55 |
);
|
56 |
|
57 |
$this->tabs = array(
|
952 |
echo '
|
953 |
<p class="description">' . __( 'If you\'re experiencing issues with AMP setup download the generated iubenda AMP configuration file, upload it to any SSL server and paste the file link to the field above.', 'iubenda' ) . '</p>
|
954 |
</div>
|
955 |
+
<p class="description">' . sprintf( __( 'Seeing the AMP cookie notice when testing from Google but not when visiting your AMP pages directly? <a href="%s" target="_blank">Learn how to fix it</a>.', 'iubenda' ), 'https://www.iubenda.com/en/help/22135-cookie-solution-amp-wordpress#amp-domain' ) . '</p>
|
956 |
</div>
|
957 |
</div>';
|
958 |
}
|
1420 |
$template_done = (bool) iubenda()->AMP->generate_amp_template( $iubenda_code );
|
1421 |
}
|
1422 |
}
|
1423 |
+
|
1424 |
+
// Check if AMP is checked and the auto generated option is selected
|
1425 |
+
if ("1" == $input['amp_support'] && 'local' == $input['amp_source']) {
|
1426 |
+
if (is_bool($template_done) && false === $template_done) {
|
1427 |
+
$message = "Currently, you do not have write permission for <i>%s</i>. For instructions on how to fix this, please read <a target=\"_blank\" href=\"%s\">our guide</a>.";
|
1428 |
+
$our_guide_URL = 'https://www.iubenda.com/en/help/1215-cookie-solution-wordpress-plugin-installation-guide#amp-permissions';
|
1429 |
+
$file_path = IUBENDA_PLUGIN_PATH . 'templates' . DIRECTORY_SEPARATOR;
|
1430 |
+
add_settings_error('cs_settings_errors', 'iub_cs_settings_updated', __(sprintf($message, $file_path, $our_guide_URL), 'iubenda'), 'error');
|
1431 |
+
}
|
1432 |
+
}
|
1433 |
+
|
1434 |
$input['amp_template_done'] = $template_done;
|
1435 |
|
1436 |
if ( is_array( $input['amp_template'] ) ) {
|
iubenda-cookie-class/README.md
CHANGED
@@ -98,6 +98,16 @@ These operations take place in accordance with the rules explained in [this guid
|
|
98 |
|
99 |
## Changelog
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
##### 4.1.4
|
102 |
* Fix: Move FB connect to experience enhancement
|
103 |
|
98 |
|
99 |
## Changelog
|
100 |
|
101 |
+
##### 4.1.7
|
102 |
+
* Fix: purpose evaluation for iframes blocking
|
103 |
+
|
104 |
+
##### 4.1.6
|
105 |
+
* Fix: Check script type before getting content in GTM
|
106 |
+
|
107 |
+
##### 4.1.5
|
108 |
+
* Tweak: Add google analytics to analytics scripts
|
109 |
+
* Tweak: Add data-iub-purposes on inline-scripts
|
110 |
+
|
111 |
##### 4.1.4
|
112 |
* Fix: Move FB connect to experience enhancement
|
113 |
|
iubenda-cookie-class/iubenda.class.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author iubenda s.r.l
|
6 |
* @copyright 2018-2020, iubenda s.r.l
|
7 |
* @license GNU/GPL
|
8 |
-
* @version 4.1.
|
9 |
* @deprecated
|
10 |
*
|
11 |
* This program is free software: you can redistribute it and/or modify
|
@@ -39,6 +39,16 @@ class iubendaParser {
|
|
39 |
// purposes
|
40 |
public $purposes = array();
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
// per-purpose scripts
|
43 |
public $script_tags = array(
|
44 |
// Strictly necessary
|
@@ -86,7 +96,8 @@ class iubendaParser {
|
|
86 |
'cdn.segment.com/analytics.js',
|
87 |
'i.kissmetrics.com/i.js',
|
88 |
'cdn.mxpnl.com',
|
89 |
-
'rum-static.pingdom.net/prum.min.js'
|
|
|
90 |
),
|
91 |
// Targeting & Advertising
|
92 |
5 => array(
|
@@ -144,6 +155,7 @@ class iubendaParser {
|
|
144 |
public $iframes_skipped = array();
|
145 |
public $iframes_detected = array();
|
146 |
public $iframes_converted = array();
|
|
|
147 |
public $scripts_skipped = array();
|
148 |
public $scripts_detected = array();
|
149 |
public $scripts_converted = array();
|
@@ -338,7 +350,7 @@ class iubendaParser {
|
|
338 |
// if ( array_key_exists( $purpose_id, $this->purposes ) && $this->purposes[$purpose_id] == false ) {
|
339 |
|
340 |
// block iframes unavailable in the user purposes
|
341 |
-
if ( ! isset( $this->purposes[$purpose_id] )
|
342 |
foreach ( $tags_list as $tag ) {
|
343 |
$tags[] = $tag;
|
344 |
}
|
@@ -462,6 +474,8 @@ class iubendaParser {
|
|
462 |
$scripts = $html->find( 'script' );
|
463 |
|
464 |
if ( is_array( $scripts ) ) {
|
|
|
|
|
465 |
$count = count( $scripts );
|
466 |
$class_skip = $this->iub_class_skip;
|
467 |
|
@@ -494,6 +508,12 @@ class iubendaParser {
|
|
494 |
$s->class = $class . ' ' . $this->iub_class_inline;
|
495 |
$s->type = 'text/plain';
|
496 |
$this->scripts_inline_converted[] = $s->innertext;
|
|
|
|
|
|
|
|
|
|
|
|
|
497 |
}
|
498 |
} else {
|
499 |
$src = $s->src;
|
@@ -515,6 +535,9 @@ class iubendaParser {
|
|
515 |
if ( $this->amp )
|
516 |
$s->{'data-block-on-consent'} = '_till_accepted';
|
517 |
|
|
|
|
|
|
|
518 |
$this->scripts_converted[] = $src;
|
519 |
}
|
520 |
}
|
@@ -631,7 +654,7 @@ class iubendaParser {
|
|
631 |
|
632 |
// search for scripts
|
633 |
$scripts = $document->getElementsByTagName( 'script' );
|
634 |
-
|
635 |
// any scripts?
|
636 |
if ( ! empty( $scripts ) && is_object( $scripts ) ) {
|
637 |
foreach ( $scripts as $script ) {
|
@@ -676,6 +699,9 @@ class iubendaParser {
|
|
676 |
if ( $this->amp )
|
677 |
$script->setAttribute( 'data-block-on-consent', '_till_accepted' );
|
678 |
|
|
|
|
|
|
|
679 |
// add script as converted
|
680 |
$this->scripts_converted[] = $src;
|
681 |
} elseif ( $found_inline !== false ) {
|
@@ -686,6 +712,12 @@ class iubendaParser {
|
|
686 |
if ( $this->amp )
|
687 |
$script->setAttribute( 'data-block-on-consent', '_till_accepted' );
|
688 |
|
|
|
|
|
|
|
|
|
|
|
|
|
689 |
// add inline script as converted
|
690 |
$this->scripts_inline_converted[] = $script->nodeValue;
|
691 |
}
|
@@ -1022,4 +1054,30 @@ class iubendaParser {
|
|
1022 |
return false;
|
1023 |
}
|
1024 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1025 |
}
|
5 |
* @author iubenda s.r.l
|
6 |
* @copyright 2018-2020, iubenda s.r.l
|
7 |
* @license GNU/GPL
|
8 |
+
* @version 4.1.7
|
9 |
* @deprecated
|
10 |
*
|
11 |
* This program is free software: you can redistribute it and/or modify
|
39 |
// purposes
|
40 |
public $purposes = array();
|
41 |
|
42 |
+
// Listeners to do special handling
|
43 |
+
private $observers = array(
|
44 |
+
'google-analytics.com/analytics.js' => array(
|
45 |
+
'GoogleAnalyticsListener'
|
46 |
+
),
|
47 |
+
'www.googletagmanager.com/gtag/js' => array(
|
48 |
+
'GoogleTagManagerListener'
|
49 |
+
)
|
50 |
+
);
|
51 |
+
|
52 |
// per-purpose scripts
|
53 |
public $script_tags = array(
|
54 |
// Strictly necessary
|
96 |
'cdn.segment.com/analytics.js',
|
97 |
'i.kissmetrics.com/i.js',
|
98 |
'cdn.mxpnl.com',
|
99 |
+
'rum-static.pingdom.net/prum.min.js',
|
100 |
+
'google-analytics.com/analytics.js'
|
101 |
),
|
102 |
// Targeting & Advertising
|
103 |
5 => array(
|
155 |
public $iframes_skipped = array();
|
156 |
public $iframes_detected = array();
|
157 |
public $iframes_converted = array();
|
158 |
+
public $scripts_el = array();
|
159 |
public $scripts_skipped = array();
|
160 |
public $scripts_detected = array();
|
161 |
public $scripts_converted = array();
|
350 |
// if ( array_key_exists( $purpose_id, $this->purposes ) && $this->purposes[$purpose_id] == false ) {
|
351 |
|
352 |
// block iframes unavailable in the user purposes
|
353 |
+
if ( ! isset( $this->purposes[$purpose_id] ) || $this->purposes[$purpose_id] == false ) {
|
354 |
foreach ( $tags_list as $tag ) {
|
355 |
$tags[] = $tag;
|
356 |
}
|
474 |
$scripts = $html->find( 'script' );
|
475 |
|
476 |
if ( is_array( $scripts ) ) {
|
477 |
+
|
478 |
+
$this->scripts_el = $scripts;
|
479 |
$count = count( $scripts );
|
480 |
$class_skip = $this->iub_class_skip;
|
481 |
|
508 |
$s->class = $class . ' ' . $this->iub_class_inline;
|
509 |
$s->type = 'text/plain';
|
510 |
$this->scripts_inline_converted[] = $s->innertext;
|
511 |
+
|
512 |
+
// add data-iub-purposes attribute
|
513 |
+
$s->setAttribute( 'data-iub-purposes', $this->recursive_array_search( $found, $this->script_tags ) );
|
514 |
+
|
515 |
+
# Run observers
|
516 |
+
$this->run_observers( $found, $s );
|
517 |
}
|
518 |
} else {
|
519 |
$src = $s->src;
|
535 |
if ( $this->amp )
|
536 |
$s->{'data-block-on-consent'} = '_till_accepted';
|
537 |
|
538 |
+
// Run observers
|
539 |
+
$this->run_observers( $found, $s );
|
540 |
+
|
541 |
$this->scripts_converted[] = $src;
|
542 |
}
|
543 |
}
|
654 |
|
655 |
// search for scripts
|
656 |
$scripts = $document->getElementsByTagName( 'script' );
|
657 |
+
$this->scripts_el = $scripts;
|
658 |
// any scripts?
|
659 |
if ( ! empty( $scripts ) && is_object( $scripts ) ) {
|
660 |
foreach ( $scripts as $script ) {
|
699 |
if ( $this->amp )
|
700 |
$script->setAttribute( 'data-block-on-consent', '_till_accepted' );
|
701 |
|
702 |
+
// Run observers
|
703 |
+
$this->run_observers( $found, $script );
|
704 |
+
|
705 |
// add script as converted
|
706 |
$this->scripts_converted[] = $src;
|
707 |
} elseif ( $found_inline !== false ) {
|
712 |
if ( $this->amp )
|
713 |
$script->setAttribute( 'data-block-on-consent', '_till_accepted' );
|
714 |
|
715 |
+
// add data-iub-purposes attribute
|
716 |
+
$script->setAttribute( 'data-iub-purposes', $this->recursive_array_search( $found_inline, $this->script_tags ) );
|
717 |
+
|
718 |
+
// Run observers
|
719 |
+
$this->run_observers( $found_inline, $script );
|
720 |
+
|
721 |
// add inline script as converted
|
722 |
$this->scripts_inline_converted[] = $script->nodeValue;
|
723 |
}
|
1054 |
return false;
|
1055 |
}
|
1056 |
|
1057 |
+
/**
|
1058 |
+
* Get the activate classes
|
1059 |
+
*
|
1060 |
+
* @return array
|
1061 |
+
*/
|
1062 |
+
public function get_activate_classes() {
|
1063 |
+
return array( $this->iub_class, $this->iub_class_inline );
|
1064 |
+
}
|
1065 |
+
|
1066 |
+
/**
|
1067 |
+
* @param string $link
|
1068 |
+
* @param DOMElement $script
|
1069 |
+
*/
|
1070 |
+
private function run_observers( $link, $script ) {
|
1071 |
+
# Escape if there is no defined observer for link
|
1072 |
+
if ( ! isset( $this->observers[ $link ] ) ) {
|
1073 |
+
return;
|
1074 |
+
}
|
1075 |
+
|
1076 |
+
# Loop on script listeners
|
1077 |
+
foreach ( $this->observers[ $link ] as $class ) {
|
1078 |
+
require_once "listeners/{$class}.php";
|
1079 |
+
$listener_instance = new $class( $script, $this );
|
1080 |
+
$listener_instance->handle();
|
1081 |
+
}
|
1082 |
+
}
|
1083 |
}
|
iubenda-cookie-class/listeners/GoogleAnalyticsListener.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class GoogleAnalyticsListener {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @var DOMElement
|
7 |
+
*/
|
8 |
+
private $script;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var iubendaParser
|
12 |
+
*/
|
13 |
+
private $iub_parser;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Pattern to detect the anonymize configuration
|
17 |
+
*
|
18 |
+
* @var string
|
19 |
+
*/
|
20 |
+
private $GA_anonymize_pattern = '~^(?:(?!//).)*?(ga.+(set)\b.+(,).+(anonymizeIp)\b.+(,).+(true|[1]{1})\b)(?!(?:(?!/\*)[\s\S])*\*/)~mi';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* GoogleAnalyticsListener constructor.
|
24 |
+
*
|
25 |
+
* @param DOMElement|simple_html_dom_node $script
|
26 |
+
* @param iubendaParser $iub_parser
|
27 |
+
*/
|
28 |
+
public function __construct( $script, $iub_parser ) {
|
29 |
+
$this->script = $script;
|
30 |
+
$this->iub_parser = $iub_parser;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Special handling for enabled anonymizeIP flag
|
35 |
+
*/
|
36 |
+
public function handle() {
|
37 |
+
if ( $this->script instanceof simple_html_dom_node ) {
|
38 |
+
$str = $this->script->innertext;
|
39 |
+
} else {
|
40 |
+
$str = $this->script->nodeValue;
|
41 |
+
}
|
42 |
+
|
43 |
+
# if the GA is anonymized then unblock it
|
44 |
+
if ( preg_match( $this->GA_anonymize_pattern, $str ) ) {
|
45 |
+
$this->unblock_script();
|
46 |
+
|
47 |
+
return;
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Unblock script and reset to the original
|
53 |
+
*/
|
54 |
+
private function unblock_script() {
|
55 |
+
$classes = array_filter( explode( ' ', $this->script->getAttribute( 'class' ) ) );
|
56 |
+
$flip = array_flip( $classes );
|
57 |
+
|
58 |
+
# Loop on iub activate classes and remove them
|
59 |
+
foreach ( $this->iub_parser->get_activate_classes() as $val ) {
|
60 |
+
if ( isset( $flip[ $val ] ) ) {
|
61 |
+
unset( $flip[ $val ] );
|
62 |
+
}
|
63 |
+
}
|
64 |
+
$classes = implode( ' ', array_flip( $flip ) );
|
65 |
+
# Reset everything to original
|
66 |
+
$this->script->setAttribute( 'type', 'text/javascript' );
|
67 |
+
$this->script->setAttribute( 'class', $classes );
|
68 |
+
# Remove AMP support
|
69 |
+
$this->script->removeAttribute( 'data-block-on-consent' );
|
70 |
+
$this->script->removeAttribute( 'data-iub-purposes' );
|
71 |
+
}
|
72 |
+
}
|
iubenda-cookie-class/listeners/GoogleTagManagerListener.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class GoogleTagManagerListener {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @var DOMElement|simple_html_dom_node
|
7 |
+
*/
|
8 |
+
private $script;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var iubendaParser
|
12 |
+
*/
|
13 |
+
private $iub_parser;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Pattern to detect the anonymize configuration
|
17 |
+
*
|
18 |
+
* @var string
|
19 |
+
*/
|
20 |
+
private $gtag_anonymize_pattern = '~^(?:(?!//).)*?(gtag.+(config)\b.+(,).+(,).+({).+(anonymize_ip)\b.+(:).+(true|[1]{1})\b)(?!(?:(?!/\*)[\s\S])*\*/)~mi';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* GoogleAnalyticsListener constructor.
|
24 |
+
*
|
25 |
+
* @param DOMElement|simple_html_dom_node $script
|
26 |
+
* @param iubendaParser $iub_parser
|
27 |
+
*/
|
28 |
+
public function __construct( $script, $iub_parser ) {
|
29 |
+
$this->script = $script;
|
30 |
+
$this->iub_parser = $iub_parser;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Special handling for enabled anonymizeIP flag
|
35 |
+
*/
|
36 |
+
public function handle() {
|
37 |
+
# Loop on all scripts
|
38 |
+
foreach ( $this->iub_parser->scripts_el as $script ) {
|
39 |
+
if ( $this->script instanceof simple_html_dom_node ) {
|
40 |
+
$str = $script->innertext;
|
41 |
+
} else {
|
42 |
+
$str = $script->nodeValue;
|
43 |
+
}
|
44 |
+
|
45 |
+
# Avoid non inline-scripts
|
46 |
+
if ( ! trim( $str ) ) {
|
47 |
+
continue;
|
48 |
+
}
|
49 |
+
|
50 |
+
# Match the gtag anonymize pattern
|
51 |
+
if ( preg_match( $this->gtag_anonymize_pattern, $str ) ) {
|
52 |
+
$this->unblock_script();
|
53 |
+
break;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Unblock script and reset to the original
|
60 |
+
*/
|
61 |
+
private function unblock_script() {
|
62 |
+
$classes = array_filter( explode( ' ', $this->script->getAttribute( 'class' ) ) );
|
63 |
+
$flip = array_flip( $classes );
|
64 |
+
|
65 |
+
# Loop on iub activate classes and remove them
|
66 |
+
foreach ( $this->iub_parser->get_activate_classes() as $val ) {
|
67 |
+
if ( isset( $flip[ $val ] ) ) {
|
68 |
+
unset( $flip[ $val ] );
|
69 |
+
}
|
70 |
+
}
|
71 |
+
$classes = implode( ' ', array_flip( $flip ) );
|
72 |
+
# Reset everything to original
|
73 |
+
$this->script->setAttribute( 'type', 'text/javascript' );
|
74 |
+
$this->script->setAttribute( 'class', $classes );
|
75 |
+
$this->script->removeAttribute( 'data-iub-purposes' );
|
76 |
+
|
77 |
+
# Remove AMP support
|
78 |
+
$this->script->removeAttribute( 'data-block-on-consent' );
|
79 |
+
}
|
80 |
+
}
|
iubenda_cookie_solution.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Cookie and Consent Solution for the GDPR & ePrivacy
|
4 |
Plugin URI: https://www.iubenda.com
|
5 |
Description: An All-in-One approach developed by iubenda, which includes functionalities of two powerful solutions that help to make your website GDPR and ePrivacy compliant.
|
6 |
-
Version: 2.3.
|
7 |
Author: iubenda
|
8 |
Author URI: https://www.iubenda.com
|
9 |
License: MIT License
|
@@ -32,7 +32,7 @@ define( 'IUB_DEBUG', false );
|
|
32 |
* iubenda final class.
|
33 |
*
|
34 |
* @class iubenda
|
35 |
-
* @version 2.3.
|
36 |
*/
|
37 |
class iubenda {
|
38 |
|
@@ -61,7 +61,7 @@ class iubenda {
|
|
61 |
)
|
62 |
);
|
63 |
public $base_url;
|
64 |
-
public $version = '2.3.
|
65 |
public $activation = array(
|
66 |
'update_version' => 0,
|
67 |
'update_notice' => true,
|
@@ -275,18 +275,34 @@ class iubenda {
|
|
275 |
* @return void
|
276 |
*/
|
277 |
public function upgrade( $upgrader_object, $options ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
// the path to our plugin's main file
|
279 |
$our_plugin = plugin_basename( __FILE__ );
|
280 |
|
281 |
-
//
|
282 |
-
if ( $options['
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
|
|
|
|
290 |
}
|
291 |
}
|
292 |
|
@@ -648,7 +664,7 @@ class iubenda {
|
|
648 |
|
649 |
// generate AMP template file if AMP plugins available
|
650 |
if ( function_exists( 'is_amp_endpoint' ) || function_exists( 'ampforwp_is_amp_endpoint' ) ) {
|
651 |
-
|
652 |
}
|
653 |
}
|
654 |
|
@@ -714,6 +730,13 @@ class iubenda {
|
|
714 |
unset( $decoded['callback'] );
|
715 |
if ( isset( $decoded['perPurposeConsent'] ) )
|
716 |
unset( $decoded['perPurposeConsent'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
717 |
}
|
718 |
|
719 |
$configuration = $decoded;
|
@@ -816,6 +839,37 @@ class iubenda {
|
|
816 |
return apply_filters( 'iub_code_allowed_html', $html );
|
817 |
}
|
818 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
819 |
}
|
820 |
|
821 |
/**
|
3 |
Plugin Name: Cookie and Consent Solution for the GDPR & ePrivacy
|
4 |
Plugin URI: https://www.iubenda.com
|
5 |
Description: An All-in-One approach developed by iubenda, which includes functionalities of two powerful solutions that help to make your website GDPR and ePrivacy compliant.
|
6 |
+
Version: 2.3.17
|
7 |
Author: iubenda
|
8 |
Author URI: https://www.iubenda.com
|
9 |
License: MIT License
|
32 |
* iubenda final class.
|
33 |
*
|
34 |
* @class iubenda
|
35 |
+
* @version 2.3.17
|
36 |
*/
|
37 |
class iubenda {
|
38 |
|
61 |
)
|
62 |
);
|
63 |
public $base_url;
|
64 |
+
public $version = '2.3.17';
|
65 |
public $activation = array(
|
66 |
'update_version' => 0,
|
67 |
'update_notice' => true,
|
275 |
* @return void
|
276 |
*/
|
277 |
public function upgrade( $upgrader_object, $options ) {
|
278 |
+
// if an update has taken place and the updated type is plugins and the plugins element exists
|
279 |
+
if ( 'update' == $options['action'] && 'plugin' == $options['type'] ) {
|
280 |
+
$this->set_transient_flag_on_plugin_upgrade( $options );
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Set the transient flag on the plugin upgrade/update
|
286 |
+
*
|
287 |
+
* @param array $options
|
288 |
+
*
|
289 |
+
* @return void
|
290 |
+
*/
|
291 |
+
private function set_transient_flag_on_plugin_upgrade( $options ) {
|
292 |
// the path to our plugin's main file
|
293 |
$our_plugin = plugin_basename( __FILE__ );
|
294 |
|
295 |
+
// Check our plugin is there and being updated
|
296 |
+
if ( isset( $options['plugins'] ) && is_array( $options['plugins'] ) && in_array( $our_plugin, $options['plugins'] ) ) {
|
297 |
+
|
298 |
+
// set a transient to record that our plugin has just been updated
|
299 |
+
set_transient( 'iub_upgrade_completed', 1, 3600 );
|
300 |
+
return;
|
301 |
+
}
|
302 |
+
|
303 |
+
// Check our plugin is there and being updated
|
304 |
+
if ( isset( $options['plugin'] ) && __FILE__ == $options['plugin'] ) {
|
305 |
+
set_transient( 'iub_upgrade_completed', 1, 3600 );
|
306 |
}
|
307 |
}
|
308 |
|
664 |
|
665 |
// generate AMP template file if AMP plugins available
|
666 |
if ( function_exists( 'is_amp_endpoint' ) || function_exists( 'ampforwp_is_amp_endpoint' ) ) {
|
667 |
+
$this->regenerate_amp_templates();
|
668 |
}
|
669 |
}
|
670 |
|
730 |
unset( $decoded['callback'] );
|
731 |
if ( isset( $decoded['perPurposeConsent'] ) )
|
732 |
unset( $decoded['perPurposeConsent'] );
|
733 |
+
// Banner mode to get banner configuration only
|
734 |
+
} else if ( 'banner' == $args['mode'] ) {
|
735 |
+
if ( isset( $decoded['banner'] ) ) {
|
736 |
+
return $decoded['banner'];
|
737 |
+
}
|
738 |
+
|
739 |
+
return array();
|
740 |
}
|
741 |
|
742 |
$configuration = $decoded;
|
839 |
return apply_filters( 'iub_code_allowed_html', $html );
|
840 |
}
|
841 |
|
842 |
+
/**
|
843 |
+
* Re-generate the amp templates
|
844 |
+
*/
|
845 |
+
private function regenerate_amp_templates() {
|
846 |
+
// For multi-language
|
847 |
+
if ( iubenda()->multilang && ! empty( iubenda()->languages ) ) {
|
848 |
+
foreach ( iubenda()->languages as $lang_id => $lang_name ) {
|
849 |
+
// get code for the language
|
850 |
+
$code = '';
|
851 |
+
if ( ! empty( iubenda()->options['cs'][ 'code_' . $lang_id ] ) ) {
|
852 |
+
$code = html_entity_decode( iubenda()->parse_code( iubenda()->options['cs'][ 'code_' . $lang_id ] ) );
|
853 |
+
}
|
854 |
+
|
855 |
+
// handle default, if empty
|
856 |
+
if ( empty( $code ) && $lang_id == iubenda()->lang_default ) {
|
857 |
+
$code = iubenda()->parse_code( iubenda()->options['cs']['code_default'] );
|
858 |
+
}
|
859 |
+
|
860 |
+
// Generate code if it was set for the selected language
|
861 |
+
if ( ! empty( $code ) ) {
|
862 |
+
iubenda()->AMP->generate_amp_template( $code, $lang_id );
|
863 |
+
}
|
864 |
+
}
|
865 |
+
|
866 |
+
return;
|
867 |
+
}
|
868 |
+
|
869 |
+
// For one language
|
870 |
+
$code = iubenda()->options['cs']['code_default'];
|
871 |
+
iubenda()->AMP->generate_amp_template( $code );
|
872 |
+
}
|
873 |
}
|
874 |
|
875 |
/**
|
languages/iubenda-cookie-law-solution-it_IT.po
CHANGED
@@ -782,6 +782,10 @@ msgstr "Eliminazione del form fallita."
|
|
782 |
msgid "Dismiss this notice."
|
783 |
msgstr "Chiudi questo avviso."
|
784 |
|
|
|
|
|
|
|
|
|
785 |
#, fuzzy
|
786 |
#~| msgid "Settings applied successfully"
|
787 |
#~ msgid "Forms detected successfully."
|
782 |
msgid "Dismiss this notice."
|
783 |
msgstr "Chiudi questo avviso."
|
784 |
|
785 |
+
#: includes/settings.php:1424
|
786 |
+
msgid "Currently, you do not have write permission for <i>%s</i>. For instructions on how to fix this, please read <a target=\"_blank\" href=\"%s\">our guide</a>."
|
787 |
+
msgstr "Al momento non disponi dei permessi di scrittura per <i>%s</i>. Leggi la <a target=\"_blank\" href=\"%s\">nostra guida</a> per istruzioni su come risolvere il problema."
|
788 |
+
|
789 |
#, fuzzy
|
790 |
#~| msgid "Settings applied successfully"
|
791 |
#~ msgid "Forms detected successfully."
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Donate link:
|
|
4 |
Tags: cookies, cookie law, cookie policy, cookie banner, privacy policy, cookie consent, privacy, gdpr, eprivacy
|
5 |
Requires at least: 4.0
|
6 |
Requires PHP: 5.2.4
|
7 |
-
Tested up to: 5.
|
8 |
-
Stable tag: 2.3.
|
9 |
License: MIT License
|
10 |
License URI: http://opensource.org/licenses/MIT
|
11 |
|
@@ -150,6 +150,27 @@ We will be very happy to receive feedback here: [Uservoice forum](https://suppor
|
|
150 |
|
151 |
== Changelog ==
|
152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
= 2.3.11 =
|
154 |
* Fix: Move the FB connect to experience enhancement
|
155 |
* Tweak: Add Google GPT to per-purpose blocking support in engines
|
@@ -468,6 +489,5 @@ We will be very happy to receive feedback here: [Uservoice forum](https://suppor
|
|
468 |
|
469 |
== Upgrade Notice ==
|
470 |
|
471 |
-
= 2.3.
|
472 |
-
*
|
473 |
-
* Tweak: Add Google GPT to per-purpose blocking support in engines
|
4 |
Tags: cookies, cookie law, cookie policy, cookie banner, privacy policy, cookie consent, privacy, gdpr, eprivacy
|
5 |
Requires at least: 4.0
|
6 |
Requires PHP: 5.2.4
|
7 |
+
Tested up to: 5.6.0
|
8 |
+
Stable tag: 2.3.16
|
9 |
License: MIT License
|
10 |
License URI: http://opensource.org/licenses/MIT
|
11 |
|
150 |
|
151 |
== Changelog ==
|
152 |
|
153 |
+
= 2.3.17 =
|
154 |
+
* New: Use the new check consent end point
|
155 |
+
|
156 |
+
= 2.3.16 =
|
157 |
+
* Fix: purpose evaluation for iframes blocking
|
158 |
+
|
159 |
+
= 2.3.15 =
|
160 |
+
* Fix: ConS saves the wrong terms & conditions legal_notice
|
161 |
+
|
162 |
+
= 2.3.14 =
|
163 |
+
* Tweak: Support WP 5.6
|
164 |
+
|
165 |
+
= 2.3.13 =
|
166 |
+
* Fix: Check script type before getting content in GTM
|
167 |
+
|
168 |
+
= 2.3.12 =
|
169 |
+
* Fix: Allow banner customization in AMP
|
170 |
+
* Tweak: Add alert about lack of permissions on templates folder
|
171 |
+
* Tweak: Add GA to per-purpose blocking support
|
172 |
+
* Fix: Add per-purpose on inline script tags
|
173 |
+
|
174 |
= 2.3.11 =
|
175 |
* Fix: Move the FB connect to experience enhancement
|
176 |
* Tweak: Add Google GPT to per-purpose blocking support in engines
|
489 |
|
490 |
== Upgrade Notice ==
|
491 |
|
492 |
+
= 2.3.17-beta =
|
493 |
+
* New: Use the new check consent end point
|
|