r60000 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59999‎ | r60000 | r60001 >
Date:18:38, 12 December 2009
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Modified paths:
  • /trunk/extensions/Maps/GoogleMaps/Maps_GoogleMaps.php (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php (modified) (history)
  • /trunk/extensions/Maps/Maps.php (modified) (history)
  • /trunk/extensions/Maps/Maps_Mapper.php (modified) (history)
  • /trunk/extensions/Maps/OpenLayers/Maps_OpenLayers.php (modified) (history)
  • /trunk/extensions/Maps/OpenStreetMap/Maps_OSM.php (modified) (history)
  • /trunk/extensions/Maps/OpenStreetMap/Maps_OSMDispMap.php (modified) (history)
  • /trunk/extensions/Maps/ParserFunctions/DisplayPoint/Maps_BasePointMap.php (modified) (history)
  • /trunk/extensions/Maps/ParserFunctions/DisplayPoint/Maps_DisplayPoint.php (modified) (history)
  • /trunk/extensions/Maps/ParserFunctions/Maps_ParserFunctions.php (modified) (history)
  • /trunk/extensions/Maps/YahooMaps/Maps_YahooMaps.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayers.php
@@ -58,25 +58,20 @@
5959 'default' => $egMapsOpenLayersZoom,
6060 ),
6161 'controls' => array(
 62+ 'type' => 'list-string',
6263 'criteria' => array(
63 - 'in_array' => self::getControlNames()
 64+ 'all_in_array' => self::getControlNames()
6465 ),
65 - 'default' => implode(',', $egMapsOLControls)
 66+ 'default' => $egMapsOLControls
6667 ),
6768 'layers' => array(
68 - 'aliases' => array(),
 69+ 'type' => 'list-string',
6970 'criteria' => array(
70 - 'in_array' => self::getLayerNames()
 71+ 'all_in_array' => self::getLayerNames()
7172 ),
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(), */
8176 );
8277 }
8378
Index: trunk/extensions/Maps/ParserFunctions/DisplayPoint/Maps_DisplayPoint.php
@@ -73,17 +73,12 @@
7474 self::$parameters = array_merge(MapsParserFunctions::$parameters, array(
7575 'centre' => array(
7676 'aliases' => array('center'),
77 - 'criteria' => array(),
7877 'default' => $egMapsDefaultCentre
7978 ),
80 - 'title' => array(
81 - 'aliases' => array(),
82 - 'criteria' => array(),
 79+ 'title' => array(
8380 'default' => $egMapsDefaultTitle
8481 ),
85 - 'label' => array(
86 - 'aliases' => array(),
87 - 'criteria' => array(),
 82+ 'label' => array(
8883 'default' => $egMapsDefaultLabel
8984 ),
9085 ));
Index: trunk/extensions/Maps/ParserFunctions/DisplayPoint/Maps_BasePointMap.php
@@ -135,14 +135,14 @@
136136 $icon = array_key_exists('icon', $markerData) ? $markerData['icon'] : '';
137137
138138 $markerItems[] = str_replace( array('lon', 'lat', 'title', 'label', 'icon'),
139 - array($lon, $lat, $title, $label, $label),
 139+ array($lon, $lat, $title, $label, $icon),
140140 $this->markerStringFormat
141141 );
142 - }
 142+ }
143143
144144 $this->markerString = implode(',', $markerItems);
145145 }
146 -
 146+
