Version Description
- Fix required validation: URL and number fields were requiring a value when the field was not required
- Fix double recaptcha validation which was causing it to fail validation
Download this release
Release Info
Developer | sswells |
Plugin | Formidable Forms – Form Builder for WordPress |
Version | 3.0.04 |
Comparing to | |
See all releases |
Code changes from version 3.0.03 to 3.0.04
- classes/controllers/FrmAppController.php +28 -2
- classes/helpers/FrmAppHelper.php +2 -2
- classes/models/FrmEntryValidate.php +3 -35
- classes/models/FrmMigrate.php +1 -1
- classes/models/fields/FrmFieldNumber.php +1 -1
- classes/models/fields/FrmFieldUrl.php +4 -2
- classes/models/fields/FrmFieldUserID.php +4 -0
- formidable.php +1 -3
- js/formidable_admin.js +1 -1
- readme.txt +5 -1
classes/controllers/FrmAppController.php
CHANGED
@@ -201,14 +201,39 @@ class FrmAppController {
|
|
201 |
* @return boolean
|
202 |
*/
|
203 |
public static function needs_update() {
|
204 |
-
$
|
205 |
-
|
|
|
|
|
|
|
|
|
206 |
if ( ! $needs_upgrade ) {
|
207 |
$needs_upgrade = apply_filters( 'frm_db_needs_upgrade', $needs_upgrade );
|
208 |
}
|
209 |
return $needs_upgrade;
|
210 |
}
|
211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
/**
|
213 |
* Check for database update and trigger js loading
|
214 |
*
|
@@ -425,6 +450,7 @@ class FrmAppController {
|
|
425 |
}
|
426 |
|
427 |
public static function activation_install() {
|
|
|
428 |
FrmDb::delete_cache_and_transient( 'frm_plugin_version' );
|
429 |
FrmFormActionsController::actions_init();
|
430 |
self::install();
|
201 |
* @return boolean
|
202 |
*/
|
203 |
public static function needs_update() {
|
204 |
+
$needs_upgrade = self::compare_for_update( array(
|
205 |
+
'option' => 'frm_db_version',
|
206 |
+
'new_db_version' => FrmAppHelper::$db_version,
|
207 |
+
'new_plugin_version' => FrmAppHelper::plugin_version(),
|
208 |
+
) );
|
209 |
+
|
210 |
if ( ! $needs_upgrade ) {
|
211 |
$needs_upgrade = apply_filters( 'frm_db_needs_upgrade', $needs_upgrade );
|
212 |
}
|
213 |
return $needs_upgrade;
|
214 |
}
|
215 |
|
216 |
+
/**
|
217 |
+
* Check both version number and DB number for changes
|
218 |
+
*
|
219 |
+
* @since 3.0.04
|
220 |
+
*/
|
221 |
+
public static function compare_for_update( $atts ) {
|
222 |
+
$needs_upgrade = false;
|
223 |
+
$db_version = get_option( $atts['option'] );
|
224 |
+
|
225 |
+
if ( strpos( $db_version, '-' ) === false ) {
|
226 |
+
$needs_upgrade = true;
|
227 |
+
} else {
|
228 |
+
$last_upgrade = explode( '-', $db_version );
|
229 |
+
$needs_db_upgrade = (int) $last_upgrade[1] < (int) $atts['new_db_version'];
|
230 |
+
$new_version = version_compare( $last_upgrade[0], $atts['new_plugin_version'], '<' );
|
231 |
+
$needs_upgrade = $needs_db_upgrade || $new_version;
|
232 |
+
}
|
233 |
+
|
234 |
+
return $needs_upgrade;
|
235 |
+
}
|
236 |
+
|
237 |
/**
|
238 |
* Check for database update and trigger js loading
|
239 |
*
|
450 |
}
|
451 |
|
452 |
public static function activation_install() {
|
453 |
+
_deprecated_function( __METHOD__, '3.0.04', 'FrmAppController::install' );
|
454 |
FrmDb::delete_cache_and_transient( 'frm_plugin_version' );
|
455 |
FrmFormActionsController::actions_init();
|
456 |
self::install();
|
classes/helpers/FrmAppHelper.php
CHANGED
@@ -4,14 +4,14 @@ if ( ! defined('ABSPATH') ) {
|
|
4 |
}
|
5 |
|
6 |
class FrmAppHelper {
|
7 |
-
public static $db_version =
|
8 |
public static $pro_db_version = 37; //deprecated
|
9 |
public static $font_version = 3;
|
10 |
|
11 |
/**
|
12 |
* @since 2.0
|
13 |
*/
|
14 |
-
public static $plug_version = '3.0.
|
15 |
|
16 |
/**
|
17 |
* @since 1.07.02
|
4 |
}
|
5 |
|
6 |
class FrmAppHelper {
|
7 |
+
public static $db_version = 83; //version of the database we are moving to
|
8 |
public static $pro_db_version = 37; //deprecated
|
9 |
public static $font_version = 3;
|
10 |
|
11 |
/**
|
12 |
* @since 2.0
|
13 |
*/
|
14 |
+
public static $plug_version = '3.0.04';
|
15 |
|
16 |
/**
|
17 |
* @since 1.07.02
|
classes/models/FrmEntryValidate.php
CHANGED
@@ -101,8 +101,6 @@ class FrmEntryValidate {
|
|
101 |
self::validate_phone_field( $errors, $posted_field, $value, $args );
|
102 |
}
|
103 |
|
104 |
-
self::validate_recaptcha($errors, $posted_field, $args);
|
105 |
-
|
106 |
$errors = apply_filters( 'frm_validate_' . $posted_field->type . '_field_entry', $errors, $posted_field, $value, $args );
|
107 |
$errors = apply_filters( 'frm_validate_field_entry', $errors, $posted_field, $value, $args );
|
108 |
}
|
@@ -234,43 +232,13 @@ class FrmEntryValidate {
|
|
234 |
}
|
235 |
|
236 |
public static function validate_recaptcha( &$errors, $field, $args ) {
|
237 |
-
|
238 |
-
return;
|
239 |
-
}
|
240 |
|
241 |
-
$
|
242 |
-
if ( empty( $frm_settings->pubkey ) ) {
|
243 |
-
// don't require the captcha if it shouldn't be shown
|
244 |
return;
|
245 |
}
|
246 |
|
247 |
-
|
248 |
-
// If captcha is missing, check if it was already verified
|
249 |
-
if ( ! isset( $_POST['recaptcha_checked'] ) || ! wp_verify_nonce( $_POST['recaptcha_checked'], 'frm_ajax' ) ) {
|
250 |
-
// There was no captcha submitted
|
251 |
-
$errors[ 'field' . $args['id'] ] = __( 'The captcha is missing from this form', 'formidable' );
|
252 |
-
}
|
253 |
-
return;
|
254 |
-
}
|
255 |
-
|
256 |
-
$arg_array = array(
|
257 |
-
'body' => array(
|
258 |
-
'secret' => $frm_settings->privkey,
|
259 |
-
'response' => $_POST['g-recaptcha-response'],
|
260 |
-
'remoteip' => FrmAppHelper::get_ip_address(),
|
261 |
-
),
|
262 |
-
);
|
263 |
-
$resp = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', $arg_array );
|
264 |
-
$response = json_decode(wp_remote_retrieve_body( $resp ), true);
|
265 |
-
|
266 |
-
if ( isset( $response['success'] ) && ! $response['success'] ) {
|
267 |
-
// What happens when the CAPTCHA was entered incorrectly
|
268 |
-
$errors[ 'field' . $args['id'] ] = ( ! isset( $field->field_options['invalid'] ) || $field->field_options['invalid'] == '' ) ? $frm_settings->re_msg : $field->field_options['invalid'];
|
269 |
-
} else if ( is_wp_error( $resp ) ) {
|
270 |
-
$error_string = $resp->get_error_message();
|
271 |
-
$errors[ 'field' . $args['id'] ] = __( 'There was a problem verifying your recaptcha', 'formidable' );
|
272 |
-
$errors[ 'field' . $args['id'] ] .= ' ' . $error_string;
|
273 |
-
}
|
274 |
}
|
275 |
|
276 |
/**
|
101 |
self::validate_phone_field( $errors, $posted_field, $value, $args );
|
102 |
}
|
103 |
|
|
|
|
|
104 |
$errors = apply_filters( 'frm_validate_' . $posted_field->type . '_field_entry', $errors, $posted_field, $value, $args );
|
105 |
$errors = apply_filters( 'frm_validate_field_entry', $errors, $posted_field, $value, $args );
|
106 |
}
|
232 |
}
|
233 |
|
234 |
public static function validate_recaptcha( &$errors, $field, $args ) {
|
235 |
+
_deprecated_function( __FUNCTION__, '3.0', 'FrmFieldType::validate' );
|
|
|
|
|
236 |
|
237 |
+
if ( $field->type != 'captcha' ) {
|
|
|
|
|
238 |
return;
|
239 |
}
|
240 |
|
241 |
+
self::validate_field_types( $errors, $field, '', $args );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
}
|
243 |
|
244 |
/**
|
classes/models/FrmMigrate.php
CHANGED
@@ -42,7 +42,7 @@ class FrmMigrate {
|
|
42 |
$this->migrate_data($frm_db_version, $old_db_version);
|
43 |
|
44 |
/***** SAVE DB VERSION *****/
|
45 |
-
update_option('frm_db_version', $frm_db_version);
|
46 |
|
47 |
/**** ADD/UPDATE DEFAULT TEMPLATES ****/
|
48 |
FrmXMLController::add_default_templates();
|
42 |
$this->migrate_data($frm_db_version, $old_db_version);
|
43 |
|
44 |
/***** SAVE DB VERSION *****/
|
45 |
+
update_option( 'frm_db_version', FrmAppHelper::plugin_version() . '-' . $frm_db_version );
|
46 |
|
47 |
/**** ADD/UPDATE DEFAULT TEMPLATES ****/
|
48 |
FrmXMLController::add_default_templates();
|
classes/models/fields/FrmFieldNumber.php
CHANGED
@@ -42,7 +42,7 @@ class FrmFieldNumber extends FrmFieldType {
|
|
42 |
$this->remove_commas_from_number( $args );
|
43 |
|
44 |
//validate the number format
|
45 |
-
if ( ! is_numeric( $args['value'] ) ) {
|
46 |
$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
|
47 |
}
|
48 |
|
42 |
$this->remove_commas_from_number( $args );
|
43 |
|
44 |
//validate the number format
|
45 |
+
if ( ! is_numeric( $args['value'] ) && '' !== $args['value'] ) {
|
46 |
$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
|
47 |
}
|
48 |
|
classes/models/fields/FrmFieldUrl.php
CHANGED
@@ -48,7 +48,7 @@ class FrmFieldUrl extends FrmFieldType {
|
|
48 |
|
49 |
public function validate( $args ) {
|
50 |
$value = $args['value'];
|
51 |
-
if ( trim( $value ) == 'http://' ) {
|
52 |
$value = '';
|
53 |
} else {
|
54 |
$value = esc_url_raw( $value );
|
@@ -60,8 +60,10 @@ class FrmFieldUrl extends FrmFieldType {
|
|
60 |
$errors = array();
|
61 |
|
62 |
// validate the url format
|
63 |
-
if ( ! preg_match( '/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value ) ) {
|
64 |
$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
|
|
|
|
|
65 |
}
|
66 |
|
67 |
return $errors;
|
48 |
|
49 |
public function validate( $args ) {
|
50 |
$value = $args['value'];
|
51 |
+
if ( trim( $value ) == 'http://' || empty( $value ) ) {
|
52 |
$value = '';
|
53 |
} else {
|
54 |
$value = esc_url_raw( $value );
|
60 |
$errors = array();
|
61 |
|
62 |
// validate the url format
|
63 |
+
if ( ! empty( $value ) && ! preg_match( '/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value ) ) {
|
64 |
$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
|
65 |
+
} elseif ( $this->field->required == '1' && empty( $value ) ) {
|
66 |
+
$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'blank' );
|
67 |
}
|
68 |
|
69 |
return $errors;
|
classes/models/fields/FrmFieldUserID.php
CHANGED
@@ -49,6 +49,10 @@ class FrmFieldUserID extends FrmFieldType {
|
|
49 |
}
|
50 |
|
51 |
public function validate( $args ) {
|
|
|
|
|
|
|
|
|
52 |
// make sure we have a user ID
|
53 |
if ( ! is_numeric( $args['value'] ) ) {
|
54 |
$args['value'] = FrmAppHelper::get_user_id_param( $args['value'] );
|
49 |
}
|
50 |
|
51 |
public function validate( $args ) {
|
52 |
+
if ( '' == $args['value'] ) {
|
53 |
+
return array();
|
54 |
+
}
|
55 |
+
|
56 |
// make sure we have a user ID
|
57 |
if ( ! is_numeric( $args['value'] ) ) {
|
58 |
$args['value'] = FrmAppHelper::get_user_id_param( $args['value'] );
|
formidable.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Formidable Forms
|
4 |
Description: Quickly and easily create drag-and-drop forms
|
5 |
-
Version: 3.0.
|
6 |
Plugin URI: https://formidableforms.com/
|
7 |
Author URI: https://formidableforms.com/
|
8 |
Author: Strategy11
|
@@ -82,5 +82,3 @@ function frm_class_autoloader( $class_name, $filepath ) {
|
|
82 |
require( $filepath );
|
83 |
}
|
84 |
}
|
85 |
-
|
86 |
-
register_activation_hook( __FILE__, 'FrmAppController::activation_install' );
|
2 |
/*
|
3 |
Plugin Name: Formidable Forms
|
4 |
Description: Quickly and easily create drag-and-drop forms
|
5 |
+
Version: 3.0.04
|
6 |
Plugin URI: https://formidableforms.com/
|
7 |
Author URI: https://formidableforms.com/
|
8 |
Author: Strategy11
|
82 |
require( $filepath );
|
83 |
}
|
84 |
}
|
|
|
|
js/formidable_admin.js
CHANGED
@@ -87,7 +87,7 @@ function frmAdminBuildJS(){
|
|
87 |
var startPos = document.getElementById('frm_set_height_ele').getBoundingClientRect().top;
|
88 |
var topSidebar = document.getElementById('frm-fixed').getBoundingClientRect().top;
|
89 |
var totalHeight = window.innerHeight;
|
90 |
-
fixedBox.style.maxHeight = ( totalHeight - ( startPos - topSidebar ) -
|
91 |
}
|
92 |
}
|
93 |
|
87 |
var startPos = document.getElementById('frm_set_height_ele').getBoundingClientRect().top;
|
88 |
var topSidebar = document.getElementById('frm-fixed').getBoundingClientRect().top;
|
89 |
var totalHeight = window.innerHeight;
|
90 |
+
fixedBox.style.maxHeight = ( totalHeight - ( startPos - topSidebar ) - 60 ) +'px';
|
91 |
}
|
92 |
}
|
93 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: contact form, form builder, custom form, forms, form, form maker, form cre
|
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 4.9
|
6 |
Requires PHP: 5.3
|
7 |
-
Stable tag: 3.0.
|
8 |
|
9 |
The best WordPress form plugin for contact forms, surveys and more. Make forms a breeze with a drag and drop form builder and form style generator.
|
10 |
|
@@ -159,6 +159,10 @@ The field and form names and descriptions are all changed with in-place edit. Ju
|
|
159 |
[See more FAQs](https://formidableforms.com/formidable-faqs/ "Formidable Form FAQs")
|
160 |
|
161 |
== Changelog ==
|
|
|
|
|
|
|
|
|
162 |
= 3.0.03 =
|
163 |
* Enhancement: Use relative path in the form css now that the css is inside the plugin. Now font icons will continue working without a style save when the site url is changed.
|
164 |
* Fix: Save a different stylesheet file for each site in a network to prevent them from saving over eachother
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 4.9
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 3.0.04
|
8 |
|
9 |
The best WordPress form plugin for contact forms, surveys and more. Make forms a breeze with a drag and drop form builder and form style generator.
|
10 |
|
159 |
[See more FAQs](https://formidableforms.com/formidable-faqs/ "Formidable Form FAQs")
|
160 |
|
161 |
== Changelog ==
|
162 |
+
= 3.0.04 =
|
163 |
+
* Fix required validation: URL and number fields were requiring a value when the field was not required
|
164 |
+
* Fix double recaptcha validation which was causing it to fail validation
|
165 |
+
|
166 |
= 3.0.03 =
|
167 |
* Enhancement: Use relative path in the form css now that the css is inside the plugin. Now font icons will continue working without a style save when the site url is changed.
|
168 |
* Fix: Save a different stylesheet file for each site in a network to prevent them from saving over eachother
|