Everest Forms – Easy Contact Form and Form Builder - Version 1.1.9

Version Description

  • 26-06-2018 =
  • Fix - Validation and sanitization for form fields.
  • Fix - Only five forms are listed in entries selection.
  • Tweak - Entries number alignment is changed to center.
  • Tweak - Entry save related data can be override via filter.
Download this release

Release Info

Developer wpeverest
Plugin Icon 128x128 Everest Forms – Easy Contact Form and Form Builder
Version 1.1.9
Comparing to
See all releases

Code changes from version 1.1.8 to 1.1.9

assets/css/admin-entries-rtl.css CHANGED
@@ -1 +1 @@
1
- .wp-list-table.forms .column-entries{width:75px}.wp-list-table.entries .column-actions{width:175px}.wp-list-table.entries .submitdelete:hover{color:#a00}#everest-forms-entry-fields table{border:none}#everest-forms-entry-fields span.list{display:block}#everest-forms-entry-fields .everest-forms-empty-field-toggle{float:left;padding:3px 0 0;text-decoration:none}#everest-forms-entry-details .submitdelete{color:#a00;padding:1px 2px;text-decoration:none}#everest-forms-entry-details .everest-forms-entry-details-meta{padding:6px 0 0}#everest-forms-entry-details .everest-forms-entry-details-meta p{margin:0;padding:6px 10px 8px}.everest-forms-entry #poststuff .hndle{cursor:inherit}.everest-forms-entry #poststuff .inside{margin:0;padding:0}.everest-forms-BlankState{text-align:center;padding:5em 0 0}.everest-forms-BlankState .everest-forms-BlankState-icon{fill:#ddd;width:128px;height:128px;margin:0 0 .875em}.everest-forms-BlankState .everest-forms-BlankState-message{color:#aaa;margin:0 auto 1.5em;line-height:1.5em;font-size:1.2em;max-width:500px}.everest-forms-BlankState .everest-forms-BlankState-cta{font-size:1.2em;padding:.75em 1.5em;height:auto;display:inline-block!important}
1
+ .wp-list-table.forms .column-entries{width:74px;text-align:center}.wp-list-table.entries .column-actions{width:175px}.wp-list-table.entries .submitdelete:hover{color:#a00}#everest-forms-entry-fields table{border:none}#everest-forms-entry-fields span.list{display:block}#everest-forms-entry-fields .everest-forms-empty-field-toggle{float:left;padding:3px 0 0;text-decoration:none}#everest-forms-entry-details .submitdelete{color:#a00;padding:1px 2px;text-decoration:none}#everest-forms-entry-details .everest-forms-entry-details-meta{padding:6px 0 0}#everest-forms-entry-details .everest-forms-entry-details-meta p{margin:0;padding:6px 10px 8px}.everest-forms-entry #poststuff .hndle{cursor:inherit}.everest-forms-entry #poststuff .inside{margin:0;padding:0}.everest-forms-BlankState{text-align:center;padding:5em 0 0}.everest-forms-BlankState .everest-forms-BlankState-icon{fill:#ddd;width:128px;height:128px;margin:0 0 .875em}.everest-forms-BlankState .everest-forms-BlankState-message{color:#aaa;margin:0 auto 1.5em;line-height:1.5em;font-size:1.2em;max-width:500px}.everest-forms-BlankState .everest-forms-BlankState-cta{font-size:1.2em;padding:.75em 1.5em;height:auto;display:inline-block!important}
assets/css/admin-entries.css CHANGED
@@ -1 +1 @@
1
- .wp-list-table.forms .column-entries{width:75px}.wp-list-table.entries .column-actions{width:175px}.wp-list-table.entries .submitdelete:hover{color:#a00}#everest-forms-entry-fields table{border:none}#everest-forms-entry-fields span.list{display:block}#everest-forms-entry-fields .everest-forms-empty-field-toggle{float:right;padding:3px 0 0;text-decoration:none}#everest-forms-entry-details .submitdelete{color:#a00;padding:1px 2px;text-decoration:none}#everest-forms-entry-details .everest-forms-entry-details-meta{padding:6px 0 0}#everest-forms-entry-details .everest-forms-entry-details-meta p{margin:0;padding:6px 10px 8px}.everest-forms-entry #poststuff .hndle{cursor:inherit}.everest-forms-entry #poststuff .inside{margin:0;padding:0}.everest-forms-BlankState{text-align:center;padding:5em 0 0}.everest-forms-BlankState .everest-forms-BlankState-icon{fill:#ddd;width:128px;height:128px;margin:0 0 .875em}.everest-forms-BlankState .everest-forms-BlankState-message{color:#aaa;margin:0 auto 1.5em;line-height:1.5em;font-size:1.2em;max-width:500px}.everest-forms-BlankState .everest-forms-BlankState-cta{font-size:1.2em;padding:.75em 1.5em;height:auto;display:inline-block!important}
1
+ .wp-list-table.forms .column-entries{width:74px;text-align:center}.wp-list-table.entries .column-actions{width:175px}.wp-list-table.entries .submitdelete:hover{color:#a00}#everest-forms-entry-fields table{border:none}#everest-forms-entry-fields span.list{display:block}#everest-forms-entry-fields .everest-forms-empty-field-toggle{float:right;padding:3px 0 0;text-decoration:none}#everest-forms-entry-details .submitdelete{color:#a00;padding:1px 2px;text-decoration:none}#everest-forms-entry-details .everest-forms-entry-details-meta{padding:6px 0 0}#everest-forms-entry-details .everest-forms-entry-details-meta p{margin:0;padding:6px 10px 8px}.everest-forms-entry #poststuff .hndle{cursor:inherit}.everest-forms-entry #poststuff .inside{margin:0;padding:0}.everest-forms-BlankState{text-align:center;padding:5em 0 0}.everest-forms-BlankState .everest-forms-BlankState-icon{fill:#ddd;width:128px;height:128px;margin:0 0 .875em}.everest-forms-BlankState .everest-forms-BlankState-message{color:#aaa;margin:0 auto 1.5em;line-height:1.5em;font-size:1.2em;max-width:500px}.everest-forms-BlankState .everest-forms-BlankState-cta{font-size:1.2em;padding:.75em 1.5em;height:auto;display:inline-block!important}
assets/css/admin-entries.scss CHANGED
@@ -3,7 +3,8 @@
3
  */
4
  .wp-list-table.forms {
5
  .column-entries {
6
- width: 75px;
 
7
  }
8
  }
9
 
3
  */
4
  .wp-list-table.forms {
5
  .column-entries {
6
+ width: 74px;
7
+ text-align: center;
8
  }
9
  }
10
 
everest-forms.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Everest Forms
4
  * Plugin URI: https://wpeverest.com/wordpress-plugins/everest-forms/
5
  * Description: Drag and Drop form builder to easily create contact forms and more.
6
- * Version: 1.1.8
7
  * Author: WPEverest
8
  * Author URI: https://wpeverest.com
9
  * Text Domain: everest-forms
3
  * Plugin Name: Everest Forms
4
  * Plugin URI: https://wpeverest.com/wordpress-plugins/everest-forms/
5
  * Description: Drag and Drop form builder to easily create contact forms and more.
6
+ * Version: 1.1.9
7
  * Author: WPEverest
8
  * Author URI: https://wpeverest.com
9
  * Text Domain: everest-forms
includes/abstracts/abstract-evf-form-fields.php CHANGED
@@ -113,7 +113,7 @@ abstract class EVF_Form_Fields {
113
  add_action( "everest_forms_process_validate_{$this->type}", array( $this, 'validate' ), 10, 4 );
114
 
115
  // Format.
116
- add_action( "everest_forms_process_format_{$this->type}", array( $this, 'format' ), 10, 3 );
117
  }
118
 
119
  /**
@@ -805,14 +805,12 @@ abstract class EVF_Form_Fields {
805
  /**
806
  * Formats and sanitizes field.
807
  *
808
- * $since 1.0.0
809
- *
810
- * @param int $field_id
811
- * @param array $field_submit
812
- * @param array $form_data
813
  */
814
- public function format( $field_id, $field_submit, $form_data ) {
815
-
816
  if ( is_array( $field_submit ) ) {
817
  $field_submit = array_filter( $field_submit );
818
  $field_submit = implode( "\r\n", $field_submit );
@@ -823,11 +821,12 @@ abstract class EVF_Form_Fields {
823
  // Sanitize but keep line breaks.
824
  $value = everest_forms_sanitize_textarea_field( $field_submit );
825
 
826
- EVF()->process->fields[ $field_id ] = array(
827
- 'name' => $name,
828
- 'value' => $value,
829
- 'id' => absint( $field_id ),
830
- 'type' => $this->type,
 
831
  );
832
  }
833
  }
113
  add_action( "everest_forms_process_validate_{$this->type}", array( $this, 'validate' ), 10, 4 );
114
 
115
  // Format.
116
+ add_action( "everest_forms_process_format_{$this->type}", array( $this, 'format' ), 10, 4 );
117
  }
118
 
119
  /**
805
  /**
806
  * Formats and sanitizes field.
807
  *
808
+ * @param int $field_id
809
+ * @param array $field_submit
810
+ * @param array $form_data
811
+ * @param string $meta_key
 
812
  */
813
+ public function format( $field_id, $field_submit, $form_data, $meta_key ) {
 
814
  if ( is_array( $field_submit ) ) {
815
  $field_submit = array_filter( $field_submit );
816
  $field_submit = implode( "\r\n", $field_submit );
821
  // Sanitize but keep line breaks.
822
  $value = everest_forms_sanitize_textarea_field( $field_submit );
823
 
824
+ EVF()->task->form_fields[ $field_id ] = array(
825
+ 'name' => $name,
826
+ 'value' => $value,
827
+ 'id' => $field_id,
828
+ 'type' => $this->type,
829
+ 'meta_key' => $meta_key,
830
  );
831
  }
832
  }
includes/class-everest-forms.php CHANGED
@@ -21,7 +21,7 @@ final class EverestForms {
21
  *
22
  * @var string
23
  */
24
- public $version = '1.1.8';
25
 
26
  /**
27
  * The form data handler instance.
21
  *
22
  * @var string
23
  */
24
+ public $version = '1.1.9';
25
 
26
  /**
27
  * The form data handler instance.
includes/class-evf-form-task.php CHANGED
@@ -397,27 +397,32 @@ class EVF_Form_Task {
397
  /**
398
  * Saves entry to database.
399
  *
400
- * @since 1.0.0
401
- *
402
- * @param array $fields
403
- * @param array $entry
404
- * @param int $form_id
405
- * @param array|string $form_data
406
- *
407
  * @return int
408
  */
409
- public function entry_save( $fields, $entry, $form_id, $form_data = '' ) {
410
  global $wpdb;
411
 
 
412
  if ( isset( $form_data['settings']['disabled_entries'] ) && '1' === $form_data['settings']['disabled_entries'] ) {
413
  return;
414
  }
415
 
 
 
 
 
 
416
  do_action( 'everest_forms_process_entry_save', $fields, $entry, $form_id, $form_data );
417
 
 
418
  $browser = evf_get_browser();
419
  $user_ip = evf_get_ip_address();
420
  $user_agent = $browser['name'] . '/' . $browser['platform'];
 
421
 
422
  // GDPR enhancements - If user details are disabled globally discard the IP and UA.
423
  if ( 'yes' === get_option( 'everest_forms_disable_user_details' ) ) {
@@ -439,6 +444,7 @@ class EVF_Form_Task {
439
  return new WP_Error( 'no-form-id', __( 'No form ID was found.', 'everest-forms' ) );
440
  }
441
 
 
442
  $success = $wpdb->insert( $wpdb->prefix . 'evf_entries', $entry_data );
443
 
444
  if ( is_wp_error( $success ) || ! $success ) {
@@ -447,26 +453,27 @@ class EVF_Form_Task {
447
 
448
  $entry_id = $wpdb->insert_id;
449
 
450
- $form_fields = isset( $form_data['form_fields'] ) ? $form_data['form_fields'] : array();
451
-
452
- foreach ( $form_fields as $field_key => $field ) {
453
-
454
- $meta_key = isset( $field['meta-key'] ) ? $field['meta-key'] : '';
455
-
456
- $field_value = isset( $entry['form_fields'][ $field_key ] ) ? $entry['form_fields'][ $field_key ] : '';
457
-
458
- if ( is_array( $field_value ) ) {
459
- $field_value = serialize( $field_value );
 
 
 
 
 
 
460
  }
461
-
462
- $entry_metadata = array(
463
- 'entry_id' => $entry_id,
464
- 'meta_key' => $meta_key,
465
- 'meta_value' => $field_value,
466
- );
467
- $wpdb->insert( $wpdb->prefix . 'evf_entrymeta', $entry_metadata );
468
  }
469
 
470
  do_action( 'everest_forms_complete_entry_save', $entry_id, $fields, $entry, $form_id, $form_data );
 
 
471
  }
472
  }
397
  /**
398
  * Saves entry to database.
399
  *
400
+ * @param array $fields
401
+ * @param array $entry
402
+ * @param int $form_id
403
+ * @param array $form_data
 
 
 
404
  * @return int
405
  */
406
+ public function entry_save( $fields, $entry, $form_id, $form_data = array() ) {
407
  global $wpdb;
408
 
409
+ // Check if form has entries disabled.
410
  if ( isset( $form_data['settings']['disabled_entries'] ) && '1' === $form_data['settings']['disabled_entries'] ) {
411
  return;
412
  }
413
 
414
+ // Provide the opportunity to override via a filter.
415
+ if ( ! apply_filters( 'everest_forms_entry_save', true, $fields, $entry, $form_data ) ) {
416
+ return;
417
+ }
418
+
419
  do_action( 'everest_forms_process_entry_save', $fields, $entry, $form_id, $form_data );
420
 
421
+ $fields = apply_filters( 'everest_forms_entry_save_data', $fields, $entry, $form_data );
422
  $browser = evf_get_browser();
423
  $user_ip = evf_get_ip_address();
424
  $user_agent = $browser['name'] . '/' . $browser['platform'];
425
+ $entry_id = false;
426
 
427
  // GDPR enhancements - If user details are disabled globally discard the IP and UA.
428
  if ( 'yes' === get_option( 'everest_forms_disable_user_details' ) ) {
444
  return new WP_Error( 'no-form-id', __( 'No form ID was found.', 'everest-forms' ) );
445
  }
446
 
447
+ // Create entry.
448
  $success = $wpdb->insert( $wpdb->prefix . 'evf_entries', $entry_data );
449
 
450
  if ( is_wp_error( $success ) || ! $success ) {
453
 
454
  $entry_id = $wpdb->insert_id;
455
 
456
+ // Create meta data.
457
+ if ( $entry_id ) {
458
+ foreach ( $fields as $field ) {
459
+ $field = apply_filters( 'everest_forms_entry_save_fields', $field, $form_data, $entry_id );
460
+
461
+ if ( isset( $field['value'], $field['meta_key'] ) && '' !== $field['value'] ) {
462
+ $field_value = is_array( $field['value'] ) ? serialize( $field['value'] ) : $field['value'];
463
+ $entry_metadata = array(
464
+ 'entry_id' => $entry_id,
465
+ 'meta_key' => $field['meta_key'],
466
+ 'meta_value' => $field_value,
467
+ );
468
+
469
+ // Insert entry meta.
470
+ $wpdb->insert( $wpdb->prefix . 'evf_entrymeta', $entry_metadata );
471
+ }
472
  }
 
 
 
 
 
 
 
473
  }
474
 
475
  do_action( 'everest_forms_complete_entry_save', $entry_id, $fields, $entry, $form_id, $form_data );
476
+
477
+ return $entry_id;
478
  }
479
  }
includes/evf-core-functions.php CHANGED
@@ -1021,25 +1021,39 @@ function evf_get_random_string( $length = 10 ) {
1021
  return $string;
1022
  }
1023
 
 
 
 
 
 
 
1024
  function evf_get_all_forms( $skip_disabled_entries = false ) {
1025
- $all_forms = array();
1026
- $posts_array = get_posts( array(
1027
- 'post_type' => 'everest_form',
1028
- 'status' => 'publish',
1029
- ) );
 
 
 
 
 
 
1030
 
1031
- foreach ( $posts_array as $post ) {
1032
- $form_obj = EVF()->form->get( $post->ID );
1033
- $form_data = ! empty( $form_obj->post_content ) ? evf_decode( $form_obj->post_content ) : '';
 
1034
 
1035
- if ( $skip_disabled_entries && ( isset( $form_data['settings']['disabled_entries'] ) && '1' === $form_data['settings']['disabled_entries'] ) ) {
1036
- continue;
1037
- }
1038
 
1039
- $all_forms[ $post->ID ] = $post->post_title;
 
1040
  }
1041
 
1042
- return $all_forms;
1043
  }
1044
 
1045
  function evf_get_meta_key_field_option( $field ) {
1021
  return $string;
1022
  }
1023
 
1024
+ /**
1025
+ * Get all forms.
1026
+ *
1027
+ * @param bool $skip_disabled_entries True to skip disabled entries.
1028
+ * @return array of form data.
1029
+ */
1030
  function evf_get_all_forms( $skip_disabled_entries = false ) {
1031
+ $forms = array();
1032
+ $form_ids = wp_parse_id_list(
1033
+ get_posts(
1034
+ array(
1035
+ 'post_type' => 'everest_form',
1036
+ 'numberposts' => -1, // @codingStandardsIgnoreLine
1037
+ 'status' => 'publish',
1038
+ 'fields' => 'ids',
1039
+ )
1040
+ )
1041
+ );
1042
 
1043
+ if ( ! empty( $form_ids ) ) {
1044
+ foreach ( $form_ids as $form_id ) {
1045
+ $form = EVF()->form->get( $form_id );
1046
+ $form_data = ! empty( $form->post_content ) ? evf_decode( $form->post_content ) : '';
1047
 
1048
+ if ( $skip_disabled_entries && ( isset( $form_data['settings']['disabled_entries'] ) && '1' === $form_data['settings']['disabled_entries'] ) ) {
1049
+ continue;
1050
+ }
1051
 
1052
+ $forms[ $form_id ] = $form->post_title;
1053
+ }
1054
  }
1055
 
1056
+ return $forms;
1057
  }
1058
 
1059
  function evf_get_meta_key_field_option( $field ) {
includes/form-fields/class-evf-field-checkbox.php CHANGED
@@ -68,7 +68,7 @@ class EVF_Field_Checkbox extends EVF_Form_Fields {
68
 
69
  // Meta.
70
  $this->field_option( 'meta', $field );
71
-
72
  // Choices
73
  $this->field_option( 'choices', $field );
74
 
@@ -231,13 +231,12 @@ class EVF_Field_Checkbox extends EVF_Form_Fields {
231
  /**
232
  * Formats and sanitizes field.
233
  *
234
- * @since 1.0.0
235
- *
236
- * @param int $field_id
237
- * @param array $field_submit
238
- * @param array $form_data
239
  */
240
- public function format( $field_id, $field_submit, $form_data ) {
241
 
242
  $field_submit = (array) $field_submit;
243
  $field = $form_data['form_fields'][ $field_id ];
@@ -249,8 +248,9 @@ class EVF_Field_Checkbox extends EVF_Form_Fields {
249
  'name' => $name,
250
  'value' => '',
251
  'value_raw' => $value_raw,
252
- 'id' => absint( $field_id ),
253
  'type' => $this->type,
 
254
  );
255
 
256
  if ( 'post_type' === $dynamic && ! empty( $field['dynamic_post_type'] ) ) {
@@ -318,6 +318,9 @@ class EVF_Field_Checkbox extends EVF_Form_Fields {
318
  $data['value'] = $value_raw;
319
  }
320
  }
 
 
 
321
  }
322
  }
323
 
68
 
69
  // Meta.
70
  $this->field_option( 'meta', $field );
71
+
72
  // Choices
73
  $this->field_option( 'choices', $field );
74
 
231
  /**
232
  * Formats and sanitizes field.
233
  *
234
+ * @param int $field_id
235
+ * @param array $field_submit
236
+ * @param array $form_data
237
+ * @param string $meta_key
 
238
  */
239
+ public function format( $field_id, $field_submit, $form_data, $meta_key ) {
240
 
241
  $field_submit = (array) $field_submit;
242
  $field = $form_data['form_fields'][ $field_id ];
248
  'name' => $name,
249
  'value' => '',
250
  'value_raw' => $value_raw,
251
+ 'id' => $field_id,
252
  'type' => $this->type,
253
+ 'meta_key' => $meta_key,
254
  );
255
 
256
  if ( 'post_type' === $dynamic && ! empty( $field['dynamic_post_type'] ) ) {
318
  $data['value'] = $value_raw;
319
  }
320
  }
321
+
322
+ // Push field details to be saved.
323
+ EVF()->task->form_fields[ $field_id ] = $data;
324
  }
325
  }
326
 
includes/form-fields/class-evf-field-email.php CHANGED
@@ -183,13 +183,12 @@ class EVF_Field_Email extends EVF_Form_Fields {
183
  /**
184
  * Formats and sanitizes field.
185
  *
186
- * @since 1.0.0
187
- *
188
- * @param int $field_id
189
- * @param array $field_submit
190
- * @param array $form_data
191
  */
192
- public function format( $field_id, $field_submit, $form_data ) {
193
 
194
  // Define data.
195
  if ( is_array( $field_submit ) ) {
@@ -198,11 +197,17 @@ class EVF_Field_Email extends EVF_Form_Fields {
198
  $value = ! empty( $field_submit ) ? $field_submit : '';
199
  }
200
 
201
- $name = ! empty( $form_data['fields'][ $field_id ] ['label'] ) ? $form_data['fields'][ $field_id ]['label'] : '';
202
 
 
 
 
 
 
 
 
 
203
  }
204
-
205
-
206
  }
207
 
208
  new EVF_Field_Email;
183
  /**
184
  * Formats and sanitizes field.
185
  *
186
+ * @param int $field_id
187
+ * @param array $field_submit
188
+ * @param array $form_data
189
+ * @param string $meta_key
 
190
  */
191
+ public function format( $field_id, $field_submit, $form_data, $meta_key ) {
192
 
193
  // Define data.
194
  if ( is_array( $field_submit ) ) {
197
  $value = ! empty( $field_submit ) ? $field_submit : '';
198
  }
199
 
200
+ $name = ! empty( $form_data['form_fields'][ $field_id ] ['label'] ) ? $form_data['form_fields'][ $field_id ]['label'] : '';
201
 
202
+ // Set final field details.
203
+ EVF()->task->form_fields[ $field_id ] = array(
204
+ 'name' => sanitize_text_field( $name ),
205
+ 'value' => sanitize_text_field( $value ),
206
+ 'id' => $field_id,
207
+ 'type' => $this->type,
208
+ 'meta_key' => $meta_key,
209
+ );
210
  }
 
 
211
  }
212
 
213
  new EVF_Field_Email;
includes/form-fields/class-evf-field-number.php CHANGED
@@ -133,6 +133,30 @@ class EVF_Field_Number extends EVF_Form_Fields {
133
  $primary['required']
134
  );
135
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  }
137
 
138
  new EVF_Field_Number;
133
  $primary['required']
134
  );
135
  }
136
+
137
+ /**
138
+ * Formats and sanitizes field.
139
+ *
140
+ * @param int $field_id
141
+ * @param array $field_submit
142
+ * @param array $form_data
143
+ * @param string $meta_key
144
+ */
145
+ public function format( $field_id, $field_submit, $form_data, $meta_key ) {
146
+
147
+ // Define data.
148
+ $name = ! empty( $form_data['form_fields'][ $field_id ]['label'] ) ? $form_data['form_fields'][ $field_id ]['label'] : '';
149
+ $value = preg_replace( '/[^0-9.]/', '', $field_submit );
150
+
151
+ // Set final field details.
152
+ EVF()->task->form_fields[ $field_id ] = array(
153
+ 'name' => sanitize_text_field( $name ),
154
+ 'value' => sanitize_text_field( $value ),
155
+ 'id' => $field_id,
156
+ 'type' => $this->type,
157
+ 'meta_key' => $meta_key,
158
+ );
159
+ }
160
  }
161
 
162
  new EVF_Field_Number;
includes/form-fields/class-evf-field-radio.php CHANGED
@@ -68,7 +68,7 @@ class EVF_Field_Radio extends EVF_Form_Fields {
68
 
69
  // Meta.
70
  $this->field_option( 'meta', $field );
71
-
72
  // Choices
73
  $this->field_option( 'choices', $field );
74
 
@@ -231,13 +231,12 @@ class EVF_Field_Radio extends EVF_Form_Fields {
231
  /**
232
  * Formats and sanitizes field.
233
  *
234
- * @since 1.0.0
235
- *
236
- * @param int $field_id
237
- * @param array $field_submit
238
- * @param array $form_data
239
  */
240
- public function format( $field_id, $field_submit, $form_data ) {
241
 
242
  $field_submit = (array) $field_submit;
243
  $field = $form_data['form_fields'][ $field_id ];
@@ -249,8 +248,9 @@ class EVF_Field_Radio extends EVF_Form_Fields {
249
  'name' => $name,
250
  'value' => '',
251
  'value_raw' => $value_raw,
252
- 'id' => absint( $field_id ),
253
  'type' => $this->type,
 
254
  );
255
 
256
  if ( 'post_type' === $dynamic && ! empty( $field['dynamic_post_type'] ) ) {
@@ -318,6 +318,9 @@ class EVF_Field_Radio extends EVF_Form_Fields {
318
  $data['value'] = $value_raw;
319
  }
320
  }
 
 
 
321
  }
322
  }
323
 
68
 
69
  // Meta.
70
  $this->field_option( 'meta', $field );
71
+
72
  // Choices
73
  $this->field_option( 'choices', $field );
74
 
231
  /**
232
  * Formats and sanitizes field.
233
  *
234
+ * @param int $field_id
235
+ * @param array $field_submit
236
+ * @param array $form_data
237
+ * @param string $meta_key
 
238
  */
239
+ public function format( $field_id, $field_submit, $form_data, $meta_key ) {
240
 
241
  $field_submit = (array) $field_submit;
242
  $field = $form_data['form_fields'][ $field_id ];
248
  'name' => $name,
249
  'value' => '',
250
  'value_raw' => $value_raw,
251
+ 'id' => $field_id,
252
  'type' => $this->type,
253
+ 'meta_key' => $meta_key,
254
  );
255
 
256
  if ( 'post_type' === $dynamic && ! empty( $field['dynamic_post_type'] ) ) {
318
  $data['value'] = $value_raw;
319
  }
320
  }
321
+
322
+ // Push field details to be saved.
323
+ EVF()->task->form_fields[ $field_id ] = $data;
324
  }
325
  }
