r73710 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73709‎ | r73710 | r73711 >
Date:04:39, 25 September 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r73708
Modified paths:
  • /trunk/extensions/Maps/Maps.php (modified) (history)
  • /trunk/extensions/Maps/includes/Maps_Mapper.php (modified) (history)
  • /trunk/extensions/Maps/includes/manipulations/Maps_ParamService.php (modified) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_DisplayMap.php (modified) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_Finddestination.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Maps.php
@@ -120,6 +120,7 @@
121121
122122 // Autoload the "includes/manipulations/" classes.
123123 $manDir = $incDir . 'manipulations/';
 124+ $wgAutoloadClasses['MapsParamCoordSet'] = $manDir . 'Maps_ParamCoordSet.php';
124125 $wgAutoloadClasses['MapsParamService'] = $manDir . 'Maps_ParamService.php';
125126
126127 // Autoload the "includes/parserHooks/" classes.
Index: trunk/extensions/Maps/includes/manipulations/Maps_ParamService.php
@@ -6,7 +6,7 @@
77 * @since 0.7
88 *
99 * @file Maps_ParamService.php
10 - * @ingroup Validator
 10+ * @ingroup Maps
1111 * @ingroup ParameterManipulations
1212 *
1313 * @author Jeroen De Dauw
Index: trunk/extensions/Maps/includes/Maps_Mapper.php
@@ -13,33 +13,6 @@
1414 final class MapsMapper {
1515
1616 /**
17 - * Formats a location to a coordinate set in a certain representation.
18 - *
19 - * @since 0.6
20 - *
21 - * @param string $locations
22 - * @param string $name The name of the parameter.
23 - * @param array $parameters Array containing data about the so far handled parameters.
24 - */
25 - public static function formatLocation( &$location, $name, array $parameters ) {
26 - if ( self::geocoderIsAvailable() ) {
27 - // TODO
28 - //$geoService = array_key_exists( 'geoservice', $parameters ) ? $parameters['geoservice']['value'] : '';
29 - //$mappingService = array_key_exists( 'mappingservice', $parameters ) ? $parameters['mappingservice']['value'] : false;
30 - $location = MapsGeocoders::attemptToGeocodeToString( $location/*, $geoService, $mappingService*/ );
31 - } else {
32 - $location = MapsCoordinateParser::parseAndFormat( $location );
33 - }
34 - }
35 -
36 - /**
37 - * @deprecated Method moved to MapsMappingServices. Will be removed in 0.7.
38 - */
39 - public static function getValidService( $service, $feature ) {
40 - MapsMappingServices::getValidServiceInstance( $service, $feature );
41 - }
42 -
43 - /**
4417 * Determines if a value is a valid map dimension, and optionally corrects it.
4518 *
4619 * @since 0.6
@@ -116,17 +89,6 @@
11790 public static function setMapDimension( &$value, $name, array $parameters, $dimension, $default ) {
11891 self::isMapDimension( $value, $name, $parameters, $dimension, true, $default );
11992 }
120 -
121 - /**
122 - * Returns a boolean indicating if MapsGeocoders is available.
123 - *
124 - * @deprecated - use MapsGeocoders::canGeocode() instead
125 - *
126 - * @return Boolean
127 - */
128 - public static function geocoderIsAvailable() {
129 - return MapsGeocoders::canGeocode();
130 - }
13193
13294 /**
13395 * Add a JavaScript file out of skins/common, or a given relative path.
Index: trunk/extensions/Maps/includes/parserHooks/Maps_Finddestination.php
@@ -139,7 +139,7 @@
140140 * @return string
141141 */
142142 public function render( array $parameters ) {
143 - $canGeocode = MapsMapper::geocoderIsAvailable();
 143+ $canGeocode = MapsGeocoders::canGeocode();
144144
145145 if ( $canGeocode ) {
146146 $location = MapsGeocoders::attemptToGeocode(
Index: trunk/extensions/Maps/includes/parserHooks/Maps_DisplayMap.php
@@ -63,21 +63,12 @@
6464
6565 $params['mappingservice']->default = $egMapsDefaultServices['display_map'];
6666
67 - $params['coordinates'] = new Parameter(
68 - 'coordinates',
69 - Parameter::TYPE_STRING,
70 - null,
71 - array( 'coords', 'location', 'address' ),
72 - array(
73 - new CriterionIsLocation(),
74 - )
75 - );
76 -
 67+ $params['coordinates'] = new Parameter( 'coordinates' );
 68+ $params['coordinates']->addAliases( 'coords', 'location', 'address' );
 69+ $params['coordinates']->addCriteria( new CriterionIsLocation() );
 70+ $params['coordinates']->addManipulations( new MapsParamCoordSet() );
7771 $params['coordinates']->lowerCaseValue = false;
7872
79 - // TODO
80 - $params['coordinates']->outputTypes = array( 'coordinateSet' => array( 'coordinateSet' ) );
81 -
8273 return $params;
8374 }
8475

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r73708Addded distance criterionjeroendedauw03:47, 25 September 2010

Status & tagging log