iubenda Cookie Solution for GDPR - Version 2.5.4

Version Description

  • Cast preferences field into boolean in WPForms.
  • Fix preference field not saved in CF7.
  • Integrate with Germanized for WooCommerce in ConS.
  • Allow only the mapped forms in ConS.
  • Allow mapping the ConS forms without specifying the preferences field.
Download this release

Release Info

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

Code changes from version 2.5.3 to 2.5.4

includes/forms.php CHANGED
@@ -48,7 +48,7 @@ class iubenda_Forms {
48
 
49
  $form_id = $this->array_get( $_POST, 'wpforms.id' );
50
  $form_args = array(
51
- 'post_status' => array( 'mapped', 'needs_update' ),
52
  'source' => 'wpforms',
53
  'id' => $form_id,
54
  );
@@ -120,7 +120,7 @@ class iubenda_Forms {
120
  $args = array();
121
 
122
  $form_args = array(
123
- 'post_status' => array( 'mapped', 'needs_update' )
124
  );
125
 
126
  $forms = $this->get_forms( $form_args );
@@ -682,6 +682,10 @@ class iubenda_Forms {
682
  foreach ( $fields_raw as $field ) {
683
  // specific field types only
684
  if ( ! empty( $field['basetype'] ) && ! in_array( $field['basetype'], $restricted_fields ) ) {
 
 
 
 
685
  $formdata['form_fields'][] = $field['name'];
686
  }
687
  }
@@ -760,6 +764,14 @@ class iubenda_Forms {
760
  )
761
  );
762
 
 
 
 
 
 
 
 
 
763
  $checkout_form = ob_get_contents();
764
  ob_end_clean();
765
 
@@ -994,8 +1006,8 @@ class iubenda_Forms {
994
  )
995
  ),
996
  'post_type' => 'iubenda_form',
997
- 'post_status' => 'any',
998
- 'posts_per_page' => '1',
999
  'fields' => 'ids'
1000
  );
1001
 
@@ -1160,6 +1172,34 @@ class iubenda_Forms {
1160
  }
1161
 
1162
  $data[ $key ][ $map_key ] = $this->array_get( $entry, $array_key );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1163
  }
1164
 
1165
  return $data;
48
 
49
  $form_id = $this->array_get( $_POST, 'wpforms.id' );
50
  $form_args = array(
51
+ 'post_status' => array('mapped'),
52
  'source' => 'wpforms',
53
  'id' => $form_id,
54
  );
120
  $args = array();
121
 
122
  $form_args = array(
123
+ 'post_status' => array( 'mapped' )
124
  );
125
 
126
  $forms = $this->get_forms( $form_args );
682
  foreach ( $fields_raw as $field ) {
683
  // specific field types only
684
  if ( ! empty( $field['basetype'] ) && ! in_array( $field['basetype'], $restricted_fields ) ) {
685
+ // Track exclusive fields only [ex: name=field[] not supported by cons]
686
+ if ( 'checkbox' == $field['type'] && ! in_array( 'exclusive', $field['options'] ) ) {
687
+ continue;
688
+ }
689
  $formdata['form_fields'][] = $field['name'];
690
  }
691
  }
764
  )
765
  );
766
 
767
+ // Germanized for WooCommerce
768
+ if (class_exists('WooCommerce_Germanized')) {
769
+ woocommerce_gzd_template_render_checkout_checkboxes();
770
+ }
771
+
772
+ // Allow users integrate with other plugins
773
+ do_action("iub_render_{$source}_form");
774
+
775
  $checkout_form = ob_get_contents();
776
  ob_end_clean();
777
 
1006
  )
1007
  ),
1008
  'post_type' => 'iubenda_form',
1009
+ 'post_status' => isset($args['post_status']) ? $args['post_status'] : 'any',
1010
+ 'posts_per_page' => '1',
1011
  'fields' => 'ids'
1012
  );
1013
 
1172
  }
1173
 
1174
  $data[ $key ][ $map_key ] = $this->array_get( $entry, $array_key );
