Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayers.php |
— | — | @@ -58,25 +58,20 @@ |
59 | 59 | 'default' => $egMapsOpenLayersZoom, |
60 | 60 | ), |
61 | 61 | 'controls' => array( |
| 62 | + 'type' => 'list-string', |
62 | 63 | 'criteria' => array( |
63 | | - 'in_array' => self::getControlNames() |
| 64 | + 'all_in_array' => self::getControlNames() |
64 | 65 | ), |
65 | | - 'default' => implode(',', $egMapsOLControls) |
| 66 | + 'default' => $egMapsOLControls |
66 | 67 | ), |
67 | 68 | 'layers' => array( |
68 | | - 'aliases' => array(), |
| 69 | + 'type' => 'list-string', |
69 | 70 | 'criteria' => array( |
70 | | - 'in_array' => self::getLayerNames() |
| 71 | + 'all_in_array' => self::getLayerNames() |
71 | 72 | ), |
72 | | - 'default' => implode(',', $egMapsOLLayers) |
73 | | - ), |
74 | | - /* |
75 | | - 'baselayer' => array( // TODO |
76 | | - 'aliases' => array(), |
77 | | - 'criteria' => array(), |
78 | | - 'default' => '' |
79 | | - ), |
80 | | - */ |
| 73 | + 'default' => $egMapsOLLayers |
| 74 | + ), |
| 75 | + /* 'baselayer' => array(), */ |
81 | 76 | ); |
82 | 77 | } |
83 | 78 | |
Index: trunk/extensions/Maps/ParserFunctions/DisplayPoint/Maps_DisplayPoint.php |
— | — | @@ -73,17 +73,12 @@ |
74 | 74 | self::$parameters = array_merge(MapsParserFunctions::$parameters, array( |
75 | 75 | 'centre' => array( |
76 | 76 | 'aliases' => array('center'), |
77 | | - 'criteria' => array(), |
78 | 77 | 'default' => $egMapsDefaultCentre |
79 | 78 | ), |
80 | | - 'title' => array( |
81 | | - 'aliases' => array(), |
82 | | - 'criteria' => array(), |
| 79 | + 'title' => array( |
83 | 80 | 'default' => $egMapsDefaultTitle |
84 | 81 | ), |
85 | | - 'label' => array( |
86 | | - 'aliases' => array(), |
87 | | - 'criteria' => array(), |
| 82 | + 'label' => array( |
88 | 83 | 'default' => $egMapsDefaultLabel |
89 | 84 | ), |
90 | 85 | )); |
Index: trunk/extensions/Maps/ParserFunctions/DisplayPoint/Maps_BasePointMap.php |
— | — | @@ -135,14 +135,14 @@ |
136 | 136 | $icon = array_key_exists('icon', $markerData) ? $markerData['icon'] : ''; |
137 | 137 | |
138 | 138 | $markerItems[] = str_replace( array('lon', 'lat', 'title', 'label', 'icon'), |
139 | | - array($lon, $lat, $title, $label, $label), |
| 139 | + array($lon, $lat, $title, $label, $icon), |
140 | 140 | $this->markerStringFormat |
141 | 141 | ); |
142 | | - } |
| 142 | + } |
143 | 143 | |
144 | 144 | $this->markerString = implode(',', $markerItems); |
145 | 145 | } |
146 | | - |
| 146 | + |
147 | 147 | /** |
148 | 148 | * Sets the $centre_lat and $centre_lon fields. |
149 | 149 | * Note: this needs to be done AFTRE the maker coordinates are set. |
Index: trunk/extensions/Maps/ParserFunctions/Maps_ParserFunctions.php |
— | — | @@ -58,20 +58,15 @@ |
59 | 59 | |
60 | 60 | self::$parameters = array( |
61 | 61 | 'service' => array( |
62 | | - 'aliases' => array(), |
63 | 62 | 'criteria' => array( |
64 | 63 | 'in_array' => $egMapsAvailableServices |
65 | 64 | ), |
66 | 65 | 'default' => $egMapsDefaultServices['pf'] |
67 | 66 | ), |
68 | | - 'coordinates' => array( |
| 67 | + 'coordinates' => array( |
69 | 68 | 'aliases' => array('coords', 'location', 'locations'), |
70 | | - 'criteria' => array( |
71 | | - //'arecoords' => array()// TODO |
72 | | - ), |
73 | 69 | ), |
74 | 70 | 'geoservice' => array( |
75 | | - 'aliases' => array(), |
76 | 71 | 'criteria' => array( |
77 | 72 | 'in_array' => array_keys($egMapsAvailableGeoServices) |
78 | 73 | ), |
— | — | @@ -297,7 +292,7 @@ |
298 | 293 | private static function paramIsPresent($paramName, array $stack, array $paramInfo = array(), $checkForAliases = true) { |
299 | 294 | $isPresent = array_key_exists($paramName, $stack); |
300 | 295 | |
301 | | - if ($checkForAliases) { |
| 296 | + if ($checkForAliases && array_key_exists('aliases', $paramInfo[$paramName])) { |
302 | 297 | foreach($paramInfo[$paramName]['aliases'] as $alias) { |
303 | 298 | if (array_key_exists($alias, $stack)) { |
304 | 299 | $isPresent = true; |
Index: trunk/extensions/Maps/Maps.php |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | |
32 | 32 | // Only initialize the extension when all dependencies are present. |
33 | 33 | if (defined( 'Validator_VERSION' )) { |
34 | | - define('Maps_VERSION', '0.5 a20'); |
| 34 | + define('Maps_VERSION', '0.5 a21'); |
35 | 35 | |
36 | 36 | $egMapsScriptPath = $wgScriptPath . '/extensions/Maps'; |
37 | 37 | $egMapsIP = $IP . '/extensions/Maps'; |
Index: trunk/extensions/Maps/OpenStreetMap/Maps_OSMDispMap.php |
— | — | @@ -31,14 +31,12 @@ |
32 | 32 | |
33 | 33 | $this->spesificParameters = array( |
34 | 34 | 'static' => array( |
35 | | - 'aliases' => array(), |
36 | 35 | 'criteria' => array( |
37 | 36 | 'in_array' => array('yes', 'no') |
38 | 37 | ), |
39 | 38 | 'default' => 'no' |
40 | 39 | ), |
41 | 40 | 'mode' => array( |
42 | | - 'aliases' => array(), |
43 | 41 | 'criteria' => array( |
44 | 42 | 'in_array' => $modes |
45 | 43 | ), |
Index: trunk/extensions/Maps/OpenStreetMap/Maps_OSM.php |
— | — | @@ -56,8 +56,11 @@ |
57 | 57 | 'default' => $egMapsOSMZoom, |
58 | 58 | ), |
59 | 59 | 'controls' => array( |
60 | | - 'criteria' => array(), // TODO |
61 | | - 'default' => implode(',', $egMapsOSMControls) |
| 60 | + 'type' => 'list-string', |
| 61 | + 'criteria' => array( |
| 62 | + 'all_in_array' => self::getControlNames() |
| 63 | + ), |
| 64 | + 'default' => $egMapsOSMControls |
62 | 65 | ), |
63 | 66 | 'lang' => array( |
64 | 67 | 'aliases' => array('locale', 'language'), |
Index: trunk/extensions/Maps/Maps_Mapper.php |
— | — | @@ -29,32 +29,26 @@ |
30 | 30 | self::$mainParams = array |
31 | 31 | ( |
32 | 32 | 'zoom' => array( |
33 | | - 'aliases' => array(), |
| 33 | + 'type' => 'integer', |
34 | 34 | 'criteria' => array( |
35 | | - 'is_numeric' => array(), |
36 | 35 | 'in_range' => array(0, 15) |
37 | 36 | ) |
38 | 37 | ), |
39 | 38 | 'width' => array( |
40 | | - 'aliases' => array(), |
| 39 | + 'type' => 'integer', |
41 | 40 | 'criteria' => array( |
42 | | - 'is_numeric' => array(), |
43 | 41 | 'in_range' => $egMapsSizeRestrictions['width'] |
44 | 42 | ), |
45 | 43 | 'default' => $egMapsMapWidth |
46 | 44 | ), |
47 | 45 | 'height' => array( |
48 | | - 'aliases' => array(), |
| 46 | + 'type' => 'integer', |
49 | 47 | 'criteria' => array( |
50 | | - 'is_numeric' => array(), |
51 | 48 | 'in_range' => $egMapsSizeRestrictions['height'] |
52 | 49 | ), |
53 | 50 | 'default' => $egMapsMapHeight |
54 | 51 | ), |
55 | | - 'controls' => array( |
56 | | - 'aliases' => array(), |
57 | | - 'criteria' => array(), |
58 | | - ), |
| 52 | + 'controls' => array(), |
59 | 53 | ); |
60 | 54 | } |
61 | 55 | |
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php |
— | — | @@ -29,9 +29,10 @@ |
30 | 30 | |
31 | 31 | $this->spesificParameters = array( |
32 | 32 | 'overlays' => array( |
33 | | - 'aliases' => array(), |
34 | | - 'criteria' => array(), |
35 | | - 'default' => '' |
| 33 | + 'type' => 'list-string', |
| 34 | + 'criteria' => array( |
| 35 | + 'all_in_array' => MapsGoogleMaps::getOverlayNames() |
| 36 | + ), |
36 | 37 | ), |
37 | 38 | ); |
38 | 39 | } |
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMaps.php |
— | — | @@ -56,10 +56,11 @@ |
57 | 57 | 'default' => $egMapsGoogleMapsZoom, |
58 | 58 | ), |
59 | 59 | 'controls' => array( |
| 60 | + 'type' => 'list-string', |
60 | 61 | 'criteria' => array( |
61 | | - 'all_str_in_array' => array(',', self::getControlNames()) |
62 | | - ), // TODO |
63 | | - 'default' => implode(',', $egMapsGMapControls) |
| 62 | + 'all_in_array' => self::getControlNames() |
| 63 | + ), |
| 64 | + 'default' => $egMapsGMapControls |
64 | 65 | ), |
65 | 66 | 'type' => array ( |
66 | 67 | 'aliases' => array('map-type', 'map type'), |
— | — | @@ -71,9 +72,9 @@ |
72 | 73 | 'types' => array ( |
73 | 74 | 'aliases' => array('map-types', 'map types'), |
74 | 75 | 'criteria' => array( |
75 | | - 'all_str_in_array' => array(',', $allowedTypes) |
| 76 | + 'all_in_array' => $allowedTypes |
76 | 77 | ), |
77 | | - 'default' => implode(',', $egMapsGoogleMapsTypes) |
| 78 | + 'default' => $egMapsGoogleMapsTypes |
78 | 79 | ), |
79 | 80 | 'autozoom' => array( |
80 | 81 | 'aliases' => array('auto zoom', 'mouse zoom', 'mousezoom'), |
— | — | @@ -82,16 +83,8 @@ |
83 | 84 | ), |
84 | 85 | 'default' => $egMapsGoogleAutozoom ? 'on' : 'off' |
85 | 86 | ), |
86 | | - 'class' => array( |
87 | | - 'aliases' => array(), |
88 | | - 'criteria' => array(), |
89 | | - 'default' => '' |
90 | | - ), |
91 | | - 'style' => array( |
92 | | - 'aliases' => array(), |
93 | | - 'criteria' => array(), |
94 | | - 'default' => '' |
95 | | - ), |
| 87 | + 'class' => array(), |
| 88 | + 'style' => array(), |
96 | 89 | ); |
97 | 90 | } |
98 | 91 | |
— | — | @@ -191,7 +184,6 @@ |
192 | 185 | |
193 | 186 | MapsGoogleMaps::validateGoogleMapsKey(); |
194 | 187 | |
195 | | - // TODO: use strbuilder for performance gain? |
196 | 188 | $output .= "<script src='http://maps.google.com/maps?file=api&v=2&key=$egGoogleMapsKey&hl={$wgLang->getCode()}' type='$wgJsMimeType'></script> |
197 | 189 | <script type='$wgJsMimeType' src='$egMapsScriptPath/GoogleMaps/GoogleMapFunctions.js?$egMapsStyleVersion'></script> |
198 | 190 | <script type='$wgJsMimeType'>window.unload = GUnload;</script>"; |
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php |
— | — | @@ -36,9 +36,10 @@ |
37 | 37 | |
38 | 38 | $this->spesificParameters = array( |
39 | 39 | 'overlays' => array( |
40 | | - 'aliases' => array(), |
41 | | - 'criteria' => array(), |
42 | | - 'default' => '' |
| 40 | + 'type' => 'list-string', |
| 41 | + 'criteria' => array( |
| 42 | + 'all_in_array' => MapsGoogleMaps::getOverlayNames() |
| 43 | + ), |
43 | 44 | ), |
44 | 45 | 'zoom' => array( |
45 | 46 | 'default' => '', |
Index: trunk/extensions/Maps/YahooMaps/Maps_YahooMaps.php |
— | — | @@ -29,11 +29,6 @@ |
30 | 30 | array('class' => 'MapsYahooMaps', 'file' => 'YahooMaps/Maps_YahooMapsUtils.php', 'local' => true) |
31 | 31 | ), |
32 | 32 | 'aliases' => array('yahoo', 'yahoomap', 'ymap', 'ymaps'), |
33 | | - 'parameters' => array( |
34 | | - 'type' => array('map-type'), |
35 | | - 'types' => array('map-types', 'map types'), |
36 | | - 'autozoom' => array('auto zoom', 'mouse zoom', 'mousezoom') |
37 | | - ) |
38 | 33 | ); |
39 | 34 | |
40 | 35 | /** |
— | — | @@ -61,11 +56,12 @@ |
62 | 57 | 'default' => $egMapsYahooMapsZoom |
63 | 58 | ), |
64 | 59 | 'controls' => array( |
| 60 | + 'type' => 'list-string', |
65 | 61 | 'criteria' => array( |
66 | | - 'all_str_in_array' => array(',', self::getControlNames()) |
| 62 | + 'all_in_array' => self::getControlNames() |
67 | 63 | ), |
68 | | - 'default' => implode(',', $egMapsYMapControls) |
69 | | - ), |
| 64 | + 'default' => $egMapsYMapControls |
| 65 | + ), |
70 | 66 | 'type' => array ( |
71 | 67 | 'aliases' => array('map-type', 'map type'), |
72 | 68 | 'criteria' => array( |
— | — | @@ -74,17 +70,18 @@ |
75 | 71 | 'default' => $egMapsYahooMapsType |
76 | 72 | ), |
77 | 73 | 'types' => array ( |
| 74 | + 'type' => 'list-string', |
78 | 75 | 'aliases' => array('map-types', 'map types'), |
79 | 76 | 'criteria' => array( |
80 | | - 'all_str_in_array' => array(',', $allowedTypes) |
| 77 | + 'all_in_array' => $allowedTypes |
81 | 78 | ), |
82 | | - 'default' => implode(',', $egMapsYahooMapsTypes) |
| 79 | + 'default' => $egMapsYahooMapsTypes |
83 | 80 | ), |
84 | 81 | 'autozoom' => array( |
85 | 82 | 'aliases' => array('auto zoom', 'mouse zoom', 'mousezoom'), |
86 | 83 | 'criteria' => array( |
87 | 84 | 'in_array' => array('on', 'off', 'yes', 'no') |
88 | | - ), |
| 85 | + ), |
89 | 86 | 'default' => $egMapsYahooAutozoom ? 'on' : 'off' |
90 | 87 | ), |
91 | 88 | ); |