Index: trunk/extensions/Validator/includes/ValidationErrorHandler.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | * |
19 | 19 | * @var array of ValidationError |
20 | 20 | */ |
21 | | - protected static $errors; |
| 21 | + protected static $errors = array(); |
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Adds a single ValidationError. |
Index: trunk/extensions/Validator/includes/ListParameter.php |
— | — | @@ -113,6 +113,12 @@ |
114 | 114 | protected function cleanValue() { |
115 | 115 | $this->value = explode( $this->delimiter, $this->originalValue ); |
116 | 116 | |
| 117 | + if ( $this->trimValue ) { |
| 118 | + foreach ( $this->value as &$item ) { |
| 119 | + $item = trim( $item ); |
| 120 | + } |
| 121 | + } |
| 122 | + |
117 | 123 | if ( $this->lowerCaseValue ) { |
118 | 124 | foreach ( $this->value as &$item ) { |
119 | 125 | $item = strtolower( $item ); |
Index: trunk/extensions/Validator/includes/Parameter.php |
— | — | @@ -49,6 +49,15 @@ |
50 | 50 | public $lowerCaseValue = true; |
51 | 51 | |
52 | 52 | /** |
| 53 | + * Indicates if the parameter value should trimmed. |
| 54 | + * |
| 55 | + * @since 0.4 |
| 56 | + * |
| 57 | + * @var boolean |
| 58 | + */ |
| 59 | + public $trimValue = true; |
| 60 | + |
| 61 | + /** |
53 | 62 | * Dependency list containing parameters that need to be handled before this one. |
54 | 63 | * |
55 | 64 | * @since 0.4 |
— | — | @@ -415,6 +424,10 @@ |
416 | 425 | protected function cleanValue() { |
417 | 426 | $this->value = $this->originalValue; |
418 | 427 | |
| 428 | + if ( $this->trimValue ) { |
| 429 | + $this->value = trim( $this->value ); |
| 430 | + } |
| 431 | + |
419 | 432 | if ( $this->lowerCaseValue ) { |
420 | 433 | $this->value = strtolower( $this->value ); |
421 | 434 | } |
Index: trunk/extensions/Validator/Validator.i18n.php |
— | — | @@ -18,9 +18,9 @@ |
19 | 19 | 'validator-desc' => 'Provides generic parameter handling support for other extensions', |
20 | 20 | |
21 | 21 | // General |
22 | | - 'validator-warning' => "'''Warning:''' $1", |
23 | | - 'validator-error' => "'''Error:''' $1", |
24 | | - 'validator-fatal-error' => "Fatal error: $1", |
| 22 | + 'validator-warning' => 'Warning: $1', |
| 23 | + 'validator-error' => 'Error: $1', |
| 24 | + 'validator-fatal-error' => 'Fatal error: $1', |
25 | 25 | 'validator_error_parameters' => 'The following {{PLURAL:$1|error has|errors have}} been detected in your syntax:', |
26 | 26 | 'validator_warning_parameters' => 'There {{PLURAL:$1|is an error|are errors}} in your syntax.', |
27 | 27 | 'validator-warning-adittional-errors' => '... and {{PLURAL:$1|one more issue|multiple more issues}}.', |