r73521 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73520‎ | r73521 | r73522 >
Date:12:45, 22 September 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.7 - matching new Validator structure
Modified paths:
  • /trunk/extensions/Maps/includes/parserHooks/Maps_Geodistance.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/includes/parserHooks/Maps_Geodistance.php
@@ -55,29 +55,50 @@
5656 */
5757 protected function getParameterInfo() {
5858 global $egMapsDistanceUnit, $egMapsDistanceDecimals;
59 -
60 - return array(
61 - 'location1' => array(
62 - 'required' => true,
63 - 'tolower' => false,
64 - 'aliases' => array( 'from' )
65 - ),
66 - 'location2' => array(
67 - 'required' => true,
68 - 'tolower' => false,
69 - 'aliases' => array( 'to' )
70 - ),
71 - 'unit' => array(
72 - 'criteria' => array(
73 - 'in_array' => MapsDistanceParser::getUnits()
74 - ),
75 - 'default' => $egMapsDistanceUnit
76 - ),
77 - 'decimals' => array(
78 - 'type' => 'integer',
79 - 'default' => $egMapsDistanceDecimals
 59+
 60+ $params = array();
 61+
 62+ $params['location1'] = new Parameter(
 63+ 'location1',
 64+ Parameter::TYPE_STRING,
 65+ null,
 66+ array( 'from' ),
 67+ array(
 68+ new CriterionIsLocation(),
 69+ )
 70+ );
 71+
 72+ $params['location1']->lowerCaseValue = false;
 73+
 74+ $params['location2'] = new Parameter(
 75+ 'location2',
 76+ Parameter::TYPE_STRING,
 77+ null,
 78+ array( 'to' ),
 79+ array(
 80+ new CriterionIsLocation(),
 81+ )
 82+ );
 83+
 84+ $params['location2']->lowerCaseValue = false;
 85+
 86+ $params['unit'] = new Parameter(
 87+ 'unit',
 88+ Parameter::TYPE_STRING,
 89+ $egMapsDistanceUnit,
 90+ array(),
 91+ array(
 92+ new CriterionInArray( MapsDistanceParser::getUnits() ),
8093 )
81 - );
 94+ );
 95+
 96+ $params['decimals'] = new Parameter(
 97+ 'decimals',
 98+ Parameter::TYPE_INTEGER,
 99+ $egMapsDistanceDecimals
 100+ );
 101+
 102+ return $params;
82103 }
83104
84105 /**

Status & tagging log