iubenda Cookie Solution for GDPR - Version 2.4.0

Version Description

  • New: Use the new check consent endpoint
  • Fix: Regenerate AMP files on plugin update
  • New: Support WPRollback on plugin update
Download this release

Release Info

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

Code changes from version 2.3.16 to 2.4.0

includes/amp.php CHANGED
@@ -16,23 +16,57 @@ class iubenda_AMP {
16
  * @var array
17
  */
18
  private $required_banner_configuration = array(
19
- 'position' => 'float-bottom-center',
20
  'acceptButtonDisplay' => true,
21
  'customizeButtonDisplay' => true,
22
  'rejectButtonDisplay' => true,
23
  'backgroundOverlay' => true
24
  );
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  /**
27
  * Class constructor.
28
  */
29
  public function __construct() {
30
  // actions
31
  add_action( 'wp_head', array( $this, 'wp_head_amp' ), 100 );
 
32
  add_action( 'wp_footer', array( $this, 'wp_footer_amp' ), 100 );
33
- add_action( 'amp_post_template_css', array( $this, 'amp_post_template_css' ), 100 );
34
  add_action( 'amp_post_template_footer', array( $this, 'wp_footer_amp' ), 100 );
35
- add_action( 'amp_post_template_footer', array( $this, 'fix_analytics_amp_for_wp' ), 1 );
 
36
 
37
  // filters
38
  add_filter( 'amp_post_template_data', array( $this, 'amp_post_template_data' ), 100 );
@@ -48,10 +82,9 @@ class iubenda_AMP {
48
  if ( iubenda()->options['cs']['amp_support'] === false )
49
  return;
50
 
51
- if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() && ! function_exists( 'ampforwp_is_amp_endpoint' ) ) {
52
  echo '
53
- <script async custom-element="amp-consent" src="https://cdn.ampproject.org/v0/amp-consent-latest.js"></script>
54
- <script async custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/amp-iframe-latest.js"></script>';
55
 
56
  // optional geo support
57
  if ( iubenda()->multilang && ! empty( iubenda()->lang_current ) ) {
@@ -67,28 +100,22 @@ class iubenda_AMP {
67
  <script async custom-element="amp-geo" src="https://cdn.ampproject.org/v0/amp-geo-0.1.js"></script>';
68
  }
69
 
70
- // CSS style
71
- echo '
72
- <style amp-custom>
73
- .popupOverlay {
74
- position:fixed;
75
- top: 0;
76
- bottom: 0;
77
- left: 0;
78
- right: 0;
79
- }
80
- amp-iframe {
81
- margin: 0;
82
- }
83
- amp-consent.amp-active {
84
- position:fixed;
85
- top: 0;
86
- bottom: 0;
87
- left: 0;
88
- right: 0;
89
- }
90
- </style>';
91
  }
 
 
 
92
  }
93
 
94
  /**
@@ -134,24 +161,23 @@ class iubenda_AMP {
134
  return;
135
 
136
  echo '
137
- <amp-consent id="myUserConsent" layout="nodisplay">
138
  <script type="application/json">
139
  {
140
- "consentInstanceId": "consent' . $configuration['siteId'] . '",
141
- "consentRequired": "remote",
142
- "checkConsentHref": "https://amp.iubenda.com/cs/amp/checkConsent",
143
- "promptUI": "myConsentFlow"
144
  }
145
  </script>
146
- <div id="myConsentFlow" class="popupOverlay">
147
- <amp-iframe
148
- layout="fill"
149
- sandbox="allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox"
150
- src="' . esc_url( $template_url ) . '">
151
- <div placeholder>' . __( 'Loading', 'iubenda' ) . '</div>
152
- </amp-iframe>
153
- </div>
154
- </amp-consent>';
 
155
  }
156
  }
157
 
@@ -168,43 +194,11 @@ class iubenda_AMP {
168
  $data['amp_component_scripts'] = array_merge( $data['amp_component_scripts'],
169
  array( 'amp-consent' => 'https://cdn.ampproject.org/v0/amp-consent-latest.js' )
170
  );
171
- $data['amp_component_scripts'] = array_merge( $data['amp_component_scripts'],
172
- array( 'amp-iframe' => 'https://cdn.ampproject.org/v0/amp-iframe-latest.js' )
173
- );
174
  }
175
 
176
  return $data;
177
  }
178
 
179
- /**
180
- * Add CSS to AMP for WP plugin and WP AMP plugin in Standard mode.
181
- *
182
- * @return mixed
183
- */
184
- public function amp_post_template_css( $data ) {
185
- if ( iubenda()->options['cs']['amp_support'] === false )
186
- return;
187
-
188
- echo '
189
- .popupOverlay {
190
- position:fixed;
191
- top: 0;
192
- bottom: 0;
193
- left: 0;
194
- right: 0;
195
- }
196
- amp-iframe {
197
- margin: 0;
198
- }
199
- amp-consent.amp-active {
200
- position:fixed;
201
- top: 0;
202
- bottom: 0;
203
- left: 0;
204
- right: 0;
205
- }';
206
- }
207
-
208
  /**
209
  * Block analytics in AMP for WP plugin.
210
  *
@@ -284,6 +278,35 @@ amp-consent.amp-active {
284
  <meta name="robots" content="noindex">
285
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
286
  <title>' . __( 'AMP Cookie Consent', 'iubenda' ) . '</title>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  <script type="text/javascript">
288
  var _iub = _iub || [];
289
  _iub.csConfiguration = {
@@ -291,49 +314,11 @@ amp-consent.amp-active {
291
  // print configuration
292
  $html .= $configuration . ',';
293
  $html .= '
294
- banner: ' . $banner_configuration . ',
295
- callback: { // Mandatory
296
- onPreferenceExpressed: function(preference) {
297
- var AMP_CONSENT_STRING_MAX_LENGTH = 1024;
298
- var consentObject = {
299
- type: \'consent-response\',
300
- action: preference && preference.consent ? \'accept\' : \'reject\'
301
- };
302
-
303
- if (typeof window.__tcfapi === \'function\') {
304
- __tcfapi(\'getTCData\', 2, function(res) {
305
- var consentString = res.tcString;
306
-
307
- if (consentString.length <= AMP_CONSENT_STRING_MAX_LENGTH) {
308
- consentObject.info = consentString;
309
- }
310
-
311
- console.log(\'send consent-response\', consentObject.action, \'with CMP v2 consent string\', consentString);
312
- window.parent.postMessage(consentObject, \'*\');
313
- });
314
- }
315
- else if (typeof window.__cmp === \'function\') {
316
- __cmp(\'getConsentData\', null, function(res) {
317
- var consentString = res.consentData;
318
-
319
- if (consentString.length <= AMP_CONSENT_STRING_MAX_LENGTH) {
320
- consentObject.info = consentString;
321
- }
322
-
323
- console.log(\'send consent-response\', consentObject.action, \'with CMP consent string\', consentString);
324
- window.parent.postMessage(consentObject, \'*\');
325
- });
326
- } else {
327
- console.log(\'send consent-response\', consentObject.action);
328
- window.parent.postMessage(consentObject, \'*\');
329
- }
330
- }
331
- }
332
  };
333
  </script>
334
- <script async src="' . $script_src . '"></script>
335
- </head>
336
- <body></body>
337
  </html>';
338
  }
339
 
@@ -409,5 +394,4 @@ amp-consent.amp-active {
409
 
410
  return (bool) $result;
411
  }
412
-
413
  }
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
  *
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
  }
iubenda-cookie-class/README.md CHANGED
@@ -98,6 +98,9 @@ These operations take place in accordance with the rules explained in [this guid
98
 
99
  ## Changelog
100
 
 
 
 
101
  ##### 4.1.7
102
  * Fix: purpose evaluation for iframes blocking
103
 
98
 
99
  ## Changelog
100
 
101
+ ##### 4.1.8
102
+ * Fix: Avoid overriding the purposes attr if it was set
103
+
104
  ##### 4.1.7
105
  * Fix: purpose evaluation for iframes blocking
106
 
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.7
9
  * @deprecated
10
  *
11
  * This program is free software: you can redistribute it and/or modify
@@ -510,7 +510,7 @@ class iubendaParser {
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 );
@@ -529,7 +529,7 @@ class iubendaParser {
529
  $s->type = 'text/plain';
530
 
531
  // add data-iub-purposes attribute
532
- $s->{'data-iub-purposes'} = $this->recursive_array_search( $found, $this->script_tags );
533
 
534
  // AMP support
535
  if ( $this->amp )
@@ -693,7 +693,7 @@ class iubendaParser {
693
  $script->setAttribute( 'class', $script->getAttribute( 'class' ) . ' ' . $class );
694
 
695
  // add data-iub-purposes attribute
696
- $script->setAttribute( 'data-iub-purposes', $this->recursive_array_search( $found, $this->script_tags ) );
697
 
698
  // AMP support
699
  if ( $this->amp )
@@ -713,7 +713,7 @@ class iubendaParser {
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 );
@@ -1080,4 +1080,16 @@ class iubendaParser {
1080
  $listener_instance->handle();
1081
  }
1082
  }
 
 
 
 
 
 
 
 
 
 
 
 
1083
  }
5
  * @author iubenda s.r.l
6
  * @copyright 2018-2020, iubenda s.r.l
7
  * @license GNU/GPL
8
+ * @version 4.1.8
9
  * @deprecated
10
  *
11
  * This program is free software: you can redistribute it and/or modify
510
  $this->scripts_inline_converted[] = $s->innertext;
511
 
512
  // add data-iub-purposes attribute
513
+ $this->set_purpose($s, $found);
514
 
515
  # Run observers
516
  $this->run_observers( $found, $s );
529
  $s->type = 'text/plain';
530
 
531
  // add data-iub-purposes attribute
532
+ $this->set_purpose($s, $found);
533
 
534
  // AMP support
535
  if ( $this->amp )
693
  $script->setAttribute( 'class', $script->getAttribute( 'class' ) . ' ' . $class );
694
 
695
  // add data-iub-purposes attribute
696
+ $this->set_purpose( $script, $found );
697
 
698
  // AMP support
699
  if ( $this->amp )
713
  $script->setAttribute( 'data-block-on-consent', '_till_accepted' );
714
 
715
  // add data-iub-purposes attribute
716
+ $this->set_purpose($script, $found_inline);
717
 
718
  // Run observers
719
  $this->run_observers( $found_inline, $script );
1080
  $listener_instance->handle();
1081
  }
1082
  }
1083
+
1084
+ /**
1085
+ * Set purpose on script tag if not exist
1086
+ *
1087
+ * @param $script
1088
+ * @param $url
1089
+ */
1090
+ private function set_purpose( $script, $url ) {
1091
+ if ( ! $script->hasAttribute( 'data-iub-purposes' ) ) {
1092
+ $script->setAttribute( 'data-iub-purposes', $this->recursive_array_search( $url, $this->script_tags ) );
1093
+ }
1094
+ }
1095
  }
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.16
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.16
36
  */
37
  class iubenda {
38
 
@@ -61,7 +61,7 @@ class iubenda {
61
  )
62
  );
63
  public $base_url;
64
- public $version = '2.3.16';
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
- // if an update has taken place and the updated type is plugins and the plugins element exists
282
- if ( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
283
- // iterate through the plugins being updated and check if ours is there
284
- foreach ( $options['plugins'] as $plugin ) {
285
- if ( $plugin == $our_plugin ) {
286
- // set a transient to record that our plugin has just been updated
287
- set_transient( 'iub_upgrade_completed', 1, 3600 );
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
- iubenda()->AMP->generate_amp_template();
652
  }
653
  }
654
 
@@ -823,6 +839,37 @@ class iubenda {
823
  return apply_filters( 'iub_code_allowed_html', $html );
824
  }
825
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
826
  }
827
 
828
  /**
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.4.0
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.4.0
36
  */
37
  class iubenda {
38
 
61
  )
62
  );
