Index: trunk/extensions/Validator/RELEASE-NOTES |
— | — | @@ -4,6 +4,11 @@ |
5 | 5 | This change log contains a list of completed to-do's (new features, bug fixes, refactoring) for every version of Validator. |
6 | 6 | |
7 | 7 | |
| 8 | +=== Validator 0.4.11 === |
| 9 | +(2011-09-xx) |
| 10 | + |
| 11 | +* Fixed compatibility fallback in Parameter::getDescription. |
| 12 | + |
8 | 13 | === Validator 0.4.10 === |
9 | 14 | (2011-08-04) |
10 | 15 | |
Index: trunk/extensions/Validator/includes/Parameter.php |
— | — | @@ -196,8 +196,8 @@ |
197 | 197 | * |
198 | 198 | * @var mixed string or false |
199 | 199 | */ |
| 200 | + |
200 | 201 | protected $message = false; |
201 | | - |
202 | 202 | /** |
203 | 203 | * Constructor. |
204 | 204 | * |
— | — | @@ -783,7 +783,12 @@ |
784 | 784 | * @return mixed string or false |
785 | 785 | */ |
786 | 786 | public function getDescription() { |
787 | | - return $this->description; |
| 787 | + if ( $this->description === false and $this->message !== false ) { |
| 788 | + return wfMsg( $this->message ); |
| 789 | + } |
| 790 | + else { |
| 791 | + return $this->description; |
| 792 | + } |
788 | 793 | } |
789 | 794 | |
790 | 795 | /** |
Index: trunk/extensions/Validator/includes/Validator.php |
— | — | @@ -159,12 +159,10 @@ |
160 | 160 | * for unknown parameters and optionally for parameter overriding. |
161 | 161 | * |
162 | 162 | * @param array $parameters Parameter name as key, parameter value as value |
163 | | - * @param array $parameterInfo Main parameter name as key, parameter meta data as value |
| 163 | + * @param array $parameterInfo List of Parameter objects |
164 | 164 | * @param boolean $toLower Indicates if the parameter values should be put to lower case. Defaults to true. |
165 | 165 | */ |
166 | 166 | public function setParameters( array $parameters, array $parameterInfo, $toLower = true ) { |
167 | | - $this->cleanParameterInfo( $parameterInfo ); |
168 | | - |
169 | 167 | $this->parameters = $parameterInfo; |
170 | 168 | |
171 | 169 | // Loop through all the user provided parameters, and distinguish between those that are allowed and those that are not. |
— | — | @@ -210,29 +208,6 @@ |
211 | 209 | } |
212 | 210 | |
213 | 211 | /** |
214 | | - * Ensures all elements of the array are Parameter objects, |
215 | | - * and that the array keys match the main parameter name. |
216 | | - * |
217 | | - * @since 0.4 |
218 | | - * |
219 | | - * @param array $paramInfo |
220 | | - */ |
221 | | - protected function cleanParameterInfo( array &$paramInfo ) { |
222 | | - $cleanedList = array(); |
223 | | - |
224 | | - foreach ( $paramInfo as $key => $parameter ) { |
225 | | - if ( $parameter instanceof Parameter ) { |
226 | | - $cleanedList[$parameter->getName()] = $parameter; |
227 | | - } |
228 | | - else { |
229 | | - throw new Exception( "$key is not a valid Parameter." ); |
230 | | - } |
231 | | - } |
232 | | - |
233 | | - $paramInfo = $cleanedList; |
234 | | - } |
235 | | - |
236 | | - /** |
237 | 212 | * Validates and formats all the parameters (but aborts when a fatal error occurs). |
238 | 213 | * |
239 | 214 | * @since 0.4 |
Index: trunk/extensions/Validator/Validator.php |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | die( 'Not an entry point.' ); |
27 | 27 | } |
28 | 28 | |
29 | | -define( 'Validator_VERSION', '0.4.10' ); |
| 29 | +define( 'Validator_VERSION', '0.4.11 alpha' ); |
30 | 30 | |
31 | 31 | // Register the internationalization file. |
32 | 32 | $wgExtensionMessagesFiles['Validator'] = dirname( __FILE__ ) . '/Validator.i18n.php'; |