r64205 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64204‎ | r64205 | r64206 >
Date:01:39, 26 March 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.5.6 - rewriting coordinate validation and parsing
* Fixed to MapsCoordinateParser
* Added lang keys moved over from Semantic Maps (follow up to r64204)
Modified paths:
  • /trunk/extensions/Maps/Maps.i18n.php (modified) (history)
  • /trunk/extensions/Maps/Maps_CoordinateParser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Maps.i18n.php
@@ -21,12 +21,20 @@
2222 Available mapping services: $1",
2323 'maps_map' => 'Map',
2424
 25+ // Coordinate handling
 26+ 'maps-abb-north' => 'N',
 27+ 'maps-abb-east' => 'E',
 28+ 'maps-abb-south' => 'S',
 29+ 'maps-abb-west' => 'W',
 30+ 'maps-latitude' => 'Latitude:',
 31+ 'maps-longitude' => 'Longitude:',
 32+
2533 // Coordinate errors
2634 'maps_coordinates_missing' => 'No coordinates provided for the map.',
2735 'maps_geocoding_failed' => 'The following {{PLURAL:$2|address|addresses}} could not be geocoded: $1.',
2836 'maps_geocoding_failed_for' => 'The following {{PLURAL:$2|address|addresses}} could not be geocoded and {{PLURAL:$2|has|have}} been omitted from the map:
2937 $1',
30 - 'maps_unrecognized_coords' => 'The following coordinates were not recognized: $1.',
 38+ 'maps_unrecognized_coords' => 'The following {{PLURAL:$2|coordinate was|coordinates were}} not recognized: $1.',
3139 'maps_unrecognized_coords_for' => 'The following {{PLURAL:$2|coordinate was|coordinates were}} not recognized and {{PLURAL:$2|has|have}} been omitted from the map:
3240 $1',
3341 'maps_map_cannot_be_displayed' => 'The map cannot be displayed.',
Index: trunk/extensions/Maps/Maps_CoordinateParser.php
@@ -56,12 +56,22 @@
5757 public static function formatCoordinates( $coordinates, $targetType = COORDS_FLOAT, $directional = false ) {
5858 $coordinates = trim( $coordinates );
5959
 60+ /*
 61+
 62+ $value = str_replace( array( '°', '°' ), '°', $value );
 63+ $value = str_replace( array( '´', '´' ), '´', $value );
 64+ $value = str_replace( array( '″', '″', "''", '"', '´´', SM_GEO_MIN . SM_GEO_MIN ), SM_GEO_SEC, $value );
 65+ $value = str_replace( array( '′', '′', "'", '´' ), SM_GEO_MIN, $value );
 66+
 67+ */
 68+
6069 $coordinates = self::handleI18nLabels( $coordinates );
6170
6271 $coordsType = self::getCoordinatesType( $coordinates );
6372
6473 // If getCoordinatesType returned false, the provided value is invalid.
6574 if ( $coordsType === false ) {
 75+ die('WUHA');
6676 return false;
6777 }
6878
@@ -197,14 +207,14 @@
198208 */
199209 private static function handleI18nLabels( $coordinates ) {
200210 self::initializeDirectionLabels();
201 - $coordinates = str_replace( self::$mI18nDirections, self::$mDirections, $coordinates );
 211+ return str_replace( self::$mI18nDirections, self::$mDirections, $coordinates );
202212 }
203213
204214 /**
205215 * Initialize the cache for internationalized direction labels if not done yet.
206216 */
207217 private static function initializeDirectionLabels() {
208 - if ( !$this->mI18nDirections ) {
 218+ if ( !self::$mI18nDirections ) {
209219 self::$mI18nDirections = array(
210220 'N' => wfMsgForContent( 'maps-abb-north' ),
211221 'E' => wfMsgForContent( 'maps-abb-east' ),

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r64204Changes for 0.5.6 - rewriting coordinate validation and parsing...jeroendedauw01:38, 26 March 2010

Status & tagging log