Version Description
- Fix: Step value validation was occasionally breaking in some cases due to rounding precision issues.
Download this release
Release Info
Developer | formidableforms |
Plugin | Formidable Forms – Form Builder for WordPress |
Version | 5.2.07 |
Comparing to | |
See all releases |
Code changes from version 5.2.06 to 5.2.07
- classes/helpers/FrmAppHelper.php +23 -1
- classes/models/fields/FrmFieldNumber.php +30 -7
- formidable.php +1 -1
- languages/formidable.pot +3 -3
- readme.txt +4 -5
classes/helpers/FrmAppHelper.php
CHANGED
@@ -11,7 +11,7 @@ class FrmAppHelper {
|
|
11 |
/**
|
12 |
* @since 2.0
|
13 |
*/
|
14 |
-
public static $plug_version = '5.2.
|
15 |
|
16 |
/**
|
17 |
* @since 1.07.02
|
@@ -3411,6 +3411,28 @@ class FrmAppHelper {
|
|
3411 |
echo '<span class="frm-new-pill">' . esc_html( $text ) . '</span>';
|
3412 |
}
|
3413 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3414 |
/**
|
3415 |
* @since 4.08
|
3416 |
* @deprecated 4.09.01
|
11 |
/**
|
12 |
* @since 2.0
|
13 |
*/
|
14 |
+
public static $plug_version = '5.2.07';
|
15 |
|
16 |
/**
|
17 |
* @since 1.07.02
|
3411 |
echo '<span class="frm-new-pill">' . esc_html( $text ) . '</span>';
|
3412 |
}
|
3413 |
|
3414 |
+
/**
|
3415 |
+
* Count the number of decimals digits.
|
3416 |
+
*
|
3417 |
+
* @since 5.2.07
|
3418 |
+
*
|
3419 |
+
* @param mixed $num Number.
|
3420 |
+
* @return int|false Returns `false` if the passed parameter is not number.
|
3421 |
+
*/
|
3422 |
+
public static function count_decimals( $num ) {
|
3423 |
+
if ( ! is_numeric( $num ) ) {
|
3424 |
+
return false;
|
3425 |
+
}
|
3426 |
+
|
3427 |
+
$num = (string) $num;
|
3428 |
+
$parts = explode( '.', $num );
|
3429 |
+
if ( 1 === count( $parts ) ) {
|
3430 |
+
return 0;
|
3431 |
+
}
|
3432 |
+
|
3433 |
+
return strlen( $parts[ count( $parts ) - 1 ] );
|
3434 |
+
}
|
3435 |
+
|
3436 |
/**
|
3437 |
* @since 4.08
|
3438 |
* @deprecated 4.09.01
|
classes/models/fields/FrmFieldNumber.php
CHANGED
@@ -95,22 +95,45 @@ class FrmFieldNumber extends FrmFieldType {
|
|
95 |
return;
|
96 |
}
|
97 |
|
98 |
-
$
|
99 |
-
$
|
100 |
-
$div = $value / $step;
|
101 |
-
if ( floor( $div ) === $div ) {
|
102 |
return;
|
103 |
}
|
104 |
|
105 |
-
$div = floor( $div );
|
106 |
$errors[ 'field' . $args['id'] ] = sprintf(
|
107 |
// Translators: %1$s: the first nearest value; %2$s: the second nearest value.
|
108 |
__( 'Please enter a valid value. Two nearest valid values are %1$s and %2$s', 'formidable' ),
|
109 |
-
floatval( $
|
110 |
-
floatval(
|
111 |
);
|
112 |
}
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
/**
|
115 |
* IE fallback for number fields
|
116 |
* Remove the comma when HTML5 isn't supported
|
95 |
return;
|
96 |
}
|
97 |
|
98 |
+
$result = $this->check_value_is_valid_with_step( $args['value'], $step );
|
99 |
+
if ( ! $result ) {
|
|
|
|
|
100 |
return;
|
101 |
}
|
102 |
|
|
|
103 |
$errors[ 'field' . $args['id'] ] = sprintf(
|
104 |
// Translators: %1$s: the first nearest value; %2$s: the second nearest value.
|
105 |
__( 'Please enter a valid value. Two nearest valid values are %1$s and %2$s', 'formidable' ),
|
106 |
+
floatval( $result[0] ),
|
107 |
+
floatval( $result[1] )
|
108 |
);
|
109 |
}
|
110 |
|
111 |
+
/**
|
112 |
+
* Checks if value is valid with the given step.
|
113 |
+
*
|
114 |
+
* @since 5.2.07
|
115 |
+
*
|
116 |
+
* @param numeric $value The value.
|
117 |
+
* @param numeric $step The step.
|
118 |
+
* @return int|array Return `0` if valid. Otherwise, return an array contains two nearest values.
|
119 |
+
*/
|
120 |
+
private function check_value_is_valid_with_step( $value, $step ) {
|
121 |
+
// Count the number of decimals.
|
122 |
+
$decimals = max( FrmAppHelper::count_decimals( $value ), FrmAppHelper::count_decimals( $step ) );
|
123 |
+
|
124 |
+
// Convert value and step to int to prevent precision problem.
|
125 |
+
$pow = pow( 10, $decimals );
|
126 |
+
$value = intval( $pow * $value );
|
127 |
+
$step = intval( $pow * $step );
|
128 |
+
$div = $value / $step;
|
129 |
+
if ( is_int( $div ) ) {
|
130 |
+
return 0;
|
131 |
+
}
|
132 |
+
|
133 |
+
$div = floor( $div );
|
134 |
+
return array( $div * $step / $pow, ( $div + 1 ) * $step / $pow );
|
135 |
+
}
|
136 |
+
|
137 |
/**
|
138 |
* IE fallback for number fields
|
139 |
* Remove the comma when HTML5 isn't supported
|
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: 5.2.
|
6 |
Plugin URI: https://formidableforms.com/
|
7 |
Author URI: https://formidableforms.com/
|
8 |
Author: Strategy11
|
2 |
/*
|
3 |
Plugin Name: Formidable Forms
|
4 |
Description: Quickly and easily create drag-and-drop forms
|
5 |
+
Version: 5.2.07
|
6 |
Plugin URI: https://formidableforms.com/
|
7 |
Author URI: https://formidableforms.com/
|
8 |
Author: Strategy11
|
languages/formidable.pot
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
# This file is distributed under the same license as the Formidable Forms plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Formidable Forms 5.2.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/formidable\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2022-05-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: formidable\n"
|
@@ -3805,7 +3805,7 @@ msgid "Please select a lower number"
|
|
3805 |
msgstr ""
|
3806 |
|
3807 |
#. Translators: %1$s: the first nearest value; %2$s: the second nearest value.
|
3808 |
-
#: classes/models/fields/FrmFieldNumber.php:
|
3809 |
msgid "Please enter a valid value. Two nearest valid values are %1$s and %2$s"
|
3810 |
msgstr ""
|
3811 |
|
2 |
# This file is distributed under the same license as the Formidable Forms plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Formidable Forms 5.2.07\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/formidable\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2022-05-10T17:46:05+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: formidable\n"
|
3805 |
msgstr ""
|
3806 |
|
3807 |
#. Translators: %1$s: the first nearest value; %2$s: the second nearest value.
|
3808 |
+
#: classes/models/fields/FrmFieldNumber.php:105
|
3809 |
msgid "Please enter a valid value. Two nearest valid values are %1$s and %2$s"
|
3810 |
msgstr ""
|
3811 |
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: forms, contact form, form builder, survey, free, form maker, form creator,
|
|
5 |
Requires at least: 5.2
|
6 |
Tested up to: 5.9.3
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 5.2.
|
9 |
|
10 |
The most advanced WordPress forms plugin. Go beyond contact forms with our drag & drop form builder for surveys, quizzes, and more.
|
11 |
|
@@ -438,6 +438,9 @@ Using our Zapier integration, you can easily connect Formidable with over 1000+
|
|
438 |
See all <a href="https://zapier.com/apps/formidable/integrations">Formidable Zapier Integrations</a>.
|
439 |
|
440 |
== Changelog ==
|
|
|
|
|
|
|
441 |
= 5.2.06 =
|
442 |
* New: The step value for number fields is now validated server side on submission.
|
443 |
|
@@ -445,8 +448,4 @@ See all <a href="https://zapier.com/apps/formidable/integrations">Formidable Zap
|
|
445 |
* New: Added a new frm_focus_first_error filter to toggle of the behavior of the auto-focus that gets triggered on the first field with an error.
|
446 |
* New: Added a new frm_include_alert_role_on_field_errors filter to toggle the alert role that gets added to field errors.
|
447 |
|
448 |
-
= 5.2.04 =
|
449 |
-
* New: Defined field option data will no longer be sent to Akismet, to help improve accuracy with Akismet API.
|
450 |
-
* Fix: Updated Elementor widget so it no longer uses the deprecated _register_controls method.
|
451 |
-
|
452 |
<a href="https://raw.githubusercontent.com/Strategy11/formidable-forms/master/changelog.txt">See changelog for all versions</a>
|
5 |
Requires at least: 5.2
|
6 |
Tested up to: 5.9.3
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 5.2.07
|
9 |
|
10 |
The most advanced WordPress forms plugin. Go beyond contact forms with our drag & drop form builder for surveys, quizzes, and more.
|
11 |
|
438 |
See all <a href="https://zapier.com/apps/formidable/integrations">Formidable Zapier Integrations</a>.
|
439 |
|
440 |
== Changelog ==
|
441 |
+
= 5.2.07 =
|
442 |
+
* Fix: Step value validation was occasionally breaking in some cases due to rounding precision issues.
|
443 |
+
|
444 |
= 5.2.06 =
|
445 |
* New: The step value for number fields is now validated server side on submission.
|
446 |
|
448 |
* New: Added a new frm_focus_first_error filter to toggle of the behavior of the auto-focus that gets triggered on the first field with an error.
|
449 |
* New: Added a new frm_include_alert_role_on_field_errors filter to toggle the alert role that gets added to field errors.
|
450 |
|
|
|
|
|
|
|
|
|
451 |
<a href="https://raw.githubusercontent.com/Strategy11/formidable-forms/master/changelog.txt">See changelog for all versions</a>
|