Index: trunk/extensions/Maps/includes/parserHooks/Maps_Geodistance.php |
— | — | @@ -55,29 +55,50 @@ |
56 | 56 | */ |
57 | 57 | protected function getParameterInfo() { |
58 | 58 | 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() ), |
80 | 93 | ) |
81 | | - ); |
| 94 | + ); |
| 95 | + |
| 96 | + $params['decimals'] = new Parameter( |
| 97 | + 'decimals', |
| 98 | + Parameter::TYPE_INTEGER, |
| 99 | + $egMapsDistanceDecimals |
| 100 | + ); |
| 101 | + |
| 102 | + return $params; |
82 | 103 | } |
83 | 104 | |
84 | 105 | /** |