Index: trunk/extensions/Validator/RELEASE-NOTES |
— | — | @@ -3,7 +3,10 @@ |
4 | 4 | == Validator change log == |
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 | +=== Validator 0.4.14 === |
7 | 8 | |
| 9 | +* New built-in parameter type 'Title'. Accepts existing and non-existing page titles which are valid within the wiki. |
| 10 | + |
8 | 11 | === Validator 0.4.13 === |
9 | 12 | (2011-11-30) |
10 | 13 | |
Index: trunk/extensions/Validator/includes/Parameter.php |
— | — | @@ -19,6 +19,7 @@ |
20 | 20 | const TYPE_FLOAT = 'float'; |
21 | 21 | const TYPE_BOOLEAN = 'boolean'; |
22 | 22 | const TYPE_CHAR = 'char'; |
| 23 | + const TYPE_TITLE = 'Title'; // since 0.4.14 |
23 | 24 | |
24 | 25 | /** |
25 | 26 | * Indicates whether parameters that are provided more then once should be accepted, |
— | — | @@ -618,6 +619,9 @@ |
619 | 620 | case self::TYPE_CHAR: |
620 | 621 | $criteria[] = new CriterionHasLength( 1, 1 ); |
621 | 622 | break; |
| 623 | + case self::TYPE_TITLE: |
| 624 | + $criteria[] = new CriterionIsTitle(); |
| 625 | + break; |
622 | 626 | case self::TYPE_STRING: default: |
623 | 627 | // No extra criteria for strings. |
624 | 628 | break; |
— | — | @@ -646,9 +650,11 @@ |
647 | 651 | case self::TYPE_BOOLEAN: |
648 | 652 | $manipulations[] = new ParamManipulationBoolean(); |
649 | 653 | break; |
| 654 | + case self::TYPE_TITLE: |
| 655 | + $manipulations[] = new ParamManipulationTitle(); |
| 656 | + break; |
650 | 657 | case self::TYPE_CHAR: case self::TYPE_STRING: default: |
651 | 658 | $manipulations[] = new ParamManipulationString(); |
652 | | - break; |
653 | 659 | } |
654 | 660 | |
655 | 661 | return $manipulations; |
Index: trunk/extensions/Validator/Validator.i18n.php |
— | — | @@ -14,6 +14,7 @@ |
15 | 15 | |
16 | 16 | /** English |
17 | 17 | * @author Jeroen De Dauw |
| 18 | + * @author Daniel Werner |
18 | 19 | */ |
19 | 20 | $messages['en'] = array( |
20 | 21 | 'validator-desc' => 'Provides generic parameter handling support for other extensions', |
— | — | @@ -87,6 +88,8 @@ |
88 | 89 | 'validator_error_empty_argument' => 'Parameter $1 can not have an empty value.', |
89 | 90 | 'validator_error_must_be_number' => 'Parameter $1 can only be a number.', |
90 | 91 | 'validator_error_must_be_integer' => 'Parameter $1 can only be an integer.', |
| 92 | + 'validator_error_must_be_title' => 'Parameter $1 can only be a valid wiki page name.', |
| 93 | + 'validator_error_must_be_existing_title' => 'Parameter $1 can only be an existing wiki page name.', |
91 | 94 | 'validator-error-must-be-float' => 'Parameter $1 can only be a floating point number.', |
92 | 95 | 'validator_error_invalid_range' => 'Parameter $1 must be between $2 and $3.', |
93 | 96 | 'validator-error-invalid-regex' => 'Parameter $1 must match this regular expression: $2.', |
— | — | @@ -98,6 +101,8 @@ |
99 | 102 | 'validator_list_error_empty_argument' => 'Parameter $1 does not accept empty values.', |
100 | 103 | 'validator_list_error_must_be_number' => 'Parameter $1 can only contain numbers.', |
101 | 104 | 'validator_list_error_must_be_integer' => 'Parameter $1 can only contain integers.', |
| 105 | + 'validator_list_error_must_be_title' => 'Parameter $1 can only contain valid wiki page names.', |
| 106 | + 'validator_list_error_must_be_existing_title' => 'Parameter $1 can only contain existing wiki page names.', |
102 | 107 | 'validator-list-error-must-be-float' => 'Parameter $1 can only contain floats.', |
103 | 108 | 'validator_list_error_invalid_range' => 'All values of parameter $1 must be between $2 and $3.', |
104 | 109 | 'validator-list-error-invalid-regex' => 'All values of parameter $1 must match this regular expression: $2.', |
Index: trunk/extensions/Validator/Validator.php |
— | — | @@ -48,48 +48,51 @@ |
49 | 49 | 'descriptionmsg' => 'validator-desc', |
50 | 50 | ); |
51 | 51 | |
| 52 | +$incDir = dirname( __FILE__ ) . '/includes/'; |
| 53 | + |
52 | 54 | // Autoload the classes. |
53 | | -$wgAutoloadClasses['ValidatorHooks'] = dirname( __FILE__ ) . '/Validator.hooks.php'; |
| 55 | +$wgAutoloadClasses['ValidatorHooks'] = $incDir . '../Validator.hooks.php'; |
54 | 56 | |
55 | | -$incDir = dirname( __FILE__ ) . '/includes/'; |
56 | | -$wgAutoloadClasses['CriterionValidationResult'] = $incDir . 'CriterionValidationResult.php'; |
57 | | -$wgAutoloadClasses['ItemParameterCriterion'] = $incDir . 'ItemParameterCriterion.php'; |
58 | | -$wgAutoloadClasses['ItemParameterManipulation'] = $incDir . 'ItemParameterManipulation.php'; |
59 | | -$wgAutoloadClasses['ListParameter'] = $incDir . 'ListParameter.php'; |
60 | | -$wgAutoloadClasses['ListParameterCriterion'] = $incDir . 'ListParameterCriterion.php'; |
61 | | -$wgAutoloadClasses['ListParameterManipulation'] = $incDir . 'ListParameterManipulation.php'; |
62 | | -$wgAutoloadClasses['Parameter'] = $incDir . 'Parameter.php'; |
63 | | -$wgAutoloadClasses['ParameterCriterion'] = $incDir . 'ParameterCriterion.php'; |
64 | | -$wgAutoloadClasses['ParameterInput'] = $incDir . 'ParameterInput.php'; |
65 | | -$wgAutoloadClasses['ParameterManipulation'] = $incDir . 'ParameterManipulation.php'; |
66 | | -$wgAutoloadClasses['ParserHook'] = $incDir . 'ParserHook.php'; |
67 | | -$wgAutoloadClasses['Validator'] = $incDir . 'Validator.php'; |
68 | | -$wgAutoloadClasses['TopologicalSort'] = $incDir . 'TopologicalSort.php'; |
| 57 | +$wgAutoloadClasses['CriterionValidationResult'] = $incDir . 'CriterionValidationResult.php'; |
| 58 | +$wgAutoloadClasses['ItemParameterCriterion'] = $incDir . 'ItemParameterCriterion.php'; |
| 59 | +$wgAutoloadClasses['ItemParameterManipulation'] = $incDir . 'ItemParameterManipulation.php'; |
| 60 | +$wgAutoloadClasses['ListParameter'] = $incDir . 'ListParameter.php'; |
| 61 | +$wgAutoloadClasses['ListParameterCriterion'] = $incDir . 'ListParameterCriterion.php'; |
| 62 | +$wgAutoloadClasses['ListParameterManipulation'] = $incDir . 'ListParameterManipulation.php'; |
| 63 | +$wgAutoloadClasses['Parameter'] = $incDir . 'Parameter.php'; |
| 64 | +$wgAutoloadClasses['ParameterCriterion'] = $incDir . 'ParameterCriterion.php'; |
| 65 | +$wgAutoloadClasses['ParameterInput'] = $incDir . 'ParameterInput.php'; |
| 66 | +$wgAutoloadClasses['ParameterManipulation'] = $incDir . 'ParameterManipulation.php'; |
| 67 | +$wgAutoloadClasses['ParserHook'] = $incDir . 'ParserHook.php'; |
| 68 | +$wgAutoloadClasses['Validator'] = $incDir . 'Validator.php'; |
| 69 | +$wgAutoloadClasses['TopologicalSort'] = $incDir . 'TopologicalSort.php'; |
69 | 70 | // No need to autoload this one, since it's directly included below. |
70 | | -//$wgAutoloadClasses['ValidationError'] = $incDir . 'ValidationError.php'; |
71 | | -$wgAutoloadClasses['ValidationErrorHandler'] = $incDir . 'ValidationErrorHandler.php'; |
| 71 | +//$wgAutoloadClasses['ValidationError'] = $incDir . 'ValidationError.php'; |
| 72 | +$wgAutoloadClasses['ValidationErrorHandler'] = $incDir . 'ValidationErrorHandler.php'; |
72 | 73 | |
73 | | -$wgAutoloadClasses['CriterionHasLength'] = $incDir . 'criteria/CriterionHasLength.php'; |
74 | | -$wgAutoloadClasses['CriterionInArray'] = $incDir . 'criteria/CriterionInArray.php'; |
75 | | -$wgAutoloadClasses['CriterionInRange'] = $incDir . 'criteria/CriterionInRange.php'; |
76 | | -$wgAutoloadClasses['CriterionIsFloat'] = $incDir . 'criteria/CriterionIsFloat.php'; |
77 | | -$wgAutoloadClasses['CriterionIsInteger'] = $incDir . 'criteria/CriterionIsInteger.php'; |
78 | | -$wgAutoloadClasses['CriterionIsNumeric'] = $incDir . 'criteria/CriterionIsNumeric.php'; |
79 | | -$wgAutoloadClasses['CriterionItemCount'] = $incDir . 'criteria/CriterionItemCount.php'; |
80 | | -$wgAutoloadClasses['CriterionMatchesRegex'] = $incDir . 'criteria/CriterionMatchesRegex.php'; |
81 | | -$wgAutoloadClasses['CriterionNotEmpty'] = $incDir . 'criteria/CriterionNotEmpty.php'; |
82 | | -$wgAutoloadClasses['CriterionTrue'] = $incDir . 'criteria/CriterionTrue.php'; |
83 | | -$wgAutoloadClasses['CriterionUniqueItems'] = $incDir . 'criteria/CriterionUniqueItems.php'; |
| 74 | +$wgAutoloadClasses['CriterionHasLength'] = $incDir . 'criteria/CriterionHasLength.php'; |
| 75 | +$wgAutoloadClasses['CriterionInArray'] = $incDir . 'criteria/CriterionInArray.php'; |
| 76 | +$wgAutoloadClasses['CriterionInRange'] = $incDir . 'criteria/CriterionInRange.php'; |
| 77 | +$wgAutoloadClasses['CriterionIsFloat'] = $incDir . 'criteria/CriterionIsFloat.php'; |
| 78 | +$wgAutoloadClasses['CriterionIsInteger'] = $incDir . 'criteria/CriterionIsInteger.php'; |
| 79 | +$wgAutoloadClasses['CriterionIsNumeric'] = $incDir . 'criteria/CriterionIsNumeric.php'; |
| 80 | +$wgAutoloadClasses['CriterionIsTitle'] = $incDir . 'criteria/CriterionIsTitle.php'; |
| 81 | +$wgAutoloadClasses['CriterionItemCount'] = $incDir . 'criteria/CriterionItemCount.php'; |
| 82 | +$wgAutoloadClasses['CriterionMatchesRegex'] = $incDir . 'criteria/CriterionMatchesRegex.php'; |
| 83 | +$wgAutoloadClasses['CriterionNotEmpty'] = $incDir . 'criteria/CriterionNotEmpty.php'; |
| 84 | +$wgAutoloadClasses['CriterionTrue'] = $incDir . 'criteria/CriterionTrue.php'; |
| 85 | +$wgAutoloadClasses['CriterionUniqueItems'] = $incDir . 'criteria/CriterionUniqueItems.php'; |
84 | 86 | |
85 | | -$wgAutoloadClasses['ParamManipulationBoolean'] = $incDir . 'manipulations/ParamManipulationBoolean.php'; |
86 | | -$wgAutoloadClasses['ParamManipulationFloat'] = $incDir . 'manipulations/ParamManipulationFloat.php'; |
87 | | -$wgAutoloadClasses['ParamManipulationFunctions']= $incDir . 'manipulations/ParamManipulationFunctions.php'; |
88 | | -$wgAutoloadClasses['ParamManipulationImplode'] = $incDir . 'manipulations/ParamManipulationImplode.php'; |
89 | | -$wgAutoloadClasses['ParamManipulationInteger'] = $incDir . 'manipulations/ParamManipulationInteger.php'; |
90 | | -$wgAutoloadClasses['ParamManipulationString'] = $incDir . 'manipulations/ParamManipulationString.php'; |
| 87 | +$wgAutoloadClasses['ParamManipulationBoolean'] = $incDir . 'manipulations/ParamManipulationBoolean.php'; |
| 88 | +$wgAutoloadClasses['ParamManipulationFloat'] = $incDir . 'manipulations/ParamManipulationFloat.php'; |
| 89 | +$wgAutoloadClasses['ParamManipulationFunctions'] = $incDir . 'manipulations/ParamManipulationFunctions.php'; |
| 90 | +$wgAutoloadClasses['ParamManipulationImplode'] = $incDir . 'manipulations/ParamManipulationImplode.php'; |
| 91 | +$wgAutoloadClasses['ParamManipulationInteger'] = $incDir . 'manipulations/ParamManipulationInteger.php'; |
| 92 | +$wgAutoloadClasses['ParamManipulationString'] = $incDir . 'manipulations/ParamManipulationString.php'; |
| 93 | +$wgAutoloadClasses['ParamManipulationTitle'] = $incDir . 'manipulations/ParamManipulationTitle.php'; |
91 | 94 | |
92 | | -$wgAutoloadClasses['ValidatorDescribe'] = $incDir . 'parserHooks/Validator_Describe.php'; |
93 | | -$wgAutoloadClasses['ValidatorListErrors'] = $incDir . 'parserHooks/Validator_ListErrors.php'; |
| 95 | +$wgAutoloadClasses['ValidatorDescribe'] = $incDir . 'parserHooks/Validator_Describe.php'; |
| 96 | +$wgAutoloadClasses['ValidatorListErrors'] = $incDir . 'parserHooks/Validator_ListErrors.php'; |
94 | 97 | unset( $incDir ); |
95 | 98 | |
96 | 99 | # Registration of the listerrors parser hooks. |