- WordPress 6.9.4 (es_ES) with Kadence theme - Homepage: Hero, La Asociación, Pilares, Beneficios, Eventos, Miembros, Hazte Miembro, Contacto - Brand identity: #13294b navy, #a12932 burgundy, #c69c48 gold - Fonts: Raleway (headings) + Source Sans 3 (body) + Lato (UI) - Plugins: Kadence Blocks, Polylang, Contact Form 7 - Custom CSS with full brand styling and responsive layout - HTTPS enforced via wp-config.php proxy detection
43 lines
782 B
PHP
43 lines
782 B
PHP
<?php
|
|
|
|
namespace Contactable\SWV;
|
|
|
|
class MinNumberRule extends Rule {
|
|
|
|
const rule_name = 'minnumber';
|
|
|
|
public function matches( $context ) {
|
|
if ( false === parent::matches( $context ) ) {
|
|
return false;
|
|
}
|
|
|
|
if ( empty( $context['text'] ) ) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public function validate( $context ) {
|
|
$input = $this->get_default_input();
|
|
$input = wpcf7_array_flatten( $input );
|
|
$input = wpcf7_strip_whitespaces( $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 $this->create_error();
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
}
|