r74598 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74597‎ | r74598 | r74599 >
Date:15:32, 10 October 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.4 - Fixed trimming issue for list parameters, small i18n fail and initialization value of the error list
Modified paths:
  • /trunk/extensions/Validator/Validator.i18n.php (modified) (history)
  • /trunk/extensions/Validator/includes/ListParameter.php (modified) (history)
  • /trunk/extensions/Validator/includes/Parameter.php (modified) (history)
  • /trunk/extensions/Validator/includes/ValidationErrorHandler.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Validator/includes/ValidationErrorHandler.php
@@ -17,7 +17,7 @@
1818 *
1919 * @var array of ValidationError
2020 */
21 - protected static $errors;
 21+ protected static $errors = array();
2222
2323 /**
2424 * Adds a single ValidationError.
Index: trunk/extensions/Validator/includes/ListParameter.php
@@ -113,6 +113,12 @@
114114 protected function cleanValue() {
115115 $this->value = explode( $this->delimiter, $this->originalValue );
116116
 117+ if ( $this->trimValue ) {
 118+ foreach ( $this->value as &$item ) {
 119+ $item = trim( $item );
 120+ }
 121+ }
 122+
117123 if ( $this->lowerCaseValue ) {
118124 foreach ( $this->value as &$item ) {
119125 $item = strtolower( $item );
Index: trunk/extensions/Validator/includes/Parameter.php
@@ -49,6 +49,15 @@
5050 public $lowerCaseValue = true;
5151
5252 /**
 53+ * Indicates if the parameter value should trimmed.
 54+ *
 55+ * @since 0.4
 56+ *
 57+ * @var boolean
 58+ */
 59+ public $trimValue = true;
 60+
 61+ /**
5362 * Dependency list containing parameters that need to be handled before this one.
5463 *
5564 * @since 0.4
@@ -415,6 +424,10 @@
416425 protected function cleanValue() {
417426 $this->value = $this->originalValue;
418427
 428+ if ( $this->trimValue ) {
 429+ $this->value = trim( $this->value );
 430+ }
 431+
419432 if ( $this->lowerCaseValue ) {
420433 $this->value = strtolower( $this->value );
421434 }
Index: trunk/extensions/Validator/Validator.i18n.php
@@ -18,9 +18,9 @@
1919 'validator-desc' => 'Provides generic parameter handling support for other extensions',
2020
2121 // 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',
2525 'validator_error_parameters' => 'The following {{PLURAL:$1|error has|errors have}} been detected in your syntax:',
2626 'validator_warning_parameters' => 'There {{PLURAL:$1|is an error|are errors}} in your syntax.',
2727 'validator-warning-adittional-errors' => '... and {{PLURAL:$1|one more issue|multiple more issues}}.',

Status & tagging log