WPCF7_SWV_MinNumberRule::validate()
Метод класса: WPCF7_SWV_MinNumberRule{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$WPCF7_SWV_MinNumberRule = new WPCF7_SWV_MinNumberRule(); $WPCF7_SWV_MinNumberRule->validate( $context );
- $context (обязательный)
- -
Код WPCF7_SWV_MinNumberRule::validate() WPCF7 SWV MinNumberRule::validate CF7 5.8
public function validate( $context ) { $field = $this->get_property( 'field' ); $input = isset( $_POST[$field] ) ? $_POST[$field] : ''; $input = wpcf7_array_flatten( $input ); $input = wpcf7_exclude_blank( $input ); $threshold = $this->get_property( 'threshold' ); if ( ! wpcf7_is_number( $threshold ) ) { return true; } foreach ( $input as $i ) { if ( wpcf7_is_number( $i ) and (float) $i < (float) $threshold ) { return new WP_Error( 'wpcf7_invalid_minnumber', $this->get_property( 'error' ) ); } } return true; }