147147 /**
148148 * Sets the $centre_lat and $centre_lon fields.
149149 * Note: this needs to be done AFTRE the maker coordinates are set.
Index: trunk/extensions/Maps/ParserFunctions/Maps_ParserFunctions.php
@@ -58,20 +58,15 @@
5959
6060 self::$parameters = array(
6161 'service' => array(
62 - 'aliases' => array(),
6362 'criteria' => array(
6463 'in_array' => $egMapsAvailableServices
6564 ),
6665 'default' => $egMapsDefaultServices['pf']
6766 ),
68 - 'coordinates' => array(
 67+ 'coordinates' => array(
6968 'aliases' => array('coords', 'location', 'locations'),
70 - 'criteria' => array(
71 - //'arecoords' => array()// TODO
72 - ),
7369 ),
7470 'geoservice' => array(
75 - 'aliases' => array(),
7671 'criteria' => array(
7772 'in_array' => array_keys($egMapsAvailableGeoServices)
7873 ),
@@ -297,7 +292,7 @@
298293 private static function paramIsPresent($paramName, array $stack, array $paramInfo = array(), $checkForAliases = true) {
299294 $isPresent = array_key_exists($paramName, $stack);
300295
301 - if ($checkForAliases) {
 296+ if ($checkForAliases && array_key_exists('aliases', $paramInfo[$paramName])) {
302297 foreach($paramInfo[$paramName]['aliases'] as $alias) {
303298 if (array_key_exists($alias, $stack)) {
304299 $isPresent = true;
Index: trunk/extensions/Maps/Maps.php
@@ -30,7 +30,7 @@
3131
3232 // Only initialize the extension when all dependencies are present.
3333 if (defined( 'Validator_VERSION' )) {
34 - define('Maps_VERSION', '0.5 a20');
 34+ define('Maps_VERSION', '0.5 a21');
3535
3636 $egMapsScriptPath = $wgScriptPath . '/extensions/Maps';
3737 $egMapsIP = $IP . '/extensions/Maps';
Index: trunk/extensions/Maps/OpenStreetMap/Maps_OSMDispMap.php
@@ -31,14 +31,12 @@
3232
3333 $this->spesificParameters = array(
3434 'static' => array(
35 - 'aliases' => array(),
3635 'criteria' => array(
3736 'in_array' => array('yes', 'no')
3837 ),
3938 'default' => 'no'
4039 ),
4140 'mode' => array(
42 - 'aliases' => array(),
4341 'criteria' => array(
4442 'in_array' => $modes
4543 ),
Index: trunk/extensions/Maps/OpenStreetMap/Maps_OSM.php
@@ -56,8 +56,11 @@
5757 'default' => $egMapsOSMZoom,
5858 ),
5959 '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
6265 ),
6366 'lang' => array(
6467 'aliases' => array('locale', 'language'),
Index: trunk/extensions/Maps/Maps_Mapper.php
@@ -29,32 +29,26 @@
3030 self::$mainParams = array
3131 (
3232 'zoom' => array(
33 - 'aliases' => array(),
 33+ 'type' => 'integer',
3434 'criteria' => array(
35 - 'is_numeric' => array(),
3635 'in_range' => array(0, 15)
3736 )
3837 ),
3938 'width' => array(
40 - 'aliases' => array(),
 39+ 'type' => 'integer',
4140 'criteria' => array(
42 - 'is_numeric' => array(),
4341 'in_range' => $egMapsSizeRestrictions['width']
4442 ),
4543 'default' => $egMapsMapWidth
4644 ),
4745 'height' => array(
48 - 'aliases' => array(),
 46+ 'type' => 'integer',
4947 'criteria' => array(
50 - 'is_numeric' => array(),
5148 'in_range' => $egMapsSizeRestrictions['height']
5249 ),
5350 'default' => $egMapsMapHeight
5451 ),
55 - 'controls' => array(
56 - 'aliases' => array(),
57 - 'criteria' => array(),
58 - ),
 52+ 'controls' => array(),
5953 );
6054 }
6155
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php
@@ -29,9 +29,10 @@
3030
3131 $this->spesificParameters = array(
3232 'overlays' => array(
33 - 'aliases' => array(),
34 - 'criteria' => array(),
35 - 'default' => ''
 33+ 'type' => 'list-string',
 34+ 'criteria' => array(
 35+ 'all_in_array' => MapsGoogleMaps::getOverlayNames()
 36+ ),
3637 ),
3738 );
3839 }
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMaps.php
@@ -56,10 +56,11 @@
5757 'default' => $egMapsGoogleMapsZoom,
5858 ),
5959 'controls' => array(
 60+ 'type' => 'list-string',
6061 '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
6465 ),
6566 'type' => array (
6667 'aliases' => array('map-type', 'map type'),
@@ -71,9 +72,9 @@
7273 'types' => array (
7374 'aliases' => array('map-types', 'map types'),
7475 'criteria' => array(
75 - 'all_str_in_array' => array(',', $allowedTypes)
 76+ 'all_in_array' => $allowedTypes
7677 ),
77 - 'default' => implode(',', $egMapsGoogleMapsTypes)
 78+ 'default' => $egMapsGoogleMapsTypes
7879 ),
7980 'autozoom' => array(
8081 'aliases' => array('auto zoom', 'mouse zoom', 'mousezoom'),
@@ -82,16 +83,8 @@
8384 ),
8485 'default' => $egMapsGoogleAutozoom ? 'on' : 'off'
8586 ),
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(),
9689 );
9790 }
9891
@@ -191,7 +184,6 @@
192185
193186 MapsGoogleMaps::validateGoogleMapsKey();
194187
195 - // TODO: use strbuilder for performance gain?
196188 $output .= "<script src='http://maps.google.com/maps?file=api&v=2&key=$egGoogleMapsKey&hl={$wgLang->getCode()}' type='$wgJsMimeType'></script>
197189 <script type='$wgJsMimeType' src='$egMapsScriptPath/GoogleMaps/GoogleMapFunctions.js?$egMapsStyleVersion'></script>
198190 <script type='$wgJsMimeType'>window.unload = GUnload;</script>";
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php
@@ -36,9 +36,10 @@
3737
3838 $this->spesificParameters = array(
3939 'overlays' => array(
40 - 'aliases' => array(),
41 - 'criteria' => array(),
42 - 'default' => ''
 40+ 'type' => 'list-string',
 41+ 'criteria' => array(
 42+ 'all_in_array' => MapsGoogleMaps::getOverlayNames()
 43+ ),
4344 ),
4445 'zoom' => array(
4546 'default' => '',
Index: trunk/extensions/Maps/YahooMaps/Maps_YahooMaps.php
@@ -29,11 +29,6 @@
3030 array('class' => 'MapsYahooMaps', 'file' => 'YahooMaps/Maps_YahooMapsUtils.php', 'local' => true)
3131 ),
3232 '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 - )
3833 );
3934
4035 /**
@@ -61,11 +56,12 @@
6257 'default' => $egMapsYahooMapsZoom
6358 ),
6459 'controls' => array(
 60+ 'type' => 'list-string',
6561 'criteria' => array(
66 - 'all_str_in_array' => array(',', self::getControlNames())
 62+ 'all_in_array' => self::getControlNames()
6763 ),
68 - 'default' => implode(',', $egMapsYMapControls)
69 - ),
 64+ 'default' => $egMapsYMapControls
 65+ ),
7066 'type' => array (
7167 'aliases' => array('map-type', 'map type'),
7268 'criteria' => array(
@@ -74,17 +70,18 @@
7571 'default' => $egMapsYahooMapsType
7672 ),
7773 'types' => array (
 74+ 'type' => 'list-string',
7875 'aliases' => array('map-types', 'map types'),
7976 'criteria' => array(
80 - 'all_str_in_array' => array(',', $allowedTypes)
 77+ 'all_in_array' => $allowedTypes
8178 ),
82 - 'default' => implode(',', $egMapsYahooMapsTypes)
 79+ 'default' => $egMapsYahooMapsTypes
8380 ),
8481 'autozoom' => array(
8582 'aliases' => array('auto zoom', 'mouse zoom', 'mousezoom'),
8683 'criteria' => array(
8784 'in_array' => array('on', 'off', 'yes', 'no')
88 - ),
 85+ ),
8986 'default' => $egMapsYahooAutozoom ? 'on' : 'off'
9087 ),
9188 );

Status & tagging log