r83500 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83499‎ | r83500 | r83501 >
Date:02:23, 8 March 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
some fixes and renaming
Modified paths:
  • /branches/Maps0.8/Maps.php (modified) (history)
  • /branches/Maps0.8/Maps_Settings.php (modified) (history)
  • /branches/Maps0.8/includes/Maps_Location.php (modified) (history)
  • /branches/Maps0.8/includes/Maps_Mapper.php (modified) (history)
  • /branches/Maps0.8/includes/features/Maps_BasePointMap.php (modified) (history)
  • /branches/Maps0.8/includes/layers/Maps_ImageLayer.php (modified) (history)
  • /branches/Maps0.8/includes/layers/Maps_KMLLayer.php (modified) (history)
  • /branches/Maps0.8/includes/manipulations/Maps_ParamFile.php (added) (history)
  • /branches/Maps0.8/includes/manipulations/Maps_ParamImage.php (deleted) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps/GoogleMaps.php (modified) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMaps.php (modified) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps/jquery.googlemap2.js (modified) (history)

Diff [purge]

Index: branches/Maps0.8/Maps.php
@@ -106,7 +106,7 @@
107107 // Autoload the "includes/manipulations/" classes.
108108 $manDir = $incDir . 'manipulations/';
109109 $wgAutoloadClasses['MapsParamDimension'] = $manDir . 'Maps_ParamDimension.php';
110 -$wgAutoloadClasses['MapsParamImage'] = $manDir . 'Maps_ParamImage.php';
 110+$wgAutoloadClasses['MapsParamFile'] = $manDir . 'Maps_ParamFile.php';
111111 $wgAutoloadClasses['MapsParamLocation'] = $manDir . 'Maps_ParamLocation.php';
112112 $wgAutoloadClasses['MapsParamService'] = $manDir . 'Maps_ParamService.php';
113113 $wgAutoloadClasses['MapsParamZoom'] = $manDir . 'Maps_ParamZoom.php';
@@ -194,7 +194,7 @@
195195 # Mapping services
196196
197197 # Google Maps API v2
198 - // include_once $egMapsDir . 'includes/services/GoogleMaps/GoogleMaps.php';
 198+ include_once $egMapsDir . 'includes/services/GoogleMaps/GoogleMaps.php';
199199
200200 # Google Maps API v3
201201 include_once $egMapsDir . 'includes/services/GoogleMaps3/GoogleMaps3.php';
@@ -264,8 +264,7 @@
265265 'name' => wfMsg( 'maps_name' ),
266266 'version' => Maps_VERSION,
267267 'author' => array(
268 - '[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]',
269 - '[http://www.mediawiki.org/wiki/Extension:Maps/Credits ' . wfMsg( 'maps-others' ) . ']'
 268+ '[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]'
270269 ),
271270 'url' => 'http://www.mediawiki.org/wiki/Extension:Maps',
272271 'description' => wfMsgExt( 'maps_desc', 'parsemag', $servicesList ),
Index: branches/Maps0.8/Maps_Settings.php
@@ -25,7 +25,7 @@
2626
2727 # Array of String. Array containing all the mapping services that will be made available to the user.
2828 $egMapsAvailableServices = array(
29 - //'googlemaps2',
 29+ 'googlemaps2',
3030 'googlemaps3',
3131 'yahoomaps',
3232 'openlayers',
Index: branches/Maps0.8/includes/services/GoogleMaps/GoogleMaps.php
@@ -62,8 +62,8 @@
6363
6464 MapsMappingServices::registerService( 'googlemaps2', 'MapsGoogleMaps' );
6565 $googleMaps = MapsMappingServices::getServiceInstance( 'googlemaps2' );
66 - $googleMaps->addFeature( 'display_point', 'MapsBasePointMaps' );
67 - $googleMaps->addFeature( 'display_map', 'MapsBaseMaps' );
 66+ $googleMaps->addFeature( 'display_point', 'MapsBasePointMap' );
 67+ $googleMaps->addFeature( 'display_map', 'MapsBaseMap' );
6868
6969 return true;
7070 }
Index: branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMaps.php
@@ -85,8 +85,8 @@
8686
8787 $params['kml'] = new ListParameter( 'kml' );
8888 $params['kml']->setDefault( array() );
89 - $params['kml']->addManipulations( new ParamManipulationImplode( ',', "'" ) );
90 -
 89+ $params['kml']->addManipulations( new MapsParamFile() );
 90+
