Index: trunk/extensions/Validator/Validator.class.php |
— | — | @@ -235,7 +235,7 @@ |
236 | 236 | $this->parameterInfo[$name]['criteria']['in_array'] = array('yes', 'no', 'on', 'off'); |
237 | 237 | break; |
238 | 238 | case 'char': |
239 | | - $this->parameterInfo[$name]['criteria']['has_length'] = array(1); |
| 239 | + $this->parameterInfo[$name]['criteria']['has_length'] = array(1, 1); |
240 | 240 | break; |
241 | 241 | } |
242 | 242 | } |
— | — | @@ -246,6 +246,10 @@ |
247 | 247 | $value = preg_replace('/((\s)*' . $delimiter . '(\s)*)/', $delimiter, $value); |
248 | 248 | $value = explode($delimiter, $value); |
249 | 249 | } |
| 250 | + elseif (count($this->parameterInfo[$name]['type']) > 1 && $this->parameterInfo[$name]['type'][1] == 'array' && is_array($value)) { |
| 251 | + // Trimming of array values. |
| 252 | + for($i = count($value); $i > 0; $i--) $value[$i] = trim ($value[$i]); |
| 253 | + } |
250 | 254 | else { |
251 | 255 | // Trimming of non-list values. |
252 | 256 | $value = trim ($value); |
Index: trunk/extensions/Validator/Validator_Functions.php |
— | — | @@ -120,6 +120,6 @@ |
121 | 121 | * @return boolean |
122 | 122 | */ |
123 | 123 | public static function regex( $value, $pattern ) { |
124 | | - return preg_match($pattern, $value); |
| 124 | + return (bool)preg_match($pattern, $value); |
125 | 125 | } |
126 | 126 | } |
Index: trunk/extensions/Validator/Validator_Formats.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | }
|
33 | 33 |
|
34 | 34 | /**
|
35 | | - * Changes the value to list notation, by seperating items with a delimiter,
|
| 35 | + * Changes the value to list notation, by separating items with a delimiter,
|
36 | 36 | * and/or adding wrappers before and after the items. Intended for lists, but
|
37 | 37 | * will also work for single values.
|
38 | 38 | *
|
Index: trunk/extensions/Validator/Validator.php |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | die( 'Not an entry point.' ); |
26 | 26 | } |
27 | 27 | |
28 | | -define( 'Validator_VERSION', '0.2 rc1' ); |
| 28 | +define( 'Validator_VERSION', '0.2 rc2' ); |
29 | 29 | |
30 | 30 | // Constants indicating the strictness of the parameter validation. |
31 | 31 | define( 'Validator_ERRORS_NONE', 0 ); |