326
 
includes/form-fields/class-evf-field-select.php CHANGED
@@ -59,10 +59,10 @@ class EVF_Field_Select extends EVF_Form_Fields {
59
 
60
  // Label.
61
  $this->field_option( 'label', $field );
62
-
63
  // Meta.
64
  $this->field_option( 'meta', $field );
65
-
66
  // Choices.
67
  $this->field_option( 'choices', $field );
68
 
@@ -212,13 +212,12 @@ class EVF_Field_Select extends EVF_Form_Fields {
212
  /**
213
  * Formats and sanitizes field.
214
  *
215
- * @since 1.0.0
216
- *
217
  * @param int $field_id
218
- * @param string $field_submit
219
  * @param array $form_data
 
220
  */
221
- public function format( $field_id, $field_submit, $form_data ) {
222
 
223
  $field = $form_data['form_fields'][ $field_id ];
224
  $name = sanitize_text_field( $field['label'] );
@@ -229,8 +228,9 @@ class EVF_Field_Select extends EVF_Form_Fields {
229
  'name' => $name,
230
  'value' => '',
231
  'value_raw' => $value_raw,
232
- 'id' => absint( $field_id ),
233
  'type' => $this->type,
 
234
  );
235
 
236
 
@@ -252,6 +252,9 @@ class EVF_Field_Select extends EVF_Form_Fields {
252
  } else {
253
  $data['value'] = $value_raw;
254
  }
 
 
 
255
  }
256
  }
257
 
59
 
60
  // Label.
61
  $this->field_option( 'label', $field );
62
+
63
  // Meta.
64
  $this->field_option( 'meta', $field );
65
+
66
  // Choices.
67
  $this->field_option( 'choices', $field );
68
 
212
  /**
213
  * Formats and sanitizes field.
214
  *
 
 
215
  * @param int $field_id
216
+ * @param array $field_submit
217
  * @param array $form_data
218
+ * @param string $meta_key
219
  */
220
+ public function format( $field_id, $field_submit, $form_data, $meta_key ) {
221
 
222
  $field = $form_data['form_fields'][ $field_id ];
223
  $name = sanitize_text_field( $field['label'] );
228
  'name' => $name,
229
  'value' => '',
230
  'value_raw' => $value_raw,
231
+ 'id' => $field_id,
232
  'type' => $this->type,
233
+ 'meta_key' => $meta_key,
234
  );
235
 
236
 
252
  } else {
253
  $data['value'] = $value_raw;
254
  }