9191 $params['overlays'] = new ListParameter( 'overlays' );
9292 $params['overlays']->setDefault( $egMapsGMapOverlays );
9393 $params['overlays']->addCriteria( new CriterionGoogleOverlay( self::$overlayData ) );
Index: branches/Maps0.8/includes/services/GoogleMaps/jquery.googlemap2.js
@@ -101,7 +101,7 @@
102102 }
103103
104104 if ( options.centre !== false ) {
105 - map.setCenter( options.centre );
 105+ map.setCenter( new GLatLng( options.centre.lat, options.centre.lon ) );
106106 }
107107
108108 if ( options.zoom !== false ) {
Index: branches/Maps0.8/includes/manipulations/Maps_ParamImage.php
@@ -1,34 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Parameter manipulation ensuring the value is an image url.
6 - *
7 - * @since 0.7.1
8 - *
9 - * @file Maps_ParamImage.php
10 - * @ingroup Maps
11 - * @ingroup ParameterManipulations
12 - *
13 - * @author Jeroen De Dauw
14 - */
15 -class MapsParamImage extends ItemParameterManipulation {
16 -
17 - /**
18 - * Constructor.
19 - *
20 - * @since 0.7
21 - */
22 - public function __construct() {
23 - parent::__construct();
24 - }
25 -
26 - /**
27 - * @see ItemParameterManipulation::doManipulation
28 - *
29 - * @since 0.7
30 - */
31 - public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
32 - $value = MapsMapper::getImageUrl( $value );
33 - }
34 -
35 -}
\ No newline at end of file
Index: branches/Maps0.8/includes/manipulations/Maps_ParamFile.php
@@ -0,0 +1,34 @@
 2+<?php
 3+
 4+/**
 5+ * Parameter manipulation ensuring the value is an file url.
 6+ *
 7+ * @since 0.8
 8+ *
 9+ * @file Maps_ParamFile.php
 10+ * @ingroup Maps
 11+ * @ingroup ParameterManipulations
 12+ *
 13+ * @author Jeroen De Dauw
 14+ */
 15+class MapsParamFile extends ItemParameterManipulation {
 16+
 17+ /**
 18+ * Constructor.
 19+ *
 20+ * @since 0.7
 21+ */
 22+ public function __construct() {
 23+ parent::__construct();
 24+ }
 25+
 26+ /**
 27+ * @see ItemParameterManipulation::doManipulation
 28+ *
 29+ * @since 0.7
 30+ */
 31+ public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
 32+ $value = MapsMapper::getFileUrl( $value );
 33+ }
 34+
 35+}
Property changes on: branches/Maps0.8/includes/manipulations/Maps_ParamFile.php
___________________________________________________________________
Added: svn:eol-style
136 + native
Index: branches/Maps0.8/includes/Maps_Mapper.php
@@ -140,21 +140,21 @@
141141 /**
142142 * Resolves the url of images provided as wiki page; leaves others alone.
143143 *
144 - * @since 0.7.1
 144+ * @since 0.8
145145 *
146 - * @param string $image
 146+ * @param string $file
147147 *
148148 * @return string
149149 */
150 - public static function getImageUrl( $image ) {
151 - $title = Title::newFromText( $image, NS_FILE );
 150+ public static function getFileUrl( $file ) {
 151+ $title = Title::newFromText( $file, NS_FILE );
152152
153153 if ( !is_null( $title ) && $title->getNamespace() == NS_FILE && $title->exists() ) {
154154 $imagePage = new ImagePage( $title );
155 - $image = $imagePage->getDisplayedFile()->getURL();
 155+ $file = $imagePage->getDisplayedFile()->getURL();
156156 }
157157
158 - return $image;
 158+ return $file;
159159 }
160160
161161 /**
Index: branches/Maps0.8/includes/layers/Maps_ImageLayer.php
@@ -43,7 +43,7 @@
4444
4545 $params['source'] = new Parameter( 'source' );
4646 $params['source']->addCriteria( new CriterionIsImage() );
47 - $params['source']->addManipulations( new MapsParamImage() );
 47+ $params['source']->addManipulations( new MapsParamFile() );
4848
4949 return $params;
5050 }
Index: branches/Maps0.8/includes/layers/Maps_KMLLayer.php
@@ -34,7 +34,7 @@
3535
3636 $params['source'] = new Parameter( 'source' );
3737 $params['source']->addCriteria( new CriterionIsImage() );
38 - $params['source']->addManipulations( new MapsParamImage() );
 38+ $params['source']->addManipulations( new MapsParamFile() );
3939
4040 $params[] = new Parameter( 'maxdepth', Parameter::TYPE_INTEGER, 2 );
4141
Index: branches/Maps0.8/includes/Maps_Location.php
@@ -373,7 +373,7 @@
374374 'text' => $this->hasText() ? $this->getText() : $defText,
375375 'title' => $this->hasTitle() ? $this->getTitle() : $defTitle,
376376 'address' => $this->getAddress( false ),
377 - 'icon' => $this->hasIcon() ? MapsMapper::getImageUrl( $this->getIcon() ) : $defIconUrl
 377+ 'icon' => $this->hasIcon() ? MapsMapper::getFileUrl( $this->getIcon() ) : $defIconUrl
378378 );
379379 }
380380
Index: branches/Maps0.8/includes/features/Maps_BasePointMap.php
@@ -147,7 +147,7 @@
148148 global $wgTitle;
149149
150150 $parser = new Parser();
151 - $iconUrl = MapsMapper::getImageUrl( $params['icon'] );
 151+ $iconUrl = MapsMapper::getFileUrl( $params['icon'] );
152152 $params['locations'] = array();
153153
154154 foreach ( $params['coordinates'] as $location ) {

Status & tagging log