Contact Form by WPForms – Drag & Drop Form Builder for WordPress - Version 1.3.5

Version Description

  • Fixed: Some browers allowing unexpected characters inside number input fields
  • Fixed: Issue with Dropdown field placeholder text
  • Fixed: Select few plugins loading conflicting scripts in form builder
Download this release

Release Info

Developer jaredatch
Plugin Icon 128x128 Contact Form by WPForms – Drag & Drop Form Builder for WordPress
Version 1.3.5
Comparing to
See all releases

Code changes from version 1.3.3 to 1.3.5

assets/js/admin-builder.js CHANGED
@@ -2090,7 +2090,7 @@
2090
  $dest = $(this).parent().parent().find('.key-destination');
2091
  name = $dest.data('name');
2092
  if (value) {
2093
- $dest.attr('name', name.replace('{source}', value.replace(/[^0-9a-z_-]/gi, '')));
2094
  }
2095
  })
2096
 
2090
  $dest = $(this).parent().parent().find('.key-destination');
2091
  name = $dest.data('name');
2092
  if (value) {
2093
+ $dest.attr('name', name.replace('{source}', value.replace(/[^0-9a-zA-Z_-]/gi, '')));
2094
  }
2095
  })
2096
 
assets/js/wpforms.js CHANGED
@@ -430,6 +430,19 @@
430
  // Other functions
431
  //--------------------------------------------------------------------//
432
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
  /**
434
  * Payments: Calculate total.
435
  *
430
  // Other functions
431
  //--------------------------------------------------------------------//
432
 
433
+ /**
434
+ * Google reCAPTCHA callback.
435
+ *
436
+ * @since 1.3.4
437
+ */
438
+ recaptchaCallback: function( el ) {
439
+
440
+ var $this = $(el),
441
+ $hidden = $this.parent().find('.wpforms-recaptcha-hidden');
442
+
443
+ $hidden.val('1').valid();
444
+ },
445
+
446
  /**
447
  * Payments: Calculate total.
448
  *
includes/admin/builder/class-builder.php CHANGED
@@ -147,6 +147,9 @@ class WPForms_Builder {
147
  */