63
  public $base_url;
64
+ public $version = '2.4.0';
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
 
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
  /**
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: cookies, cookie law, cookie policy, cookie banner, privacy policy, cookie
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,6 +150,17 @@ We will be very happy to receive feedback here: [Uservoice forum](https://suppor
150
 
151
  == Changelog ==
152
 
 
 
 
 
 
 
 
 
 
 
 
153
  = 2.3.16 =
154
  * Fix: purpose evaluation for iframes blocking
155
 
@@ -486,5 +497,7 @@ We will be very happy to receive feedback here: [Uservoice forum](https://suppor
486
 
487
  == Upgrade Notice ==
488
 
489
- = 2.3.16 =
490
- * Fix: purpose evaluation for iframes blocking
 
 
5
  Requires at least: 4.0
6
  Requires PHP: 5.2.4
7
  Tested up to: 5.6.0
8
+ Stable tag: 2.4.0
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
11
 
150
 
151
  == Changelog ==
152
 
153
+ = 2.4.0 =
154
+ * New: Use the new check consent endpoint
155
+ * Fix: Regenerate AMP files on plugin update
156
+ * New: Support WPRollback on plugin update
157
+
158
+ = 2.3.18 =
159
+ * Fix: Avoid overriding the purposes attr if it was set
160
+
161
+ = 2.3.17 =
162
+ * New: Use the new check consent end point
163
+
164
  = 2.3.16 =
165
  * Fix: purpose evaluation for iframes blocking
166
 
497
 
498
  == Upgrade Notice ==
499
 
500
+ = 2.4.0 =
501
+ * New: Use the new check consent endpoint
502
+ * Fix: Regenerate AMP files on plugin update
503
+ * New: Support WPRollback on plugin update