r61724 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61723‎ | r61724 | r61725 >
Date:17:55, 30 January 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.5.3.
* Added 2nd level service defaulting
* Fixed Google Maps v3 features
Modified paths:
  • /trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3.php (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3DispMap.php (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3DispPoint.php (modified) (history)
  • /trunk/extensions/Maps/Maps.php (modified) (history)
  • /trunk/extensions/Maps/Maps_Mapper.php (modified) (history)
  • /trunk/extensions/Maps/Maps_Settings.php (modified) (history)
  • /trunk/extensions/Maps/ParserFunctions/Maps_ParserFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3DispPoint.php
@@ -69,7 +69,7 @@
7070 zoom: $this->zoom,
7171 lat: $this->centre_lat,
7272 lon: $this->centre_lon,
73 - types: [$this->types],
 73+ types: [],
7474 mapTypeId: $this->type
7575 },
7676 [$this->markerString]
Index: trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3DispMap.php
@@ -66,7 +66,7 @@
6767 zoom: $this->zoom,
6868 lat: $this->centre_lat,
6969 lon: $this->centre_lon,
70 - types: [$this->types],
 70+ types: [],
7171 mapTypeId: $this->type
7272 },
7373 []
Index: trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3.php
@@ -22,7 +22,7 @@
2323
2424 $egMapsServices['googlemaps3'] = array(
2525 'pf' => array(
26 - 'display_point' => array('class' => 'MapsGoogleMaps3DispPoint', 'file' => 'GoogleMaps3/Maps_GoogleMaps3DispPoint.php', 'local' => true),
 26+ //'display_point' => array('class' => 'MapsGoogleMaps3DispPoint', 'file' => 'GoogleMaps3/Maps_GoogleMaps3DispPoint.php', 'local' => true),
2727 'display_map' => array('class' => 'MapsGoogleMaps3DispMap', 'file' => 'GoogleMaps3/Maps_GoogleMaps3DispMap.php', 'local' => true),
2828 ),
2929 'classes' => array(
Index: trunk/extensions/Maps/ParserFunctions/Maps_ParserFunctions.php
@@ -117,8 +117,9 @@
118118
119119 if ($coords) {
120120 if (! self::paramIsPresent('service', $map, $paramInfo)) $map['service'] = '';
121 - $map['service'] = MapsMapper::getValidService($map['service'], 'pf');
122 -
 121+
 122+ $map['service'] = MapsMapper::getValidService($map['service'], 'pf', $parserFunction);
 123+
123124 $mapClass = self::getParserClassInstance($map['service'], $parserFunction);
124125
125126 // Call the function according to the map service to get the HTML output
Index: trunk/extensions/Maps/Maps.php
@@ -33,7 +33,7 @@
3434 echo '<b>Warning:</b> You need to have <a href="http://www.mediawiki.org/wiki/Extension:Validator">Validator</a> installed in order to use <a href="http://www.mediawiki.org/wiki/Extension:Maps">Maps</a>.';
3535 }
3636 else {
37 - define('Maps_VERSION', '0.5.3 a5');
 37+ define('Maps_VERSION', '0.5.3 rc1');
3838
3939 $egMapsScriptPath = $wgScriptPath . '/extensions/Maps';
4040 $egMapsIP = $IP . '/extensions/Maps';
Index: trunk/extensions/Maps/Maps_Mapper.php
@@ -68,19 +68,42 @@
6969 *
7070 * @param string $service
7171 * @param string $feature
 72+ * @param string $subfeature
7273 *
7374 * @return string
7475 */
75 - public static function getValidService($service, $feature) {
 76+ public static function getValidService($service, $feature, $subfeature = '') {
7677 global $egMapsAvailableServices, $egMapsDefaultService, $egMapsDefaultServices, $egMapsServices;
7778
7879 $service = self::getMainServiceName($service);
7980
8081 $shouldChange = ! array_key_exists($service, $egMapsServices);
81 - if (! $shouldChange) $shouldChange = ! array_key_exists($feature, $egMapsServices[$service]);
 82+ if (! $shouldChange) {
 83+ if (array_key_exists($feature, $egMapsServices[$service])) {
 84+ $shouldChange = is_array($egMapsServices[$service][$feature]) && !array_key_exists($subfeature, $egMapsServices[$service][$feature]);
 85+ }
 86+ else {
 87+ $shouldChange = true;
 88+ }
 89+ }
8290
8391 if ($shouldChange) {
84 - $service = array_key_exists($feature, $egMapsDefaultServices) ? $egMapsDefaultServices[$feature] : $egMapsDefaultService;
 92+ if (array_key_exists($feature, $egMapsDefaultServices)) {
 93+ if (is_array($egMapsDefaultServices[$feature])) {
 94+ if (array_key_exists($subfeature, $egMapsDefaultServices[$feature])) {
 95+ $service = $egMapsDefaultServices[$feature][$subfeature];
 96+ }
 97+ else {
 98+ $service = $egMapsDefaultService;
 99+ }
 100+ }
 101+ else {
 102+ $service = $egMapsDefaultServices[$feature];
 103+ }
 104+ }
 105+ else {
 106+ $service = $egMapsDefaultService;
 107+ }
85108 }
86109
87110 if(! in_array($service, $egMapsAvailableServices)) $service = $egMapsDefaultService;
Index: trunk/extensions/Maps/Maps_Settings.php
@@ -79,7 +79,12 @@
8080 # Array of String. The default mapping service for each feature, which will be used when no valid service is provided by the user.
8181 # Each service needs to be enabled, if not, the first one from the available services will be taken.
8282 # Note: The default service needs to be available for the feature you set it for, since it's used as a fallback mechanism.
83 -$egMapsDefaultServices = array('pf' => 'googlemaps2');
 83+$egMapsDefaultServices = array(
 84+ 'pf' => array(
 85+ 'display_point' => 'googlemaps2',
 86+ 'display_map' => 'googlemaps2'
 87+ )
 88+);
8489
8590
8691

Status & tagging log