148
  public function enqueues() {
149
 
 
 
 
150
  do_action( 'wpforms_builder_enqueues_before', $this->view );
151
 
152
  // CSS
147
  */
148
  public function enqueues() {
149
 
150
+ // Remove conflicting scripts
151
+ wp_deregister_script( 'serialize-object' );
152
+
153
  do_action( 'wpforms_builder_enqueues_before', $this->view );
154
 
155
  // CSS
includes/class-frontend.php CHANGED
@@ -554,7 +554,7 @@ class WPForms_Frontend {
554
 
555
  $pages = wpforms_has_pagebreak( $form_data );
556
  $d = '';
557
- $datas = apply_filters( 'wpforms_frontend_recaptcha', array( 'sitekey' => $site_key ), $form_data );
558
 
559
 
560
  if ( $pages ) {
@@ -569,6 +569,8 @@ class WPForms_Frontend {
569
 
570
  echo '<div class="g-recaptcha" ' . $d . '></div>';
571
 
 
 
572
  if ( !empty( wpforms()->process->errors[$form_data['id']]['recaptcha'] ) ) {
573
  echo '<label id="wpforms-field_recaptcah-error" class="wpforms-error">' . esc_html( wpforms()->process->errors[$form_data['id']]['recaptcha'] ) . '</label>';
574
  }
@@ -812,16 +814,17 @@ class WPForms_Frontend {
812
  $site_key = wpforms_setting( 'recaptcha-site-key' );
813
  $secret_key = wpforms_setting( 'recaptcha-secret-key' );
814
  if ( !empty( $site_key ) && !empty( $secret_key ) ) {
 
815
  wp_enqueue_script(
816
  'wpforms-recaptcha',
817
- 'https://www.google.com/recaptcha/api.js?onload=wpformsRecaptcha&render=explicit',
818
  array( 'jquery' ),
819
  '2.0.0',
820
  true
821
  );
822
  $reCAPTCHA_init = 'var wpformsRecaptcha = function(){
823
  jQuery(".g-recaptcha").each(function(index, el) {
824
- grecaptcha.render(el, {sitekey : \'' . $site_key . '\'});
825
  });
826
  };';
827
  wp_add_inline_script( 'wpforms-recaptcha', $reCAPTCHA_init );
554
 
555
  $pages = wpforms_has_pagebreak( $form_data );
556
  $d = '';
557
+ $datas = apply_filters( 'wpforms_frontend_recaptcha', array(), $form_data );
558
 
559
 
560
  if ( $pages ) {
569
 
570
  echo '<div class="g-recaptcha" ' . $d . '></div>';
571
 
572
+ echo '<input type="text" name="g-recaptcha-hidden" class="wpforms-recaptcha-hidden" style="position:absolute !important;clip:rect(0,0,0,0);height:1px;width:1px;border:0;overflow:hidden;padding:0;margin;" required>';
573
+
574
  if ( !empty( wpforms()->process->errors[$form_data['id']]['recaptcha'] ) ) {
575
  echo '<label id="wpforms-field_recaptcah-error" class="wpforms-error">' . esc_html( wpforms()->process->errors[$form_data['id']]['recaptcha'] ) . '</label>';
576
  }
814
  $site_key = wpforms_setting( 'recaptcha-site-key' );
815
  $secret_key = wpforms_setting( 'recaptcha-secret-key' );
816
  if ( !empty( $site_key ) && !empty( $secret_key ) ) {
817
+ $reCAPTCHA_api = apply_filters( 'wpforms_frontend_recaptcha_url', 'https://www.google.com/recaptcha/api.js?onload=wpformsRecaptcha&render=explicit' );
818
  wp_enqueue_script(
819
  'wpforms-recaptcha',
820
+ $reCAPTCHA_api,
821
  array( 'jquery' ),
822
  '2.0.0',
823
  true
824
  );
825
  $reCAPTCHA_init = 'var wpformsRecaptcha = function(){
826
  jQuery(".g-recaptcha").each(function(index, el) {
827
+ grecaptcha.render(el, {sitekey : \'' . $site_key . '\',callback:function(){wpforms.recaptchaCallback(el);}});
828
  });
829
  };';
830
  wp_add_inline_script( 'wpforms-recaptcha', $reCAPTCHA_init );
includes/class-preview.php CHANGED
@@ -258,7 +258,7 @@ class WPForms_Preview {
258
  // Customize the page content
259
  $title = sanitize_text_field( $form['settings']['form_title'] );
260
  $shortcode = '[wpforms id="' . absint( $form['id'] ) . '"]';
261
- $content = __( 'This is a preview of your form. This page not publically accessible.', 'wpforms' );
262
  if ( !empty( $_GET['new_window'] ) ) {
263
  $content .= ' <a href="javascript:window.close();">' . __( 'Close this window', 'wpforms' ) . '.</a>';
264
  }
258
  // Customize the page content
259
  $title = sanitize_text_field( $form['settings']['form_title'] );
260
  $shortcode = '[wpforms id="' . absint( $form['id'] ) . '"]';
261
+ $content = __( 'This is a preview of your form. This page is not publically accessible.', 'wpforms' );
262
  if ( !empty( $_GET['new_window'] ) ) {
263
  $content .= ' <a href="javascript:window.close();">' . __( 'Close this window', 'wpforms' ) . '.</a>';
264
  }
includes/class-smart-tags.php CHANGED
@@ -234,7 +234,8 @@ class WPForms_Smart_Tags {
234
 
235
  foreach( $dates[1] as $key => $date ) {
236
 
237
- $content = str_replace( $dates[0][$key], date("$date"), $content );
 
238
  }
239
  }
240
 
234
 
235
  foreach( $dates[1] as $key => $date ) {
236
 
237
+ $value = date( $date, time() + ( get_option( 'gmt_offset' ) * 3600 ) );
238
+ $content = str_replace( $dates[0][$key], $value, $content );
239
  }
240
  }
241
 
includes/fields/class-name.php CHANGED
@@ -38,7 +38,7 @@ class WPForms_Field_Name extends WPForms_Field {
38
  //--------------------------------------------------------------------//
39
  // Basic field options
40
  //--------------------------------------------------------------------//
41
-
42
  $this->field_option( 'basic-options', $field, array( 'markup' => 'open' ) );
43
  $this->field_option( 'label', $field );
44
 
@@ -57,14 +57,14 @@ class WPForms_Field_Name extends WPForms_Field {
57
  $this->field_option( 'description', $field );
58
  $this->field_option( 'required', $field );
59
  $this->field_option( 'basic-options', $field, array( 'markup' => 'close' ) );
60
-
61
  //--------------------------------------------------------------------//
62
  // Advanced field options
63
  //--------------------------------------------------------------------//
64
-
65
  $this->field_option( 'advanced-options', $field, array( 'markup' => 'open' ) );
66
  $this->field_option( 'size', $field );
67
-
68
  echo '<div class="format-selected-' . $format . ' format-selected">';
69
 
70
  // Simple
@@ -165,7 +165,7 @@ class WPForms_Field_Name extends WPForms_Field {
165
  echo '</div>';
166
  echo '<div class="wpforms-last-name">';
167
  printf( '<input type="text" placeholder="%s" class="primary-input" disabled>', $last_placeholder );
168
- printf( '<label class="wpforms-sub-label">%s</label>', __( 'Last', 'wpforms' ) );
169
  echo '</div>';
170
  echo '</div>';
171
 
@@ -180,7 +180,7 @@ class WPForms_Field_Name extends WPForms_Field {
180
  * @param array $form_data
181
  */
182
  public function field_display( $field, $field_atts, $form_data ) {
183
-
184
  // Setup and sanitize the necessary data
185
  $field = apply_filters( 'wpforms_address_field_display', $field, $field_atts, $form_data );
186
  $field_required = !empty( $field['required'] ) ? ' required' : '';
@@ -189,19 +189,19 @@ class WPForms_Field_Name extends WPForms_Field {
189
  $field_id = implode( ' ', array_map( 'sanitize_html_class', $field_atts['input_id'] ) );
190
  $field_sublabel = !empty( $field['sublabel_hide'] ) ? 'wpforms-sublabel-hide' : '';
191
  $simple_placeholder = !empty( $field['simple_placeholder'] ) ? esc_attr( $field['simple_placeholder'] ) : '';
192
- $simple_default = !empty( $field['simple_default'] ) ? esc_attr( $field['simple_default'] ) : '';
193
  $first_placeholder = !empty( $field['first_placeholder'] ) ? esc_attr( $field['first_placeholder'] ) : '';
194
- $first_default = !empty( $field['first_default'] ) ? esc_attr( $field['first_default'] ) : '';
195
  $middle_placeholder = !empty( $field['middle_placeholder'] ) ? esc_attr( $field['middle_placeholder'] ) : '';
196
- $middle_default = !empty( $field['middle_default'] ) ? esc_attr( $field['middle_default'] ) : '';
197
  $last_placeholder = !empty( $field['last_placeholder'] ) ? esc_attr( $field['last_placeholder'] ) : '';
198
- $last_default = !empty( $field['last_default'] ) ? esc_attr( $field['last_default'] ) : '';
199
  $form_id = $form_data['id'];
200
 
201
  // Simple name format
202
  if ( 'simple' == $field_format ) :
203
 
204
- printf(
205
  '<input type="text" name="wpforms[fields][%d]" id="%s" class="%s" placeholder="%s" value="%s" %s>',
206
  $field['id'],
207
  $field_id,
@@ -225,7 +225,7 @@ class WPForms_Field_Name extends WPForms_Field {
225
  $first_class .= !empty( $field_required ) ? ' wpforms-field-required' : '';
226
  $first_class .= !empty( wpforms()->process->errors[$form_id][$field['id']]['first'] ) ? ' wpforms-error' : '';
227
 
228
- printf(
229
  '<input type="text" name="wpforms[fields][%d][first]" id="%s" class="%s" placeholder="%s" value="%s" %s>',
230
  $field['id'],
231
  "wpforms-{$form_id}-field_{$field['id']}",
@@ -238,7 +238,7 @@ class WPForms_Field_Name extends WPForms_Field {
238
  if ( !empty( wpforms()->process->errors[$form_id][$field['id']]['first'] ) ) {
239
  printf( '<label id="wpforms-%d-field_%d-error" class="wpforms-error" for="wpforms-field_%d">%s</label>', $form_id, $field['id'], $field['id'], esc_html( wpforms()->process->errors[$form_id][$field['id']]['first'] ) );
240
  }
241
-
242
  printf( '<label for="wpforms-%d-field_%d" class="wpforms-field-sublabel %s">%s</label>', $form_id, $field['id'], $field_sublabel, __( 'First', 'wpforms' ) );
243
 
244
  echo '</div>';
@@ -248,7 +248,7 @@ class WPForms_Field_Name extends WPForms_Field {
248
 
249
  echo '<div class="wpforms-field-row-block wpforms-one-fifth">';
250
 
251
- printf(
252
  '<input type="text" name="wpforms[fields][%d][middle]" id="%s" class="%s" placeholder="%s" value="%s">',
253
  $field['id'],
254
  "wpforms-{$form_id}-field_{$field['id']}-middle",
@@ -256,7 +256,7 @@ class WPForms_Field_Name extends WPForms_Field {
256
  $middle_placeholder,
257
  $middle_default
258
  );
259
-
260
  printf( '<label for="wpforms-%d-field_%d-middle" class="wpforms-field-sublabel %s">%s</label>', $form_id, $field['id'], $field_sublabel, __( 'Middle', 'wpforms' ) );
261
 
262
  echo '</div>';
@@ -270,7 +270,7 @@ class WPForms_Field_Name extends WPForms_Field {
270
  $last_class .= !empty( $field_required ) ? ' wpforms-field-required' : '';
271
  $last_class .= !empty( wpforms()->process->errors[$form_id][$field['id']]['last'] ) ? ' wpforms-error' : '';
272
 
273
- printf(
274
  '<input type="text" name="wpforms[fields][%d][last]" id="%s" class="%s" placeholder="%s" value="%s" %s>',
275
  $field['id'],
276
  "wpforms-{$form_id}-field_{$field['id']}-last",
@@ -283,13 +283,13 @@ class WPForms_Field_Name extends WPForms_Field {
283
  if ( !empty( wpforms()->process->errors[$form_id][$field['id']]['last'] ) ) {
284
  printf( '<label id="wpforms-%d-field_%d-error" class="wpforms-error" for="wpforms-field_%d">%s</label>', $form_id, $field['id'], $field['id'], esc_html( wpforms()->process->errors[$form_id][$field['id']]['last'] ) );
285
  }
286
-
287
  printf( '<label for="wpforms-%d-field_%d-last" class="wpforms-field-sublabel %s">%s</label>', $form_id, $field['id'], $field_sublabel, __( 'Last', 'wpforms' ) );
288
 
289
  echo '</div>';
290
 
291
  echo '</div>';
292
-
293
  endif;
294
  }
295
 
@@ -309,7 +309,7 @@ class WPForms_Field_Name extends WPForms_Field {
309
  $form_id = $form_data['id'];
310
  $format = $form_data['fields'][$field_id]['format'];
311
  $required = apply_filters( 'wpforms_required_label', __( 'This field is required', 'wpforms' ) );
312
-
313
  if ( 'simple' == $format && empty( $field_submit ) ) {
314
  wpforms()->process->errors[$form_id][$field_id] = $required;
315
  }
@@ -338,7 +338,7 @@ class WPForms_Field_Name extends WPForms_Field {
338
  $first = !empty( $field_submit['first'] ) ? $field_submit['first'] : '';
339
  $middle = !empty( $field_submit['middle'] ) ? $field_submit['middle'] : '';
340
  $last = !empty( $field_submit['last'] ) ? $field_submit['last'] : '';
341
-
342
  if ( is_array( $field_submit ) ) {
343
  $value = array( $first, $middle, $last );
344
  $value = array_filter( $value );
38
  //--------------------------------------------------------------------//
39
  // Basic field options
40
  //--------------------------------------------------------------------//
41
+
42
  $this->field_option( 'basic-options', $field, array( 'markup' => 'open' ) );
43
  $this->field_option( 'label', $field );
44
 
57
  $this->field_option( 'description', $field );
58
  $this->field_option( 'required', $field );
59
  $this->field_option( 'basic-options', $field, array( 'markup' => 'close' ) );
60
+
61
  //--------------------------------------------------------------------//
62
  // Advanced field options
63
  //--------------------------------------------------------------------//
64
+
65
  $this->field_option( 'advanced-options', $field, array( 'markup' => 'open' ) );
66
  $this->field_option( 'size', $field );
67
+
68
  echo '<div class="format-selected-' . $format . ' format-selected">';
69
 
70
  // Simple
165
  echo '</div>';
166
  echo '<div class="wpforms-last-name">';
167
  printf( '<input type="text" placeholder="%s" class="primary-input" disabled>', $last_placeholder );
168
+ printf( '<label class="wpforms-sub-label">%s</label>', __( 'Last', 'wpforms' ) );
169
  echo '</div>';
170
  echo '</div>';
171
 
180
  * @param array $form_data
181
  */
182
  public function field_display( $field, $field_atts, $form_data ) {
183
+
184
  // Setup and sanitize the necessary data
185
  $field = apply_filters( 'wpforms_address_field_display', $field, $field_atts, $form_data );
186
  $field_required = !empty( $field['required'] ) ? ' required' : '';
189
  $field_id = implode( ' ', array_map( 'sanitize_html_class', $field_atts['input_id'] ) );
190
  $field_sublabel = !empty( $field['sublabel_hide'] ) ? 'wpforms-sublabel-hide' : '';
191
  $simple_placeholder = !empty( $field['simple_placeholder'] ) ? esc_attr( $field['simple_placeholder'] ) : '';
192
+ $simple_default = !empty( $field['simple_default'] ) ? esc_attr( apply_filters( 'wpforms_process_smart_tags', $field['simple_default'], $form_data ) ) : '';
193
  $first_placeholder = !empty( $field['first_placeholder'] ) ? esc_attr( $field['first_placeholder'] ) : '';
194
+ $first_default = !empty( $field['first_default'] ) ? esc_attr( apply_filters( 'wpforms_process_smart_tags', $field['first_default'], $form_data ) ) : '';
195
  $middle_placeholder = !empty( $field['middle_placeholder'] ) ? esc_attr( $field['middle_placeholder'] ) : '';
196
+ $middle_default = !empty( $field['middle_default'] ) ? esc_attr( apply_filters( 'wpforms_process_smart_tags', $field['middle_default'], $form_data ) ) : '';
197
  $last_placeholder = !empty( $field['last_placeholder'] ) ? esc_attr( $field['last_placeholder'] ) : '';
198
+ $last_default = !empty( $field['last_default'] ) ? esc_attr( apply_filters( 'wpforms_process_smart_tags', $field['last_default'], $form_data ) ) : '';
199
  $form_id = $form_data['id'];
200
 
201
  // Simple name format
202
  if ( 'simple' == $field_format ) :
203
 
204
+ printf(
205
  '<input type="text" name="wpforms[fields][%d]" id="%s" class="%s" placeholder="%s" value="%s" %s>',
206
  $field['id'],
207
  $field_id,
225
  $first_class .= !empty( $field_required ) ? ' wpforms-field-required' : '';
226
  $first_class .= !empty( wpforms()->process->errors[$form_id][$field['id']]['first'] ) ? ' wpforms-error' : '';
227
 
228
+ printf(
229
  '<input type="text" name="wpforms[fields][%d][first]" id="%s" class="%s" placeholder="%s" value="%s" %s>',
230
  $field['id'],
231
  "wpforms-{$form_id}-field_{$field['id']}",
238
  if ( !empty( wpforms()->process->errors[$form_id][$field['id']]['first'] ) ) {
239
  printf( '<label id="wpforms-%d-field_%d-error" class="wpforms-error" for="wpforms-field_%d">%s</label>', $form_id, $field['id'], $field['id'], esc_html( wpforms()->process->errors[$form_id][$field['id']]['first'] ) );
240
  }
241
+
242
  printf( '<label for="wpforms-%d-field_%d" class="wpforms-field-sublabel %s">%s</label>', $form_id, $field['id'], $field_sublabel, __( 'First', 'wpforms' ) );
243
 
244
  echo '</div>';
248
 
249
  echo '<div class="wpforms-field-row-block wpforms-one-fifth">';
250
 
251
+ printf(
252
  '<input type="text" name="wpforms[fields][%d][middle]" id="%s" class="%s" placeholder="%s" value="%s">',
253
  $field['id'],
254
  "wpforms-{$form_id}-field_{$field['id']}-middle",
256
  $middle_placeholder,
257
  $middle_default
258
  );
259
+
260
  printf( '<label for="wpforms-%d-field_%d-middle" class="wpforms-field-sublabel %s">%s</label>', $form_id, $field['id'], $field_sublabel, __( 'Middle', 'wpforms' ) );
261
 
262
  echo '</div>';
270
  $last_class .= !empty( $field_required ) ? ' wpforms-field-required' : '';
271
  $last_class .= !empty( wpforms()->process->errors[$form_id][$field['id']]['last'] ) ? ' wpforms-error' : '';
272
 
273
+ printf(
274
  '<input type="text" name="wpforms[fields][%d][last]" id="%s" class="%s" placeholder="%s" value="%s" %s>',
275
  $field['id'],
276
  "wpforms-{$form_id}-field_{$field['id']}-last",
283
  if ( !empty( wpforms()->process->errors[$form_id][$field['id']]['last'] ) ) {
284
  printf( '<label id="wpforms-%d-field_%d-error" class="wpforms-error" for="wpforms-field_%d">%s</label>', $form_id, $field['id'], $field['id'], esc_html( wpforms()->process->errors[$form_id][$field['id']]['last'] ) );
285
  }
286
+
287
  printf( '<label for="wpforms-%d-field_%d-last" class="wpforms-field-sublabel %s">%s</label>', $form_id, $field['id'], $field_sublabel, __( 'Last', 'wpforms' ) );
288
 
289
  echo '</div>';
290
 
291
  echo '</div>';
292
+
293
  endif;
294
  }
295
 
309
  $form_id = $form_data['id'];
310
  $format = $form_data['fields'][$field_id]['format'];
311
  $required = apply_filters( 'wpforms_required_label', __( 'This field is required', 'wpforms' ) );
312
+
313
  if ( 'simple' == $format && empty( $field_submit ) ) {
314
  wpforms()->process->errors[$form_id][$field_id] = $required;
315
  }
338
  $first = !empty( $field_submit['first'] ) ? $field_submit['first'] : '';
339
  $middle = !empty( $field_submit['middle'] ) ? $field_submit['middle'] : '';
340
  $last = !empty( $field_submit['last'] ) ? $field_submit['last'] : '';
341
+
342
  if ( is_array( $field_submit ) ) {
343
  $value = array( $first, $middle, $last );
344
  $value = array_filter( $value );
includes/fields/class-number.php CHANGED
@@ -122,6 +122,11 @@ class WPForms_Field_Number extends WPForms_Field {
122
 
123
  $form_id = $form_data['id'];
124
 
 
 
 
 
 
125
  // Basic required check - If field is marked as required, check for entry data
126
  if ( !empty( $form_data['fields'][$field_id]['required'] ) && empty( $field_submit ) && '0' != $field_submit ) {
127
  wpforms()->process->errors[$form_id][$field_id] = apply_filters( 'wpforms_required_label', __('This field is required', 'wpforms' ) );
@@ -132,5 +137,28 @@ class WPForms_Field_Number extends WPForms_Field {
132
  wpforms()->process->errors[$form_id][$field_id] = apply_filters( 'wpforms_valid_number_label', __('Please enter a valid number.', 'wpforms' ) );
133
  }
134
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
136
  new WPForms_Field_Number;
122
 
123
  $form_id = $form_data['id'];
124
 
125
+ // Some browsers allow other non-digit/decimal characters to be submitted
126
+ // with the num input, which then trips the is_numeric validation below.
127
+ // To get around this we remove all chars that are not expected.
128
+ $field_submit = preg_replace( '/[^0-9.]/', '', $field_submit );
129
+
130
  // Basic required check - If field is marked as required, check for entry data
131
  if ( !empty( $form_data['fields'][$field_id]['required'] ) && empty( $field_submit ) && '0' != $field_submit ) {
132
  wpforms()->process->errors[$form_id][$field_id] = apply_filters( 'wpforms_required_label', __('This field is required', 'wpforms' ) );
137
  wpforms()->process->errors[$form_id][$field_id] = apply_filters( 'wpforms_valid_number_label', __('Please enter a valid number.', 'wpforms' ) );
138
  }
139
  }
140
+
141
+ /**
142
+ * Formats and sanitizes field.
143
+ *
144
+ * @since 1.3.5
145
+ * @param int $field_id
146
+ * @param array $field_submit
147
+ * @param array $form_data
148
+ */
149
+ public function format( $field_id, $field_submit, $form_data ) {
150
+
151
+ $name = !empty( $form_data['fields'][$field_id]['label'] ) ? sanitize_text_field( $form_data['fields'][$field_id]['label'] ) : '';
152
+
153
+ // Remove non-numerical characters
154
+ $value = preg_replace( '/[^0-9.]/', '', $field_submit );
155
+
156
+ wpforms()->process->fields[$field_id] = array(
157
+ 'name' => $name,
158
+ 'value' => $value,
159
+ 'id' => absint( $field_id ),
160
+ 'type' => $this->type,
161
+ );
162
+ }
163
  }
164
  new WPForms_Field_Number;
includes/fields/class-select.php CHANGED
@@ -52,16 +52,16 @@ class WPForms_Field_Select extends WPForms_Field {
52
  //--------------------------------------------------------------------//
53
  // Basic field options
54
  //--------------------------------------------------------------------//
55
-
56
  // Options open markup
57
  $this->field_option( 'basic-options', $field, array( 'markup' => 'open' ) );
58
-
59
  // Label
60
  $this->field_option( 'label', $field );
61
-
62
  // Choices
63
- $this->field_option( 'choices', $field );
64
-
65
  // Description
66
  $this->field_option( 'description', $field );
67
 
@@ -70,11 +70,11 @@ class WPForms_Field_Select extends WPForms_Field {
70
 
71
  // Options close markup
72
  $this->field_option( 'basic-options', $field, array( 'markup' => 'close' ) );
73
-
74
  //--------------------------------------------------------------------//
75
  // Advanced field options
76
  //--------------------------------------------------------------------//
77
-
78
  // Options open markup
79
  $this->field_option( 'advanced-options', $field, array( 'markup' => 'open' ) );
80
 
@@ -123,22 +123,22 @@ class WPForms_Field_Select extends WPForms_Field {
123
 
124
  // Field select element
125
  echo '<select class="primary-input" disabled>';
126
-
127
  // Optional placeholder
128
  if ( !empty( $placeholder ) ) {
129
  printf( '<option value="" class="placeholder">%s</option>', $placeholder );
130
  }
131
 
132
- // Check to see if this field is configured for Dynamic Choices,
133
  // either auto populating from a post type or a taxonomy.
134
  if ( 'post_type' == $dynamic && !empty( $field['dynamic_post_type'] ) ) {
135
-
136
  // Post type dynamic populating
137
  $source = $field['dynamic_post_type'];
138
- $args = array(
139
- 'post_type' => $source,
140
- 'posts_per_page' => 1,
141
- 'orderby' => 'title',
142
  'order' => 'ASC' ,
143
  );
144
  $posts = get_posts( apply_filters( 'wpforms_dynamic_choice_post_type_args', $args, $field, $this->form_id ) );
@@ -152,11 +152,11 @@ class WPForms_Field_Select extends WPForms_Field {
152
 
153
  // Taxonomy dynamic populating
154
  $source = $field['dynamic_taxonomy'];
155
- $args = array(
156
- 'taxonomy' => $source,
157
- 'hide_empty' => false,
158
  'number' => 1
159
- );
160
  $terms = get_terms( apply_filters( 'wpforms_dynamic_choice_taxonomy_args', $args, $field, $this->form_id ) );
161
  $values = array();
162
 
@@ -169,7 +169,7 @@ class WPForms_Field_Select extends WPForms_Field {
169
  if ( empty( $values ) ) {
170
  $values = array( 'label' => __( '(empty)', 'wpforms' ) );
171
  }
172
-
173
  // Build the select options (even though user can only see 1st option)
174
  foreach ( $values as $key => $value ) {
175
 
@@ -178,7 +178,7 @@ class WPForms_Field_Select extends WPForms_Field {
178
 
179
  printf( '<option %s>%s</option>', $selected, $value['label'] );
180
  }
181
-
182
  echo '</select>';
183
 
184
  // Description
@@ -230,26 +230,26 @@ class WPForms_Field_Select extends WPForms_Field {
230
 
231
  // Optional placeholder
232
  if ( !empty( $field_placeholder ) ) {
233
- printf('<option value="" class="placeholder" disabled %s>%s</option>', selected( false, $has_default, true ), $field_placeholder );
234
  }
235
 
236
- // Check to see if this field is configured for Dynamic Choices,
237
  // either auto populating from a post type or a taxonomy.
238
  if ( 'post_type' == $dynamic && !empty( $field['dynamic_post_type'] ) ) {
239
-
240
  // Post type dynamic populating
241
  $source = $field['dynamic_post_type'];
242
- $args = array(
243
- 'post_type' => $source,
244
- 'posts_per_page' => -1,
245
- 'orderby' => 'title',
246
  'order' => 'ASC' ,
247
  );
248
  $posts = get_posts( apply_filters( 'wpforms_dynamic_choice_post_type_args', $args, $field, $form_data['id'] ) );
249
  $choices = array();
250
 
251
  foreach ( $posts as $post ) {
252
- $choices[] = array(
253
  'value' => $post->ID,
254
  'label' => $post->post_title
255
  );
@@ -261,15 +261,15 @@ class WPForms_Field_Select extends WPForms_Field {
261
 
262
  // Taxonomy dynamic populating
263
  $source = $field['dynamic_taxonomy'];
264
- $args = array(
265
- 'taxonomy' => $source,
266
- 'hide_empty' => false,
267
- );
268
  $terms = get_terms( apply_filters( 'wpforms_dynamic_choice_taxonomy_args', $args, $field, $form_data['id'] ) );
269
  $choices = array();
270
-
271
  foreach ( $terms as $term ) {
272
- $choices[] = array(
273
  'value' => $term->term_id,
274
  'label' => $term->name
275
  );
@@ -280,10 +280,10 @@ class WPForms_Field_Select extends WPForms_Field {
280
 
281
  // Build the select options
282
  foreach ( $choices as $key => $choice ) {
283
-
284
  $selected = isset( $choice['default'] ) && empty( $field_placeholder ) ? '1' : '0' ;
285
  $val = isset( $field['show_values'] ) ? esc_attr( $choice['value'] ) : esc_attr( $choice['label'] );
286
-
287
  printf( '<option value="%s" %s>%s</option>', $val, selected( '1', $selected, false ), $choice['label'] );
288
  }
289
 
@@ -337,7 +337,7 @@ class WPForms_Field_Select extends WPForms_Field {
337
  if ( ! is_wp_error( $term ) && !empty( $term ) ) {
338
  $data['value'] = esc_html( $term->name );
339
  }
340
-
341
  } else {
342
 
343
  // Normal processing, dynamic population is off
@@ -345,7 +345,7 @@ class WPForms_Field_Select extends WPForms_Field {
345
  // If show_values is true, that means values posted are the raw values
346
  // and not the labels. So we need to get the label values.
347
  if ( !empty( $field['show_values'] ) && '1' == $field['show_values'] ) {
348
-
349
  foreach ( $field['choices'] as $choice ) {
350
  if ( $choice['value'] === $field_submit ) {
351
  $value = $choice['label'];
@@ -359,7 +359,7 @@ class WPForms_Field_Select extends WPForms_Field {
359
  $data['value'] = $value_raw;
360
  }
361
  }
362
-
363
  // Push field details to be saved
364
  wpforms()->process->fields[$field_id] = $data;
365
  }
52
  //--------------------------------------------------------------------//
53
  // Basic field options
54
  //--------------------------------------------------------------------//
55
+
56
  // Options open markup
57
  $this->field_option( 'basic-options', $field, array( 'markup' => 'open' ) );
58
+
59
  // Label
60
  $this->field_option( 'label', $field );
61
+
62
  // Choices
63
+ $this->field_option( 'choices', $field );
64
+
65
  // Description
66
  $this->field_option( 'description', $field );
67
 
70
 
71
  // Options close markup
72
  $this->field_option( 'basic-options', $field, array( 'markup' => 'close' ) );
73
+
74
  //--------------------------------------------------------------------//
75
  // Advanced field options
76
  //--------------------------------------------------------------------//
77
+
78
  // Options open markup
79
  $this->field_option( 'advanced-options', $field, array( 'markup' => 'open' ) );
80
 
123
 
124
  // Field select element
125
  echo '<select class="primary-input" disabled>';
126
+
127
  // Optional placeholder
128
  if ( !empty( $placeholder ) ) {
129
  printf( '<option value="" class="placeholder">%s</option>', $placeholder );
130
  }
131
 
132
+ // Check to see if this field is configured for Dynamic Choices,
133
  // either auto populating from a post type or a taxonomy.
134
  if ( 'post_type' == $dynamic && !empty( $field['dynamic_post_type'] ) ) {
135
+
136
  // Post type dynamic populating
137
  $source = $field['dynamic_post_type'];
138
+ $args = array(
139
+ 'post_type' => $source,
140
+ 'posts_per_page' => 1,
141
+ 'orderby' => 'title',
142
  'order' => 'ASC' ,
143
  );
144
  $posts = get_posts( apply_filters( 'wpforms_dynamic_choice_post_type_args', $args, $field, $this->form_id ) );
152
 
153
  // Taxonomy dynamic populating
154
  $source = $field['dynamic_taxonomy'];
155
+ $args = array(
156
+ 'taxonomy' => $source,
157
+ 'hide_empty' => false,
158
  'number' => 1
159
+ );
160
  $terms = get_terms( apply_filters( 'wpforms_dynamic_choice_taxonomy_args', $args, $field, $this->form_id ) );
161
  $values = array();
162
 
169
  if ( empty( $values ) ) {
170
  $values = array( 'label' => __( '(empty)', 'wpforms' ) );
171
  }
172
+
173
  // Build the select options (even though user can only see 1st option)
174
  foreach ( $values as $key => $value ) {
175
 
178
 
179
  printf( '<option %s>%s</option>', $selected, $value['label'] );
180
  }
181
+
182
  echo '</select>';
183
 
184
  // Description
230
 
231
  // Optional placeholder
232
  if ( !empty( $field_placeholder ) ) {
233
+ printf('<option value="" class="placeholder" disabled %s>%s</option>', selected( false, $has_default, false ), $field_placeholder );
234
  }
235
 
236
+ // Check to see if this field is configured for Dynamic Choices,
237
  // either auto populating from a post type or a taxonomy.
238
  if ( 'post_type' == $dynamic && !empty( $field['dynamic_post_type'] ) ) {
239
+
240
  // Post type dynamic populating
241
  $source = $field['dynamic_post_type'];
242
+ $args = array(
243
+ 'post_type' => $source,
244
+ 'posts_per_page' => -1,
245
+ 'orderby' => 'title',
246
  'order' => 'ASC' ,
247
  );
248
  $posts = get_posts( apply_filters( 'wpforms_dynamic_choice_post_type_args', $args, $field, $form_data['id'] ) );
249
  $choices = array();
250
 
251
  foreach ( $posts as $post ) {
252
+ $choices[] = array(
253
  'value' => $post->ID,
254
  'label' => $post->post_title
255
  );
261
 
262
  // Taxonomy dynamic populating
263
  $source = $field['dynamic_taxonomy'];
264
+ $args = array(
265
+ 'taxonomy' => $source,
266
+ 'hide_empty' => false,
267
+ );
268
  $terms = get_terms( apply_filters( 'wpforms_dynamic_choice_taxonomy_args', $args, $field, $form_data['id'] ) );
269
  $choices = array();
270
+
271
  foreach ( $terms as $term ) {
272
+ $choices[] = array(
273
  'value' => $term->term_id,
274
  'label' => $term->name
275
  );
280
 
281
  // Build the select options
282
  foreach ( $choices as $key => $choice ) {
283
+
284
  $selected = isset( $choice['default'] ) && empty( $field_placeholder ) ? '1' : '0' ;
285
  $val = isset( $field['show_values'] ) ? esc_attr( $choice['value'] ) : esc_attr( $choice['label'] );
286
+
287
  printf( '<option value="%s" %s>%s</option>', $val, selected( '1', $selected, false ), $choice['label'] );
288
  }
289
 
337
  if ( ! is_wp_error( $term ) && !empty( $term ) ) {
338
  $data['value'] = esc_html( $term->name );
339
  }
340
+
341
  } else {
342
 
343
  // Normal processing, dynamic population is off
345
  // If show_values is true, that means values posted are the raw values
346
  // and not the labels. So we need to get the label values.
347
  if ( !empty( $field['show_values'] ) && '1' == $field['show_values'] ) {
348
+
349
  foreach ( $field['choices'] as $choice ) {
350
  if ( $choice['value'] === $field_submit ) {
351
  $value = $choice['label'];
359
  $data['value'] = $value_raw;
360
  }
361
  }
362
+
363
  // Push field details to be saved
364
  wpforms()->process->fields[$field_id] = $data;
365
  }
languages/wpforms.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the WPForms package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WPForms 1.3.3\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wpforms\n"
7
- "POT-Creation-Date: 2017-02-01 15:40:06+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -529,9 +529,9 @@ msgid ""
529
  "a>?"
530
  msgstr ""
531
 
532
- #. #-#-#-#-# wpforms.pot (WPForms 1.3.3) #-#-#-#-#
533
  #. Plugin Name of the plugin/theme
534
- #. #-#-#-#-# wpforms.pot (WPForms 1.3.3) #-#-#-#-#
535
  #. Author of the plugin/theme
536
  #: includes/admin/class-menu.php:36 includes/admin/class-menu.php:37
537
  #: includes/admin/class-menu.php:48 includes/integrations.php:34
@@ -774,7 +774,7 @@ msgid "WPForms Preview"
774
  msgstr ""
775
 
776
  #: includes/class-preview.php:261
777
- msgid "This is a preview of your form. This page not publically accessible."
778
  msgstr ""
779
 
780
  #: includes/class-preview.php:263
@@ -3185,9 +3185,9 @@ msgstr ""
3185
  msgid "Please deactivate WPForms Lite before activating WPForms"
3186
  msgstr ""
3187
 
3188
- #. #-#-#-#-# wpforms.pot (WPForms 1.3.3) #-#-#-#-#
3189
  #. Plugin URI of the plugin/theme
3190
- #. #-#-#-#-# wpforms.pot (WPForms 1.3.3) #-#-#-#-#
3191
  #. Author URI of the plugin/theme
3192
  msgid "https://wpforms.com"
3193
  msgstr ""
2
  # This file is distributed under the same license as the WPForms package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WPForms 1.3.4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wpforms\n"
7
+ "POT-Creation-Date: 2017-02-09 18:10:00+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
529
  "a>?"
530
  msgstr ""
531
 
532
+ #. #-#-#-#-# wpforms.pot (WPForms 1.3.4) #-#-#-#-#
533
  #. Plugin Name of the plugin/theme
534
+ #. #-#-#-#-# wpforms.pot (WPForms 1.3.4) #-#-#-#-#
535
  #. Author of the plugin/theme
536
  #: includes/admin/class-menu.php:36 includes/admin/class-menu.php:37
537
  #: includes/admin/class-menu.php:48 includes/integrations.php:34
774
  msgstr ""
775
 
776
  #: includes/class-preview.php:261
777
+ msgid "This is a preview of your form. This page is not publically accessible."
778
  msgstr ""
779
 
780
  #: includes/class-preview.php:263
3185
  msgid "Please deactivate WPForms Lite before activating WPForms"
3186
  msgstr ""
3187
 
3188
+ #. #-#-#-#-# wpforms.pot (WPForms 1.3.4) #-#-#-#-#
3189
  #. Plugin URI of the plugin/theme
3190
+ #. #-#-#-#-# wpforms.pot (WPForms 1.3.4) #-#-#-#-#
3191
  #. Author URI of the plugin/theme
3192
  msgid "https://wpforms.com"
3193
  msgstr ""
lite/wpforms-lite.php CHANGED
@@ -232,9 +232,15 @@ class WPForms_Lite {
232
  return 'https://wpforms.com/lite-upgrade/?utm_source=WordPress&amp;utm_medium=link&amp;utm_campaign=liteplugin';
233
  }
234
 
 
 
 
 
 
 
235
  // If here, we have a ShareASale ID
236
  // Return ShareASale URL with redirect.
237
- return 'http://www.shareasale.com/r.cfm?B=837827&U=' . $shareasale_id . '&M=64312&urllink=';
238
  }
239
 
240
  /**
@@ -529,6 +535,11 @@ class WPForms_Lite {
529
  'desc' => 'WPForms custom captcha addon allows you to define custom questions or use random math questions as captcha to combat spam form submissions.',
530
  'icon' => 'addon-icon-captcha.png'
531
  ),
 
 
 
 
 
532
  array(
533
  'name' => 'Geolocation',
534
  'desc' => 'WPForms geolocation addon allows you to collect and store your website visitors geolocation data along with their form submission.',
232
  return 'https://wpforms.com/lite-upgrade/?utm_source=WordPress&amp;utm_medium=link&amp;utm_campaign=liteplugin';
233
  }
234
 
235
+ // Whether we have a specific redirect URL to use
236
+ $shareasale_redirect = apply_filters( 'wpforms_shareasale_redirect', get_option( 'wpforms_shareasale_redirect', '' ) );
237
+
238
+ // Build final URL
239
+ $shareasale_url = sprintf( 'http://www.shareasale.com/r.cfm?B=837827&U=%s&M=64312&urllink=%s', $shareasale_id, $shareasale_redirect );
240
+
241
  // If here, we have a ShareASale ID
242
  // Return ShareASale URL with redirect.
243
+ return esc_url( $shareasale_url );
244
  }
245
 
246
  /**
535
  'desc' => 'WPForms custom captcha addon allows you to define custom questions or use random math questions as captcha to combat spam form submissions.',
536
  'icon' => 'addon-icon-captcha.png'
537
  ),
538
+ array(
539
+ 'name' => 'Form Abandonment',
540
+ 'desc' => 'Unlock more leads by capturing partial entries from your forms. Easily follow up with interested leads and turn them into loyal customers.',
541
+ 'icon' => 'addon-icon-form-abandonment.png'
542
+ ),
543
  array(
544
  'name' => 'Geolocation',
545
  'desc' => 'WPForms geolocation addon allows you to collect and store your website visitors geolocation data along with their form submission.',
readme.txt CHANGED
@@ -163,6 +163,16 @@ Syed Balkhi
163
 
164
  == Changelog ==
165
 
 
 
 
 
 
 
 
 
 
 
166
  = 1.3.3 =
167
  - Added: Default value support in the email field
168
  - Added: Various new hooks and filters for improved extendibility
163
 
164
  == Changelog ==
165
 
166
+ = 1.3.5 =
167
+ - Fixed: Some browers allowing unexpected characters inside number input fields
168
+ - Fixed: Issue with Dropdown field placeholder text
169
+ - Fixed: Select few plugins loading conflicting scripts in form builder
170
+
171
+ = 1.3.4 =
172
+ - Added: reCAPTCHA improvements; reCAPTCHA now required if turned on
173
+ - Fixed: Date/Time Smart Tag not using WordPress time zone settings
174
+ - Fixed: Name field defaults not processing Smart Tags
175
+
176
  = 1.3.3 =
177
  - Added: Default value support in the email field
178
  - Added: Various new hooks and filters for improved extendibility
wpforms.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Beginner friendly WordPress contact form plugin. Use our Drag & Drop form builder to create your WordPress forms.
6
  * Author: WPForms
7
  * Author URI: https://wpforms.com
8
- * Version: 1.3.3
9
  * Text Domain: wpforms
10
  * Domain Path: languages
11
  *
@@ -81,7 +81,7 @@ final class WPForms {
81
  * @since 1.0.0
82
  * @var sting
83
  */
84
- public $version = '1.3.3';
85
 
86
  /**
87
  * The form data handler instance.
5
  * Description: Beginner friendly WordPress contact form plugin. Use our Drag & Drop form builder to create your WordPress forms.
6
  * Author: WPForms
7
  * Author URI: https://wpforms.com
8
+ * Version: 1.3.5
9
  * Text Domain: wpforms
10
  * Domain Path: languages
11
  *
81
  * @since 1.0.0
82
  * @var sting
83
  */
84
+ public $version = '1.3.5';
85
 
86
  /**
87
  * The form data handler instance.