r108801 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108800‎ | r108801 | r108802 >
Date:09:17, 13 January 2012
Author:maxsem
Status:ok
Tags:
Comment:
Handle type:city(population)
Modified paths:
  • /trunk/extensions/GeoData/CoordinatesParserFunction.php (modified) (history)
  • /trunk/extensions/GeoData/tests/TagTest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GeoData/tests/TagTest.php
@@ -39,6 +39,14 @@
4040 '{{#coordinates: primary|10|20}}',
4141 array( 'lat' => 10, 'lon' => 20, 'globe' => 'earth', 'primary' => true ),
4242 ),
 43+ array(
 44+ '{{#coordinates: 10|20|type:city}}',
 45+ array( 'lat' => 10, 'lon' => 20, 'globe' => 'earth', 'type' => 'city' ),
 46+ ),
 47+ array(
 48+ '{{#coordinates: 10|20|type:city(666)}}',
 49+ array( 'lat' => 10, 'lon' => 20, 'globe' => 'earth', 'type' => 'city' ),
 50+ ),
4351 array(
4452 '{{#coordinates:10|20|globe:Moon dim:10_region:RU-mos}}',
4553 array( 'lat' => 10, 'lon' => 20, 'globe' => 'moon', 'country' => 'RU', 'region' => 'MOS' ),
Index: trunk/extensions/GeoData/CoordinatesParserFunction.php
@@ -144,7 +144,9 @@
145145 $coord->dim = $dim;
146146 }
147147 }
148 - $coord->type = isset( $args['type'] ) ? $args['type'] : null;
 148+ if ( isset( $args['type'] ) ) {
 149+ $coord->type = preg_replace( '/\(.*?\).*$/', '', $args['type'] );
 150+ }
149151 $coord->name = isset( $args['name'] ) ? $args['name'] : null;
150152 if ( isset( $args['region'] ) ) {
151153 $code = strtoupper( $args['region'] );

Status & tagging log