r60393 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60392‎ | r60393 | r60394 >
Date:16:30, 25 December 2009
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Validator 0.2 rc2.
Modified paths:
  • /trunk/extensions/Validator/Validator.class.php (modified) (history)
  • /trunk/extensions/Validator/Validator.php (modified) (history)
  • /trunk/extensions/Validator/Validator_Formats.php (modified) (history)
  • /trunk/extensions/Validator/Validator_Functions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Validator/Validator.class.php
@@ -235,7 +235,7 @@
236236 $this->parameterInfo[$name]['criteria']['in_array'] = array('yes', 'no', 'on', 'off');
237237 break;
238238 case 'char':
239 - $this->parameterInfo[$name]['criteria']['has_length'] = array(1);
 239+ $this->parameterInfo[$name]['criteria']['has_length'] = array(1, 1);
240240 break;
241241 }
242242 }
@@ -246,6 +246,10 @@
247247 $value = preg_replace('/((\s)*' . $delimiter . '(\s)*)/', $delimiter, $value);
248248 $value = explode($delimiter, $value);
249249 }
 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+ }
250254 else {
251255 // Trimming of non-list values.
252256 $value = trim ($value);
Index: trunk/extensions/Validator/Validator_Functions.php
@@ -120,6 +120,6 @@
121121 * @return boolean
122122 */
123123 public static function regex( $value, $pattern ) {
124 - return preg_match($pattern, $value);
 124+ return (bool)preg_match($pattern, $value);
125125 }
126126 }
Index: trunk/extensions/Validator/Validator_Formats.php
@@ -31,7 +31,7 @@
3232 }
3333
3434 /**
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,
3636 * and/or adding wrappers before and after the items. Intended for lists, but
3737 * will also work for single values.
3838 *
Index: trunk/extensions/Validator/Validator.php
@@ -24,7 +24,7 @@
2525 die( 'Not an entry point.' );
2626 }
2727
28 -define( 'Validator_VERSION', '0.2 rc1' );
 28+define( 'Validator_VERSION', '0.2 rc2' );
2929
3030 // Constants indicating the strictness of the parameter validation.
3131 define( 'Validator_ERRORS_NONE', 0 );

Status & tagging log