PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.22
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.22
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/fields/FrmFieldNumber.php +2 -16 6.266.22 View file →
@@ -9,9 +9,8 @@
9 9 class FrmFieldNumber extends FrmFieldType {
10 10
11 11 /**
12 12 * @var string
13 - *
14 13 * @since 3.0
15 14 */
16 15 protected $type = 'number';
17 16
@@ -49,11 +48,8 @@
49 48
50 49 /**
51 50 * @since 3.01.03
52 51 *
53 - * @param array $args
54 - * @param string $input_html
55 - *
56 52 * @return void
57 53 */
58 54 protected function add_extra_html_atts( $args, &$input_html ) {
59 55 $this->add_min_max( $args, $input_html );
@@ -104,15 +100,13 @@
104 100 return;
105 101 }
106 102
107 103 $step = FrmField::get_option( $this->field, 'step' );
108 -
109 104 if ( ! $step || ! is_numeric( $step ) ) {
110 105 return;
111 106 }
112 107
113 108 $result = $this->check_value_is_valid_with_step( $args['value'], $step );
114 -
115 109 if ( ! $result ) {
116 110 return;
117 111 }
118 112
@@ -130,21 +124,19 @@
130 124 * @since 5.2.07
131 125 *
132 126 * @param numeric $value The value.
133 127 * @param numeric $step The step.
134 - *
135 128 * @return array|int Return `0` if valid. Otherwise, return an array contains two nearest values.
136 129 */
137 130 protected function check_value_is_valid_with_step( $value, $step ) {
138 131 // Count the number of decimals.
139 - $decimals = (int) max( FrmAppHelper::count_decimals( $value ), FrmAppHelper::count_decimals( $step ) );
132 + $decimals = max( FrmAppHelper::count_decimals( $value ), FrmAppHelper::count_decimals( $step ) );
140 133
141 134 // Convert value and step to int to prevent precision problem.
142 - $pow = 10 ** $decimals;
135 + $pow = pow( 10, $decimals );
143 136 $value = intval( $pow * $value );
144 137 $step = intval( $pow * $step );
145 138 $div = $value / $step;
146 -
147 139 if ( is_int( $div ) ) {
148 140 return 0;
149 141 }
150 142
@@ -170,12 +162,8 @@
170 162 }
171 163
172 164 /**
173 165 * Force the value to be numeric before it's saved in the DB
174 - *
175 - * @param array|string $value
176 - *
177 - * @return float
178 166 */
179 167 public function set_value_before_save( $value ) {
180 168 if ( ! is_numeric( $value ) ) {
181 169 $value = (float) $value;
@@ -185,10 +173,8 @@
185 173 }
186 174
187 175 /**
188 176 * @since 4.0.04
189 - *
190 - * @param array|string $value
191 177 *
192 178 * @return void
193 179 */
194 180 public function sanitize_value( &$value ) {