255
+
256
+ // Push field details to be saved.
257
+ EVF()->task->form_fields[ $field_id ] = $data;
258
  }
259
  }
260
 
languages/everest-forms.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Everest Forms package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Everest Forms 1.1.8\n"
6
  "Report-Msgid-Bugs-To: https://github.com/wpeverest/everest-forms/issues\n"
7
- "POT-Creation-Date: 2018-06-07 09:44:49+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -986,11 +986,11 @@ msgstr ""
986
  msgid "Thanks for contacting us! We will be in touch with you shortly."
987
  msgstr ""
988
 
989
- #: includes/class-evf-form-task.php:439
990
  msgid "No form ID was found."
991
  msgstr ""
992
 
993
- #: includes/class-evf-form-task.php:445
994
  msgid "Could not create an entry"
995
  msgstr ""
996
 
2
  # This file is distributed under the same license as the Everest Forms package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Everest Forms 1.1.9\n"
6
  "Report-Msgid-Bugs-To: https://github.com/wpeverest/everest-forms/issues\n"
7
+ "POT-Creation-Date: 2018-06-26 05:42:18+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
986
  msgid "Thanks for contacting us! We will be in touch with you shortly."
987
  msgstr ""
988
 
989
+ #: includes/class-evf-form-task.php:444
990
  msgid "No form ID was found."
