r111215 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111214‎ | r111215 | r111216 >
Date:23:17, 10 February 2012
Author:danwe
Status:resolved (Comments)
Tags:
Comment:
New built-in parameter type 'Title' implemented
Modified paths:
  • /trunk/extensions/Validator/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/Validator/Validator.i18n.php (modified) (history)
  • /trunk/extensions/Validator/Validator.php (modified) (history)
  • /trunk/extensions/Validator/includes/Parameter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Validator/RELEASE-NOTES
@@ -3,7 +3,10 @@
44 == Validator change log ==
55 This change log contains a list of completed to-do's (new features, bug fixes, refactoring) for every version of Validator.
66
 7+=== Validator 0.4.14 ===
78
 9+* New built-in parameter type 'Title'. Accepts existing and non-existing page titles which are valid within the wiki.
 10+
811 === Validator 0.4.13 ===
912 (2011-11-30)
1013
Index: trunk/extensions/Validator/includes/Parameter.php
@@ -19,6 +19,7 @@
2020 const TYPE_FLOAT = 'float';
2121 const TYPE_BOOLEAN = 'boolean';
2222 const TYPE_CHAR = 'char';
 23+ const TYPE_TITLE = 'Title'; // since 0.4.14
2324
2425 /**
2526 * Indicates whether parameters that are provided more then once should be accepted,
@@ -618,6 +619,9 @@
619620 case self::TYPE_CHAR:
620621 $criteria[] = new CriterionHasLength( 1, 1 );
621622 break;
 623+ case self::TYPE_TITLE:
 624+ $criteria[] = new CriterionIsTitle();
 625+ break;
622626 case self::TYPE_STRING: default:
623627 // No extra criteria for strings.
624628 break;
@@ -646,9 +650,11 @@
647651 case self::TYPE_BOOLEAN:
648652 $manipulations[] = new ParamManipulationBoolean();
649653 break;
 654+ case self::TYPE_TITLE:
 655+ $manipulations[] = new ParamManipulationTitle();
 656+ break;
650657 case self::TYPE_CHAR: case self::TYPE_STRING: default:
651658 $manipulations[] = new ParamManipulationString();
652 - break;
653659 }
654660
655661 return $manipulations;
Index: trunk/extensions/Validator/Validator.i18n.php
@@ -14,6 +14,7 @@
1515
1616 /** English
1717 * @author Jeroen De Dauw
 18+ * @author Daniel Werner
1819 */
1920 $messages['en'] = array(
2021 'validator-desc' => 'Provides generic parameter handling support for other extensions',
@@ -87,6 +88,8 @@
8889 'validator_error_empty_argument' => 'Parameter $1 can not have an empty value.',
8990 'validator_error_must_be_number' => 'Parameter $1 can only be a number.',
9091 '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.',
9194 'validator-error-must-be-float' => 'Parameter $1 can only be a floating point number.',
9295 'validator_error_invalid_range' => 'Parameter $1 must be between $2 and $3.',
9396 'validator-error-invalid-regex' => 'Parameter $1 must match this regular expression: $2.',
@@ -98,6 +101,8 @@
99102 'validator_list_error_empty_argument' => 'Parameter $1 does not accept empty values.',
100103 'validator_list_error_must_be_number' => 'Parameter $1 can only contain numbers.',
101104 '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.',
102107 'validator-list-error-must-be-float' => 'Parameter $1 can only contain floats.',
103108 'validator_list_error_invalid_range' => 'All values of parameter $1 must be between $2 and $3.',
104109 '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 @@
4949 'descriptionmsg' => 'validator-desc',
5050 );
5151
 52+$incDir = dirname( __FILE__ ) . '/includes/';
 53+
5254 // Autoload the classes.
53 -$wgAutoloadClasses['ValidatorHooks'] = dirname( __FILE__ ) . '/Validator.hooks.php';
 55+$wgAutoloadClasses['ValidatorHooks'] = $incDir . '../Validator.hooks.php';
5456
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';
6970 // 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';
7273
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';
8486
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';
9194
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';
9497 unset( $incDir );
9598
9699 # Registration of the listerrors parser hooks.

Follow-up revisions

RevisionCommit summaryAuthorDate
r111220Missing files from r111215danwe23:47, 10 February 2012

Comments

#Comment by Jeroen De Dauw (talk | contribs)   23:34, 10 February 2012

Looks like you forgot to svn add the new files :)

#Comment by Danwe (talk | contribs)   23:49, 10 February 2012

Thanks, been away from svn for too long recently =)

Status & tagging log