24 public static $TRUEVALS = [
'true',
't',
'yes',
'y',
'on',
'1' ];
25 public static $FALSEVALS = [
'false',
'f',
'no',
'n',
'off',
'0' ];
27 public function validate( $name, $value, array $settings, array $options ) {
28 $value = strtolower( $value );
29 if ( in_array( $value, self::$TRUEVALS,
true ) ) {
32 if ( $value ===
'' || in_array( $value, self::$FALSEVALS,
true ) ) {
37 'truevals' => self::$TRUEVALS,
38 'falsevals' => array_merge( self::$FALSEVALS, [
'the empty string' ] ),
42 public function stringifyValue( $name, $value, array $settings, array $options ) {
43 return $value ? self::$TRUEVALS[0] : self::$FALSEVALS[0];