Index: trunk/extensions/Maps/includes/parserHooks/Maps_Geocode.php |
— | — | @@ -57,42 +57,64 @@ |
58 | 58 | global $egMapsAvailableServices, $egMapsAvailableGeoServices, $egMapsAvailableCoordNotations; |
59 | 59 | global $egMapsDefaultServices, $egMapsDefaultGeoService, $egMapsCoordinateNotation; |
60 | 60 | global $egMapsAllowCoordsGeocoding, $egMapsCoordinateDirectional; |
61 | | - |
62 | | - return array( |
63 | | - 'location' => array( |
64 | | - 'required' => true, |
65 | | - 'tolower' => false |
66 | | - ), |
67 | | - 'mappingservice' => array( |
68 | | - 'criteria' => array( |
69 | | - 'in_array' => $egMapsAvailableServices |
70 | | - ), |
71 | | - 'default' => false |
72 | | - ), |
73 | | - 'service' => array( |
74 | | - 'criteria' => array( |
75 | | - 'in_array' => $egMapsAvailableGeoServices |
76 | | - ), |
77 | | - 'default' => $egMapsDefaultGeoService |
78 | | - ), |
79 | | - 'format' => array( |
80 | | - 'criteria' => array( |
81 | | - 'in_array' => $egMapsAvailableCoordNotations |
82 | | - ), |
83 | | - 'aliases' => array( |
84 | | - 'notation' |
85 | | - ), |
86 | | - 'default' => $egMapsCoordinateNotation |
87 | | - ), |
88 | | - 'allowcoordinates' => array( |
89 | | - 'type' => 'boolean', |
90 | | - 'default' => $egMapsAllowCoordsGeocoding |
91 | | - ), |
92 | | - 'directional' => array( |
93 | | - 'type' => 'boolean', |
94 | | - 'default' => $egMapsCoordinateDirectional |
95 | | - ), |
| 61 | + |
| 62 | + $params = array(); |
| 63 | + |
| 64 | + $params['location'] = new Parameter( |
| 65 | + 'location', |
| 66 | + Parameter::TYPE_STRING, |
| 67 | + null, |
| 68 | + array(), |
| 69 | + array( |
| 70 | + new CriterionIsLocation(), |
| 71 | + ) |
96 | 72 | ); |
| 73 | + |
| 74 | + $params['location']->lowerCaseValue = false; |
| 75 | + |
| 76 | + $params['mappingservice'] = new Parameter( |
| 77 | + 'mappingservice', |
| 78 | + Parameter::TYPE_STRING, |
| 79 | + '', // TODO |
| 80 | + array(), |
| 81 | + array( |
| 82 | + new CriterionInArray( MapsMappingServices::getAllServiceValues() ), |
| 83 | + ) |
| 84 | + ); |
| 85 | + |
| 86 | + $params['geoservice'] = new Parameter( |
| 87 | + 'geoservice', |
| 88 | + Parameter::TYPE_STRING, |
| 89 | + $egMapsDefaultGeoService, |
| 90 | + array( 'service' ), |
| 91 | + array( |
| 92 | + new CriterionInArray( $egMapsAvailableGeoServices ), |
| 93 | + ) |
| 94 | + ); |
| 95 | + |
| 96 | + $params['allowcoordinates'] = new Parameter( |
| 97 | + 'allowcoordinates', |
| 98 | + Parameter::TYPE_BOOLEAN, |
| 99 | + $egMapsAllowCoordsGeocoding |
| 100 | + ); |
| 101 | + |
| 102 | + $params['format'] = new Parameter( |
| 103 | + 'format', |
| 104 | + Parameter::TYPE_STRING, |
| 105 | + $egMapsCoordinateNotation, |
| 106 | + array( 'notation' ), |
| 107 | + array( |
| 108 | + new CriterionInArray( $egMapsAvailableCoordNotations ), |
| 109 | + ) |
| 110 | + ); |
| 111 | + |
| 112 | + $params['directional'] = new Parameter( |
| 113 | + 'directional', |
| 114 | + Parameter::TYPE_BOOLEAN, |
| 115 | + $egMapsCoordinateDirectional |
| 116 | + ); |
| 117 | + |
| 118 | + return $params; |
97 | 119 | } |
98 | 120 | |
99 | 121 | /** |