r71700 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71699‎ | r71700 | r71701 >
Date:15:21, 26 August 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Clean-up for 0.6.6 rc2
Modified paths:
  • /trunk/extensions/Maps/Features/DisplayMap/Maps_BaseMap.php (modified) (history)
  • /trunk/extensions/Maps/Features/DisplayPoint/Maps_BasePointMap.php (modified) (history)
  • /trunk/extensions/Maps/Features/DisplayPoint/Maps_DisplayPoint.php (modified) (history)
  • /trunk/extensions/Maps/Includes/Maps_CoordinateParser.php (modified) (history)
  • /trunk/extensions/Maps/Includes/Maps_Mapper.php (modified) (history)
  • /trunk/extensions/Maps/Maps.php (modified) (history)
  • /trunk/extensions/Maps/Maps_Settings.php (modified) (history)
  • /trunk/extensions/Maps/ParserFunctions/Maps_Coordinates.php (modified) (history)
  • /trunk/extensions/Maps/ParserFunctions/Maps_GeoFunctions.php (modified) (history)
  • /trunk/extensions/Maps/ParserFunctions/Maps_GeocodeFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/ParserFunctions/Maps_Coordinates.php
@@ -54,7 +54,8 @@
5555 $args,
5656 array(
5757 'location' => array(
58 - 'required' => true
 58+ 'required' => true,
 59+ 'tolower' => false
5960 ),
6061 'format' => array(
6162 'criteria' => array(
@@ -85,13 +86,13 @@
8687 }
8788
8889 $errorList = $manager->getErrorList();
89 -
 90+
9091 if ( $errorList != '' ) {
91 - $output .= $errorList;
 92+ $output .= '<br />' . $errorList;
9293 }
9394 } else {
9495 $output = $manager->getErrorList();
9596 }
9697
97 - return array( $output, 'noparse' => true, 'isHTML' => true );
 98+ return array( $output );
9899 }
\ No newline at end of file
Index: trunk/extensions/Maps/ParserFunctions/Maps_GeocodeFunctions.php
@@ -72,47 +72,48 @@
7373
7474 $manager = new ValidatorManager();
7575
76 -$doGeocoding = $manager->manageParameters(
77 - $args,
78 - array(
79 - 'location' => array(
80 - 'required' => true
81 - ),
82 - 'mappingservice' => array(
83 - 'criteria' => array(
84 - 'in_array' => $egMapsAvailableServices
 76+ $doGeocoding = $manager->manageParameters(
 77+ $args,
 78+ array(
 79+ 'location' => array(
 80+ 'required' => true,
 81+ 'tolower' => false
 82+ ),
 83+ 'mappingservice' => array(
 84+ 'criteria' => array(
 85+ 'in_array' => $egMapsAvailableServices
 86+ ),
 87+ 'default' => false
 88+ ),
 89+ 'service' => array(
 90+ 'criteria' => array(
 91+ 'in_array' => $egMapsAvailableGeoServices
 92+ ),
 93+ 'default' => $egMapsDefaultGeoService
 94+ ),
 95+ 'format' => array(
 96+ 'criteria' => array(
 97+ 'in_array' => $egMapsAvailableCoordNotations
 98+ ),
 99+ 'aliases' => array(
 100+ 'notation'
 101+ ),
 102+ 'default' => $egMapsCoordinateNotation
 103+ ),
 104+ 'allowcoordinates' => array(
 105+ 'type' => 'boolean',
 106+ 'default' => $egMapsAllowCoordsGeocoding
 107+ ),
 108+ 'directional' => array(
 109+ 'type' => 'boolean',
 110+ 'default' => $egMapsCoordinateDirectional
 111+ ),
85112 ),
86 - 'default' => false
87 - ),
88 - 'service' => array(
89 - 'criteria' => array(
90 - 'in_array' => $egMapsAvailableGeoServices
91 - ),
92 - 'default' => $egMapsDefaultGeoService
93 - ),
94 - 'format' => array(
95 - 'criteria' => array(
96 - 'in_array' => $egMapsAvailableCoordNotations
97 - ),
98 - 'aliases' => array(
99 - 'notation'
100 - ),
101 - 'default' => $egMapsCoordinateNotation
102 - ),
103 - 'allowcoordinates' => array(
104 - 'type' => 'boolean',
105 - 'default' => $egMapsAllowCoordsGeocoding
106 - ),
107 - 'directional' => array(
108 - 'type' => 'boolean',
109 - 'default' => $egMapsCoordinateDirectional
110 - ),
111 - ),
112 - array( 'location', 'service', 'mappingservice' )
113 -);
114 -
115 -if ( $doGeocoding ) {
116 - $parameters = $manager->getParameters( false );
 113+ array( 'location', 'service', 'mappingservice' )
 114+ );
 115+
 116+ if ( $doGeocoding ) {
 117+ $parameters = $manager->getParameters( false );
117118
118119 if ( self::geocoderIsAvailable() ) {
119120 $geovalues = MapsGeocoder::attemptToGeocodeToString(
Index: trunk/extensions/Maps/ParserFunctions/Maps_GeoFunctions.php
@@ -69,10 +69,12 @@
7070 $args,
7171 array(
7272 'location1' => array(
73 - 'required' => true
 73+ 'required' => true,
 74+ 'tolower' => false
7475 ),
7576 'location2' => array(
76 - 'required' => true
 77+ 'required' => true,
 78+ 'tolower' => false
7779 ),
7880 'unit' => array(
7981 'criteria' => array(
@@ -164,7 +166,8 @@
165167 $args,
166168 array(
167169 'location' => array(
168 - 'required' => true
 170+ 'required' => true,
 171+ 'tolower' => false
169172 ),
170173 'bearing' => array(
171174 'type' => 'float',
Index: trunk/extensions/Maps/Includes/Maps_CoordinateParser.php
@@ -1,19 +1,6 @@
22 <?php
33
44 /**
5 - * File holding class MapsCoordinateParser.
6 - *
7 - * @file Maps_CoordinateParser.php
8 - * @ingroup Maps
9 - *
10 - * @author Jeroen De Dauw
11 - */
12 -
13 -if ( !defined( 'MEDIAWIKI' ) ) {
14 - die( 'Not an entry point.' );
15 -}
16 -
17 -/**
185 * Static class for coordinate validation and parsing.
196 * Supports floats, DMS, decimal degrees, and decimal minutes notations, both directional and non-directional.
207 * Internal representatations are arrays with lat and lon key with float values.
@@ -26,6 +13,7 @@
2714 * regex to also accept dm and dd, which can give unexpected results in certain
2815 * usecases. The different seperator support could also be made nice.
2916 *
 17+ * @file Maps_CoordinateParser.php
3018 * @ingroup Maps
3119 * @since 0.6
3220 *
@@ -382,13 +370,26 @@
383371 * @since 0.6
384372 */
385373 protected static function initializeDirectionLabels() {
 374+ global $egMapsInternatDirectionLabels;
 375+
386376 if ( !self::$i18nDirections ) {
387 - self::$i18nDirections = array(
388 - 'N' => wfMsgForContent( 'maps-abb-north' ),
389 - 'E' => wfMsgForContent( 'maps-abb-east' ),
390 - 'S' => wfMsgForContent( 'maps-abb-south' ),
391 - 'W' => wfMsgForContent( 'maps-abb-west' ),
392 - );
 377+ if ( $egMapsInternatDirectionLabels ) {
 378+ self::$i18nDirections = array(
 379+ 'N' => wfMsgForContent( 'maps-abb-north' ),
 380+ 'E' => wfMsgForContent( 'maps-abb-east' ),
 381+ 'S' => wfMsgForContent( 'maps-abb-south' ),
 382+ 'W' => wfMsgForContent( 'maps-abb-west' ),
 383+ );
 384+ }
 385+ else {
 386+ self::$i18nDirections = array(
 387+ 'N' => 'N',
 388+ 'E' => 'E',
 389+ 'S' => 'S',
 390+ 'W' => 'W',
 391+ );
 392+ }
 393+
393394 self::$directions = array_keys( self::$i18nDirections );
394395 }
395396 }
Index: trunk/extensions/Maps/Includes/Maps_Mapper.php
@@ -1,22 +1,13 @@
22 <?php
3 -/**
4 - * A class that holds static helper functions for common functionality that is not map-specific.
5 - *
6 - * @file Maps_Mapper.php
7 - * @ingroup Maps
8 - *
9 - * @author Jeroen De Dauw
10 - */
113
12 -if ( !defined( 'MEDIAWIKI' ) ) {
13 - die( 'Not an entry point.' );
14 -}
15 -
164 /**
17 - * Class with generic mapping methods.
 5+ * A class that holds static helper functions for generic mapping-related functions.
186 *
197 * @since 0.1
208 *
 9+ * @file Maps_Mapper.php
 10+ * @ingroup Maps
 11+ *
2112 * @author Jeroen De Dauw
2213 */
2314 final class MapsMapper {
@@ -252,4 +243,5 @@
253244 ),
254245 );
255246 }
 247+
256248 }
\ No newline at end of file
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.6.6 rc1' );
 37+ define( 'Maps_VERSION', '0.6.6 rc2' );
3838
3939 // The different coordinate notations.
4040 define( 'Maps_COORDS_FLOAT', 'float' );
Index: trunk/extensions/Maps/Maps_Settings.php
@@ -148,6 +148,9 @@
149149
150150 # Boolean. Sets if geocoded addresses should be stored in a cache.
151151 $egMapsEnableGeoCache = true;
 152+
 153+ # Boolean. Sets if direction labels should be translated to their equivalent in the wiki language or not.
 154+ $egMapsInternatDirectionLabels = true;
152155
153156
154157
Index: trunk/extensions/Maps/Features/DisplayPoint/Maps_DisplayPoint.php
@@ -96,4 +96,4 @@
9797 $location = $segments;
9898 }
9999
100 -}
 100+}
\ No newline at end of file
Index: trunk/extensions/Maps/Features/DisplayPoint/Maps_BasePointMap.php
@@ -94,6 +94,7 @@
9595 ),
9696 'centre' => array(
9797 'aliases' => array( 'center' ),
 98+ 'tolower' => false,
9899 ),
99100 'title' => array(
100101 'default' => $egMapsDefaultTitle
@@ -108,6 +109,7 @@
109110 ),
110111 'coordinates' => array(
111112 'required' => true,
 113+ 'tolower' => false,
112114 'type' => array( 'string', 'list', ';' ),
113115 'aliases' => array( 'coords', 'location', 'locations', 'address', 'addresses' ),
114116 'criteria' => array(
@@ -256,4 +258,5 @@
257259 $this->centreLat = $egMapsMapLat;
258260 $this->centreLon = $egMapsMapLon;
259261 }
 262+
260263 }
\ No newline at end of file
Index: trunk/extensions/Maps/Features/DisplayMap/Maps_BaseMap.php
@@ -96,6 +96,7 @@
9797 ),
9898 'coordinates' => array(
9999 'required' => true,
 100+ 'tolower' => false,
100101 'aliases' => array( 'coords', 'location', 'address' ),
101102 'criteria' => array(
102103 'is_location' => array()

Status & tagging log