1175
+
1176
+ // Special handling for preferences to cast into boolean if the field type is checkbox
1177
+ if ( 'preferences' == $key && 'checkbox' == $form->form_fields[ $index ]['type'] ) {
1178
+ $wpform_content = wpforms()->form->get( $form->object_id )->post_content;
1179
+ $wpform_content = json_decode( $wpform_content, true );
1180
+ $choices = $this->array_get( $wpform_content, substr( $array_key, 0, - 2 ) . '.choices' );
1181
+
1182
+ $index = null;
1183
+ // Check preference field is entered
1184
+ if ( ! empty( $data[ $key ][ $map_key ] ) ) {
1185
+ // Reset the array keys
1186
+ foreach ( array_values($choices) as $i => $choice ) {
1187
+ // Priority to check the choice value
1188
+ if ( $data[ $key ][ $map_key ] == $choice['value'] ) {
1189
+ $index = intval( $i );
1190
+ break;
1191
+ }
1192
+
1193
+ // Then check the choice label [WPForms the label and value are always the same]
1194
+ if ( $data[ $key ][ $map_key ] == $choice['label'] ) {
1195
+ $index = intval( $i );
1196
+ }
1197
+ }
1198
+ }
1199
+
1200
+ // If index isset and map to first choice then it's true exactly like the Frontend Cons behavior
1201
+ $data[ $key ][ $map_key ] = ($index === 0) ? true : false;
1202
+ }
1203
  }
1204
 
1205
  return $data;
includes/settings.php CHANGED
@@ -1628,10 +1628,14 @@ class iubenda_Settings {
1628
  }
1629
 
1630
  // echo '<pre>'; print_r( $_POST ); echo '</pre>'; exit;
1631
-
 
 
 
 
1632
  // bail if empty fields
1633
- if ( empty( $subject ) || empty( $preferences ) ) {
1634
- $this->add_notice( 'iub_form_fields_missing', __( 'Form saving failed. Please fill the Subject and Preferences fields.', 'iubenda' ), 'error' );
1635
  return;
1636
  }
1637
 
@@ -1820,4 +1824,17 @@ class iubenda_Settings {
1820
  return array_map( 'esc_attr', $array );
1821
  }
1822
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1823
  }
1628
  }
1629
 
1630
  // echo '<pre>'; print_r( $_POST ); echo '</pre>'; exit;
1631
+ $filtered_subjects = array_filter($subject, array(
1632
+ $this,
1633
+ 'is_not_empty'
1634
+ ));
1635
+
1636
  // bail if empty fields
1637
+ if ( ! count( $filtered_subjects ) ) {
1638
+ $this->add_notice( 'iub_form_fields_missing', __( 'Form saving failed. Please fill the Subject fields.', 'iubenda' ), 'error' );
1639
  return;
1640
  }
1641
 
1824
  return array_map( 'esc_attr', $array );
1825
  }
1826
 
1827
+ /**
1828
+ * Check the value is not empty and check it contains any value even 0
1829
+ *
1830
+ * @param $value
1831
+ * @return bool
1832
+ */
1833
+ private function is_not_empty($value) {
1834
+ if(is_null($value) || '' === $value){
1835
+ return false;
1836
+ }
1837
+
1838
+ return true;
1839
+ }
1840
  }
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.5.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.5.3
36
  */
37
  class iubenda {
38
 
@@ -62,7 +62,7 @@ class iubenda {
62
  )
63
  );
64
  public $base_url;
65
- public $version = '2.5.3';
66
  public $activation = array(
67
  'update_version' => 0,
68
  'update_notice' => true,
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.5.4
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.5.4
36
  */
37
  class iubenda {
38
 
62
  )
63
  );
64
  public $base_url;
