r81226 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81225‎ | r81226 | r81227 >
Date:00:23, 31 January 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Minor tweaks
Modified paths:
  • /trunk/extensions/Maps/includes/parserHooks/Maps_Coordinates.php (modified) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_Distance.php (modified) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_Finddestination.php (modified) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_Geocode.php (modified) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_Geodistance.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/GoogleMaps/GoogleMapFunctions.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/includes/services/GoogleMaps/GoogleMapFunctions.js
@@ -12,7 +12,7 @@
1313 var GOverlays = [
1414 new GLayer("com.panoramio.all"),
1515 new GLayer("com.youtube.all"),
16 - new GLayer("org.wikipedia.en"),
 16+ new GLayer("org.wikipedia.nl"),
1717 new GLayer("com.google.webcams")
1818 ];
1919
Index: trunk/extensions/Maps/includes/parserHooks/Maps_Coordinates.php
@@ -118,14 +118,12 @@
119119 public function render( array $parameters ) {
120120 $parsedCoords = MapsCoordinateParser::parseCoordinates( $parameters['location'] );
121121
122 - if ( $parsedCoords ) {
123 - $output = MapsCoordinateParser::formatCoordinates( $parsedCoords, $parameters['format'], $parameters['directional'] );
124 - } else {
 122+ if ( !$parsedCoords ) {
125123 // The coordinates should be valid when this method gets called.
126124 throw new Exception( 'Attempt to format an invalid set of coordinates' );
127125 }
128126
129 - return $output;
 127+ return MapsCoordinateParser::formatCoordinates( $parsedCoords, $parameters['format'], $parameters['directional'] );
130128 }
131129
132130 /**
@@ -137,4 +135,4 @@
138136 return wfMsg( 'maps-coordinates-description' );
139137 }
140138
141 -}
\ No newline at end of file
 139+}
Index: trunk/extensions/Maps/includes/parserHooks/Maps_Distance.php
@@ -106,8 +106,11 @@
107107 * @return string
108108 */
109109 public function render( array $parameters ) {
110 - $distanceInMeters = MapsDistanceParser::parseDistance( $parameters['distance'] );
111 - return MapsDistanceParser::formatDistance( $distanceInMeters, $parameters['unit'], $parameters['decimals'] );
 110+ return MapsDistanceParser::formatDistance(
 111+ MapsDistanceParser::parseDistance( $parameters['distance'] ),
 112+ $parameters['unit'],
 113+ $parameters['decimals']
 114+ );
112115 }
113116
114117 /**
Index: trunk/extensions/Maps/includes/parserHooks/Maps_Finddestination.php
@@ -163,20 +163,18 @@
164164 $location = MapsCoordinateParser::parseCoordinates( $parameters['location'] );
165165 }
166166
167 - // TODO
168 - if ( $location ) {
169 - $destination = MapsGeoFunctions::findDestination(
170 - $location,
171 - $parameters['bearing'],
172 - MapsDistanceParser::parseDistance( $parameters['distance'] )
173 - );
174 - $output = MapsCoordinateParser::formatCoordinates( $destination, $parameters['format'], $parameters['directional'] );
175 - } else {
 167+ if ( !$location ) {
176168 // The location should be valid when this method gets called.
177 - throw new Exception( 'Attempt to find a destination from an invalid location' );
178 - }
 169+ throw new Exception( 'Attempt to find a destination from an invalid location' );
 170+ }
 171+
 172+ $destination = MapsGeoFunctions::findDestination(
 173+ $location,
 174+ $parameters['bearing'],
 175+ MapsDistanceParser::parseDistance( $parameters['distance'] )
 176+ );
179177
180 - return $output;
 178+ return MapsCoordinateParser::formatCoordinates( $destination, $parameters['format'], $parameters['directional'] );
181179 }
182180
183181 /**
Index: trunk/extensions/Maps/includes/parserHooks/Maps_Geocode.php
@@ -151,13 +151,11 @@
152152 $parameters['directional']
153153 );
154154
155 - $output = $geovalues ? $geovalues : '';
 155+ return $geovalues ? $geovalues : '';
156156 }
157157 else {
158 - $output = htmlspecialchars( wfMsg( 'maps-geocoder-not-available' ) );
 158+ return htmlspecialchars( wfMsg( 'maps-geocoder-not-available' ) );
159159 }
160 -
161 - return $output;
162160 }
163161
164162 /**
Index: trunk/extensions/Maps/includes/parserHooks/Maps_Geodistance.php
@@ -159,14 +159,12 @@
160160 $end = MapsCoordinateParser::parseCoordinates( $parameters['location2'] );
161161 }
162162
163 - if ( $start && $end ) {
164 - $output = MapsDistanceParser::formatDistance( MapsGeoFunctions::calculateDistance( $start, $end ), $parameters['unit'], $parameters['decimals'] );
165 - } else {
 163+ if ( !$start || !$end ) {
166164 // The locations should be valid when this method gets called.
167 - throw new Exception( 'Attempt to find the distance between locations of at least one is invalid' );
 165+ throw new Exception( 'Attempt to find the distance between locations of at least one is invalid' );
168166 }
169167
170 - return $output;
 168+ return MapsDistanceParser::formatDistance( MapsGeoFunctions::calculateDistance( $start, $end ), $parameters['unit'], $parameters['decimals'] );
171169 }
172170
173171 /**
@@ -178,4 +176,4 @@
179177 return wfMsg( 'maps-geodistance-description' );
180178 }
181179
182 -}
\ No newline at end of file
 180+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r81227Follow up to r81226jeroendedauw00:25, 31 January 2011

Status & tagging log