| @@ -14,13 +14,8 @@ | ||
| 14 | 14 | */ |
| 15 | 15 | protected $type = 'number'; |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | - * @var string | |
| 19 | - */ | |
| 20 | - protected $display_type = 'text'; | |
| 21 | - | |
| 22 | - /** | |
| 23 | 18 | * @var bool |
| 24 | 19 | */ |
| 25 | 20 | protected $array_allowed = false; |
| 26 | 21 | |
| @@ -34,12 +29,9 @@ | ||
| 34 | 29 | 'invalid' => true, |
| 35 | 30 | 'range' => true, |
| 36 | 31 | ); |
| 37 | 32 | |
| 38 | - $frm_settings = FrmAppHelper::get_settings(); | |
| 39 | - if ( $frm_settings->use_html ) { | |
| 40 | - $settings['max'] = false; | |
| 41 | - } | |
| 33 | + $settings['max'] = false; | |
| 42 | 34 | |
| 43 | 35 | return $settings; |
| 44 | 36 | } |
| 45 | 37 | |
| @@ -67,9 +59,9 @@ | ||
| 67 | 59 | $errors = array(); |
| 68 | 60 | |
| 69 | 61 | $this->remove_commas_from_number( $args ); |
| 70 | 62 | |
| 71 | - //validate the number format | |
| 63 | + // Validate the number format. | |
| 72 | 64 | if ( ! is_numeric( $args['value'] ) && '' !== $args['value'] ) { |
| 73 | 65 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
| 74 | 66 | } |
| 75 | 67 | |
| @@ -74,13 +66,12 @@ | ||
| 74 | 66 | } |
| 75 | 67 | |
| 76 | 68 | // validate number settings |
| 77 | 69 | if ( $args['value'] != '' ) { |
| 78 | - $frm_settings = FrmAppHelper::get_settings(); | |
| 79 | 70 | // only check if options are available in settings |
| 80 | 71 | $minnum = FrmField::get_option( $this->field, 'minnum' ); |
| 81 | 72 | $maxnum = FrmField::get_option( $this->field, 'maxnum' ); |
| 82 | - if ( $frm_settings->use_html && $maxnum !== '' && $minnum !== '' ) { | |
| 73 | + if ( $maxnum !== '' && $minnum !== '' ) { | |
| 83 | 74 | $value = (float) $args['value']; |
| 84 | 75 | if ( $value < $minnum ) { |
| 85 | 76 | $errors[ 'field' . $args['id'] ] = __( 'Please select a higher number', 'formidable' ); |
| 86 | 77 | } elseif ( $value > $maxnum ) { |
| @@ -105,9 +96,10 @@ | ||
| 105 | 96 | * @return void |
| 106 | 97 | */ |
| 107 | 98 | private function validate_step( &$errors, $args ) { |
| 108 | 99 | if ( isset( $errors[ 'field' . $args['id'] ] ) ) { |
| 109 | - return; // Don't need to check if value is invalid before. | |
| 100 | + // Don't need to check if value is invalid before. | |
| 101 | + return; | |
| 110 | 102 | } |
| 111 | 103 | |
| 112 | 104 | $step = FrmField::get_option( $this->field, 'step' ); |
| 113 | 105 | if ( ! $step || ! is_numeric( $step ) ) { |
| @@ -133,9 +125,9 @@ | ||
| 133 | 125 | * @since 5.2.07 |
| 134 | 126 | * |
| 135 | 127 | * @param numeric $value The value. |
| 136 | 128 | * @param numeric $step The step. |
| 137 | - * @return int|array Return `0` if valid. Otherwise, return an array contains two nearest values. | |
| 129 | + * @return array|int Return `0` if valid. Otherwise, return an array contains two nearest values. | |
| 138 | 130 | */ |
| 139 | 131 | private function check_value_is_valid_with_step( $value, $step ) { |
| 140 | 132 | // Count the number of decimals. |
| 141 | 133 | $decimals = max( FrmAppHelper::count_decimals( $value ), FrmAppHelper::count_decimals( $step ) ); |