Index: trunk/extensions/Validator/includes/criteria/CriterionMatchesRegex.php |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | * @see ItemParameterCriterion::getItemErrorMessage |
48 | 48 | */ |
49 | 49 | protected function getItemErrorMessage( Parameter $parameter ) { |
50 | | - return wfMsgExt( 'validator_error_invalid_argument', 'parsemag', $parameter->value, $parameter->getOriginalName() ); |
| 50 | + return wfMsgExt( 'validator_error_invalid_argument', 'parsemag', $parameter->getValue(), $parameter->getOriginalName() ); |
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
Index: trunk/extensions/Validator/includes/criteria/CriterionInArray.php |
— | — | @@ -58,14 +58,30 @@ |
59 | 59 | protected function getItemErrorMessage( Parameter $parameter ) { |
60 | 60 | global $wgLang; |
61 | 61 | |
62 | | - return wfMsgExt( |
63 | | - 'validator_error_accepts_only', |
64 | | - 'parsemag', |
65 | | - $parameter->getOriginalName(), |
66 | | - $wgLang->listToText( $this->allowedValues ), |
67 | | - count( $this->allowedValues ), |
68 | | - $parameter->value |
69 | | - ); |
| 62 | + $values = $parameter->getValue(); |
| 63 | + $originalCount = count( $this->allowedValues ); |
| 64 | + |
| 65 | + if ( $originalCount > 15 ) { |
| 66 | + $allowedValues = array_slice( $this->allowedValues, 0, 13 ); |
| 67 | + return wfMsgExt( |
| 68 | + 'validator-error-accepts-only-omitted', |
| 69 | + 'parsemag', |
| 70 | + $parameter->getOriginalName(), |
| 71 | + $parameter->getValue(), |
| 72 | + $wgLang->listToText( $allowedValues ), |
| 73 | + $originalCount - count( $allowedValues ) |
| 74 | + ); |
| 75 | + } |
| 76 | + else { |
| 77 | + return wfMsgExt( |
| 78 | + 'validator_error_accepts_only', |
| 79 | + 'parsemag', |
| 80 | + $parameter->getOriginalName(), |
| 81 | + $wgLang->listToText( $this->allowedValues ), |
| 82 | + count( $this->allowedValues ), |
| 83 | + $parameter->getValue() |
| 84 | + ); |
| 85 | + } |
70 | 86 | } |
71 | 87 | |
72 | 88 | /** |
Index: trunk/extensions/Validator/includes/criteria/CriterionItemCount.php |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | * @see ParameterCriterion::validate |
37 | 37 | */ |
38 | 38 | public function validate( Parameter $parameter ) { |
39 | | - $count = count( $parameter->value ); |
| 39 | + $count = count( $parameter->getValue() ); |
40 | 40 | return $count <= $this->upperBound && $count >= $this->lowerBound; |
41 | 41 | } |
42 | 42 | |
Index: trunk/extensions/Validator/includes/criteria/CriterionUniqueItems.php |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | * @see ParameterCriterion::validate |
28 | 28 | */ |
29 | 29 | public function validate( Parameter $parameter ) { |
30 | | - return count( $parameter->value ) == count( array_unique( $parameter->value ) ); |
| 30 | + return count( $parameter->getValue() ) == count( array_unique( $parameter->getValue() ) ); |
31 | 31 | } |
32 | 32 | |
33 | 33 | } |
\ No newline at end of file |
Index: trunk/extensions/Validator/Validator.i18n.php |
— | — | @@ -60,6 +60,7 @@ |
61 | 61 | |
62 | 62 | // Criteria errors for single values & lists |
63 | 63 | 'validator_error_accepts_only' => 'The value "$4" is not valid for parameter $1. It only accepts {{PLURAL:$3|this value|these values}}: $2.', |
| 64 | + 'validator-error-accepts-only-omitted' => 'The value "$2" is not valid for parameter $1. It only accepts these values: $3 (and $4 omitted values).' |
64 | 65 | ); |
65 | 66 | |
66 | 67 | /** Message documentation (Message documentation) |