65
+ public $version = '2.5.4';
66
  public $activation = array(
67
  'update_version' => 0,
68
  'update_notice' => true,
languages/iubenda-cookie-law-solution-it_IT.po CHANGED
@@ -751,7 +751,7 @@ msgid "No forms or form changes detected."
751
  msgstr "Nessun form o modifica rilevati."
752
 
753
  #: includes/settings.php:1623
754
- msgid "Form saving failed. Please fill the Subject and Preferences fields."
755
  msgstr "Salvataggio del form fallito. Compila i campi Utente e Preferenze."
756
 
757
  #: includes/settings.php:1647
751
  msgstr "Nessun form o modifica rilevati."
752
 
753
  #: includes/settings.php:1623
754
+ msgid "Form saving failed. Please fill the Subject fields."
755
  msgstr "Salvataggio del form fallito. Compila i campi Utente e Preferenze."
756
 
757
  #: includes/settings.php:1647
languages/iubenda-cookie-law-solution.pot CHANGED
@@ -619,7 +619,7 @@ msgid "No forms or form changes detected."
619
  msgstr ""
620
 
621
  #: includes/settings.php:1623
622
- msgid "Form saving failed. Please fill the Subject and Preferences fields."
623
  msgstr ""
624
 
625
  #: includes/settings.php:1647
619
  msgstr ""
620
 
621
  #: includes/settings.php:1623
622
+ msgid "Form saving failed. Please fill the Subject fields."
623
  msgstr ""
624
 
625
  #: includes/settings.php:1647
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.7.2
8
- Stable tag: 2.5.3
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
11
 
@@ -80,7 +80,7 @@ Maintaining valid records of consent is a vital part of privacy compliance in ge
80
  **Key features:**
81
 
82
  * The plugin detects and identifies all supported forms that are embedded in the website
83
- * It’s auto-compatible with and allows super easy mapping of Contact Form 7, WP Forms, WordPress comment and WooCommerce checkout forms
84
  * It allows manual integration with any type of web-form
85
  * For each consent, track the form/wording the user was prompted with
86
  * Flexibly upload any form of proof of consent or legal notice, including a PDF if consent was collected offline
@@ -150,6 +150,13 @@ We will be very happy to receive feedback here: [Uservoice forum](https://suppor
150
 
151
  == Changelog ==
152
 
 
 
 
 
 
 
 
153
  = 2.5.3 =
154
  * Fix sub sub domain of generated AMP file.
155
  * Add settings anchor in plugin page
@@ -522,6 +529,9 @@ We will be very happy to receive feedback here: [Uservoice forum](https://suppor
522
 
523
  == Upgrade Notice ==
524
 
525
- = 2.5.3 =
526
- * Fix sub sub domain of generated AMP file.
527
- * Add settings anchor in plugin page
 
 
 
5
  Requires at least: 4.0
6
  Requires PHP: 5.2.4
7
  Tested up to: 5.7.2
8
+ Stable tag: 2.5.4
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
11
 
80
  **Key features:**
81
 
82
  * The plugin detects and identifies all supported forms that are embedded in the website
83
+ * It’s auto-compatible with and allows super easy mapping of Contact Form 7, WP Forms, WordPress comment, Mailchimp for WordPress, Germanized for WooCommerce and WooCommerce checkout forms
84
  * It allows manual integration with any type of web-form
85
  * For each consent, track the form/wording the user was prompted with
86
  * Flexibly upload any form of proof of consent or legal notice, including a PDF if consent was collected offline
150
 
151
  == Changelog ==
152
 
153
+ = 2.5.4 =
154
+ * Cast preferences field into boolean in WPForms.
155
+ * Fix preference field not saved in CF7.
156
+ * Integrate with Germanized for WooCommerce in ConS.
157
+ * Allow only the mapped forms in ConS.
158
+ * Allow mapping the ConS forms without specifying the preferences field.
159
+
160
  = 2.5.3 =
161
  * Fix sub sub domain of generated AMP file.
162
  * Add settings anchor in plugin page
529
 
530
  == Upgrade Notice ==
531
 
532
+ = 2.5.4 =
533
+ * Cast preferences field into boolean in WPForms.
534
+ * Fix preference field not saved in CF7.
535
+ * Integrate with Germanized for WooCommerce in ConS.
536
+ * Allow only the mapped forms in ConS.
537
+ * Allow mapping the ConS forms without specifying the preferences field.