991
  msgstr ""
992
 
993
+ #: includes/class-evf-form-task.php:451
994
  msgid "Could not create an entry"
995
  msgstr ""
996
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: form, form builder, easy form, clean form, login form, contact, contact fo
4
  Requires at least: 4.0
5
  Tested up to: 4.9
6
  Requires PHP: 5.4
7
- Stable tag: 1.1.8
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -79,6 +79,12 @@ Yes, the plugin is designed to work with any themes that have been coded followi
79
 
80
  == Changelog ==
81
 
 
 
 
 
 
 
82
  = 1.1.8 - 07-06-2018 =
83
  * Fix - Similar meta key exists while duplicating the field.
84
  * Fix - Entry field value error due to html tags in serialized data.
4
  Requires at least: 4.0
5
  Tested up to: 4.9
6
  Requires PHP: 5.4
7
+ Stable tag: 1.1.9
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
79
 
80
  == Changelog ==
81
 
82
+ = 1.1.9 - 26-06-2018 =
83
+ * Fix - Validation and sanitization for form fields.
84
+ * Fix - Only five forms are listed in entries selection.
85
+ * Tweak - Entries number alignment is changed to center.
86
+ * Tweak - Entry save related data can be override via filter.
87
+
88
  = 1.1.8 - 07-06-2018 =
89
  * Fix - Similar meta key exists while duplicating the field.
90
  * Fix - Entry field value error due to html tags in serialized data.