r83358 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83357‎ | r83358 | r83359 >
Date:02:30, 6 March 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
throw out no-longer needed complexity ftw
Modified paths:
  • /branches/Maps0.8/Maps_Settings.php (modified) (history)
  • /branches/Maps0.8/includes/features/Maps_BaseMap.php (modified) (history)
  • /branches/Maps0.8/includes/features/Maps_BasePointMap.php (modified) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps3/GoogleMaps3.php (modified) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps3/Maps_GoogleMaps3DispMap.php (deleted) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps3/Maps_GoogleMaps3DispPoint.php (deleted) (history)
  • /branches/Maps0.8/includes/services/OpenLayers/Maps_OpenLayersDispMap.php (deleted) (history)
  • /branches/Maps0.8/includes/services/OpenLayers/Maps_OpenLayersDispPoint.php (deleted) (history)
  • /branches/Maps0.8/includes/services/OpenLayers/OpenLayers.php (modified) (history)
  • /branches/Maps0.8/includes/services/YahooMaps/Maps_YahooMapsDispMap.php (deleted) (history)
  • /branches/Maps0.8/includes/services/YahooMaps/Maps_YahooMapsDispPoint.php (deleted) (history)
  • /branches/Maps0.8/includes/services/YahooMaps/YahooMaps.php (modified) (history)

Diff [purge]

Index: branches/Maps0.8/Maps_Settings.php
@@ -83,7 +83,7 @@
8484 # Commenting or removing a mapping service will make Maps completely ignore it, and so improve performance.
8585
8686 # Google Maps API v2
87 - // include_once $egMapsDir . 'includes/services/GoogleMaps/GoogleMaps.php';
 87+ include_once $egMapsDir . 'includes/services/GoogleMaps/GoogleMaps.php';
8888
8989 # Google Maps API v3
9090 include_once $egMapsDir . 'includes/services/GoogleMaps3/GoogleMaps3.php';
@@ -99,7 +99,7 @@
100100
101101 # Array of String. Array containing all the mapping services that will be made available to the user.
102102 $egMapsAvailableServices = array(
103 - //'googlemaps2',
 103+ 'googlemaps2',
104104 'googlemaps3',
105105 //'yahoomaps',
106106 'openlayers',
Index: branches/Maps0.8/includes/services/GoogleMaps3/Maps_GoogleMaps3DispPoint.php
@@ -1,27 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Class for handling the display_point(s) parser functions with Google Maps v3.
6 - *
7 - * @file Maps_GoogleMaps3DispPoint.php
8 - * @ingroup MapsGoogleMaps3
9 - *
10 - * @author Jeroen De Dauw
11 - */
12 -final class MapsGoogleMaps3DispPoint extends MapsBasePointMap {
13 -
14 - /**
15 - * @see MapsBasePointMap::getMapHTML()
16 - */
17 - public function getMapHTML( array $params, Parser $parser, $mapName ) {
18 - return Html::element(
19 - 'div',
20 - array(
21 - 'id' => $mapName,
22 - 'style' => "width: {$params['width']}; height: {$params['height']}; background-color: #cccccc; overflow: hidden;",
23 - ),
24 - wfMsg( 'maps-loading-map' )
25 - );
26 - }
27 -
28 -}
Index: branches/Maps0.8/includes/services/GoogleMaps3/Maps_GoogleMaps3DispMap.php
@@ -1,26 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Class for handling the display_map parser hook with Google Maps v3.
6 - *
7 - * @ingroup MapsGoogleMaps3
8 - *
9 - * @author Jeroen De Dauw
10 - */
11 -final class MapsGoogleMaps3DispMap extends MapsBaseMap {
12 -
13 - /**
14 - * @see MapsBaseMap::getMapHTML()
15 - */
16 - public function getMapHTML( array $params, Parser $parser, $mapName ) {
17 - return Html::element(
18 - 'div',
19 - array(
20 - 'id' => $mapName,
21 - 'style' => "width: {$params['width']}; height: {$params['height']}; background-color: #cccccc; overflow: hidden;",
22 - ),
23 - wfMsg( 'maps-loading-map' )
24 - );
25 - }
26 -
27 -}
Index: branches/Maps0.8/includes/services/GoogleMaps3/GoogleMaps3.php
@@ -51,16 +51,14 @@
5252 global $wgAutoloadClasses;
5353
5454 $wgAutoloadClasses['MapsGoogleMaps3'] = dirname( __FILE__ ) . '/Maps_GoogleMaps3.php';
55 - $wgAutoloadClasses['MapsGoogleMaps3DispMap'] = dirname( __FILE__ ) . '/Maps_GoogleMaps3DispMap.php';
56 - $wgAutoloadClasses['MapsGoogleMaps3DispPoint'] = dirname( __FILE__ ) . '/Maps_GoogleMaps3DispPoint.php';
5755 $wgAutoloadClasses['MapsParamGMap3Type'] = dirname( __FILE__ ) . '/Maps_ParamGMap3Type.php';
5856 $wgAutoloadClasses['MapsParamGMap3Typestyle'] = dirname( __FILE__ ) . '/Maps_ParamGMap3Typestyle.php';
5957 $wgAutoloadClasses['MapsParamGMap3Zoomstyle'] = dirname( __FILE__ ) . '/Maps_ParamGMap3Zoomstyle.php';
6058
6159 MapsMappingServices::registerService( 'googlemaps3', 'MapsGoogleMaps3' );
6260 $googleMaps = MapsMappingServices::getServiceInstance( 'googlemaps3' );
63 - $googleMaps->addFeature( 'display_map', 'MapsGoogleMaps3DispMap' );
64 - $googleMaps->addFeature( 'display_point', 'MapsGoogleMaps3DispPoint' );
 61+ $googleMaps->addFeature( 'display_map', 'MapsBaseMap' );
 62+ $googleMaps->addFeature( 'display_point', 'MapsBasePointMap' );
6563
6664 return true;
6765 }
\ No newline at end of file
Index: branches/Maps0.8/includes/services/YahooMaps/Maps_YahooMapsDispPoint.php
@@ -1,27 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Class for handling the display_point(s) parser functions with Yahoo! Maps.
6 - *
7 - * @file Maps_YahooMapsDispPoint.php
8 - * @ingroup MapsYahooMaps
9 - *
10 - * @author Jeroen De Dauw
11 - */
12 -class MapsYahooMapsDispPoint extends MapsBasePointMap {
13 -
14 - /**
15 - * @see MapsBasePointMap::getMapHTML()
16 - */
17 - public function getMapHTML( array $params, Parser $parser, $mapName ) {
18 - return Html::element(
19 - 'div',
20 - array(
21 - 'id' => $mapName,
22 - 'style' => "width: {$params['width']}; height: {$params['height']}; background-color: #cccccc; overflow: hidden;",
23 - ),
24 - wfMsg( 'maps-loading-map' )
25 - );
26 - }
27 -
28 -}
Index: branches/Maps0.8/includes/services/YahooMaps/Maps_YahooMapsDispMap.php
@@ -1,27 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Class for handling the display_map parser hook with Yahoo! Maps
6 - *
7 - * @file Maps_YahooMapsDispMap.php
8 - * @ingroup MapsYahooMaps
9 - *
10 - * @author Jeroen De Dauw
11 - */
12 -class MapsYahooMapsDispMap extends MapsBaseMap {
13 -
14 - /**
15 - * @see MapsBaseMap::getMapHTML()
16 - */
17 - public function getMapHTML( array $params, Parser $parser, $mapName ) {
18 - return Html::element(
19 - 'div',
20 - array(
21 - 'id' => $mapName,
22 - 'style' => "width: {$params['width']}; height: {$params['height']}; background-color: #cccccc; overflow: hidden;",
23 - ),
24 - wfMsg( 'maps-loading-map' )
25 - );
26 - }
27 -
28 -}
\ No newline at end of file
Index: branches/Maps0.8/includes/services/YahooMaps/YahooMaps.php
@@ -27,15 +27,13 @@
2828
2929 $wgAutoloadClasses['MapsParamYMapType'] = dirname( __FILE__ ) . '/Maps_ParamYMapType.php';
3030 $wgAutoloadClasses['MapsYahooMaps'] = dirname( __FILE__ ) . '/Maps_YahooMaps.php';
31 - $wgAutoloadClasses['MapsYahooMapsDispMap'] = dirname( __FILE__ ) . '/Maps_YahooMapsDispMap.php';
32 - $wgAutoloadClasses['MapsYahooMapsDispPoint'] = dirname( __FILE__ ) . '/Maps_YahooMapsDispPoint.php';
3331
3432 MapsMappingServices::registerService(
3533 'yahoomaps',
3634 'MapsYahooMaps',
3735 array(
38 - 'display_point' => 'MapsYahooMapsDispPoint',
39 - 'display_map' => 'MapsYahooMapsDispMap'
 36+ 'display_point' => 'MapsBasePointMap',
 37+ 'display_map' => 'MapsBaseMap'
4038 )
4139 );
4240
Index: branches/Maps0.8/includes/services/OpenLayers/Maps_OpenLayersDispPoint.php
@@ -1,27 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Class for handling the display_point(s) parser functions with OpenLayers.
6 - *
7 - * @file Maps_OpenLayersDispPoint.php
8 - * @ingroup MapsOpenLayers
9 - *
10 - * @author Jeroen De Dauw
11 - */
12 -class MapsOpenLayersDispPoint extends MapsBasePointMap {
13 -
14 - /**
15 - * @see MapsBasePointMap::getMapHTML()
16 - */
17 - public function getMapHTML( array $params, Parser $parser, $mapName ) {
18 - return Html::element(
19 - 'div',
20 - array(
21 - 'id' => $mapName,
22 - 'style' => "width: {$params['width']}; height: {$params['height']}; background-color: #cccccc; overflow: hidden;",
23 - ),
24 - wfMsg( 'maps-loading-map' )
25 - );
26 - }
27 -
28 -}
Index: branches/Maps0.8/includes/services/OpenLayers/Maps_OpenLayersDispMap.php
@@ -1,44 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Class for handling the display_map parser hook with OpenLayers.
6 - *
7 - * @file Maps_OpenLayersDispMap.php
8 - * @ingroup MapsOpenLayers
9 - *
10 - * @author Jeroen De Dauw
11 - */
12 -class MapsOpenLayersDispMap extends MapsBaseMap {
13 -
14 - /**
15 - * @see MapsBaseMap::getJSONObject
16 - *
17 - * @since 0.7.3
18 - *
19 - * @param array $params
20 - * @param Parser $parser
21 - *
22 - * @return mixed
23 - */
24 - protected function getJSONObject( array $params, Parser $parser ) {
25 - global $wgLang;
26 - $params['langCode'] = $wgLang->getCode();
27 - $params['mapId'] = $this->service->getMapId( false );
28 - return $params;
29 - }
30 -
31 - /**
32 - * @see MapsBaseMap::getMapHTML
33 - */
34 - public function getMapHTML( array $params, Parser $parser, $mapName ) {
35 - return Html::element(
36 - 'div',
37 - array(
38 - 'id' => $mapName,
39 - 'style' => "width: {$params['width']}; height: {$params['height']}; background-color: #cccccc; overflow: hidden;",
40 - ),
41 - wfMsg( 'maps-loading-map' )
42 - );
43 - }
44 -
45 -}
Index: branches/Maps0.8/includes/services/OpenLayers/OpenLayers.php
@@ -40,15 +40,13 @@
4141
4242 $wgAutoloadClasses['CriterionOLLayer'] = dirname( __FILE__ ) . '/CriterionOLLayer.php';
4343 $wgAutoloadClasses['MapsOpenLayers'] = dirname( __FILE__ ) . '/Maps_OpenLayers.php';
44 -$wgAutoloadClasses['MapsOpenLayersDispMap'] = dirname( __FILE__ ) . '/Maps_OpenLayersDispMap.php';
45 -$wgAutoloadClasses['MapsOpenLayersDispPoint'] = dirname( __FILE__ ) . '/Maps_OpenLayersDispPoint.php';
4644 $wgAutoloadClasses['MapsParamOLLayers'] = dirname( __FILE__ ) . '/Maps_ParamOLLayers.php';
4745
4846 MapsMappingServices::registerService(
4947 'openlayers',
5048 'MapsOpenLayers',
5149 array(
52 - 'display_point' => 'MapsOpenLayersDispPoint',
53 - 'display_map' => 'MapsOpenLayersDispMap'
 50+ 'display_point' => 'MapsBasePointMap',
 51+ 'display_map' => 'MapsBaseMap'
5452 )
5553 );
Index: branches/Maps0.8/includes/features/Maps_BasePointMap.php
@@ -10,7 +10,7 @@
1111 *
1212 * @author Jeroen De Dauw
1313 */
14 -abstract class MapsBasePointMap {
 14+class MapsBasePointMap {
1515
1616 /**
1717 * @var iMappingService
@@ -19,19 +19,6 @@
2020
2121 protected $markerData = array();
2222
23 - /**
24 - * Returns the HTML to display the map.
25 - *
26 - * @since 0.8
27 - *
28 - * @param array $params
29 - * @param Parser $parser
30 - * @param string $mapName
31 - *
32 - * @return string
33 - */
34 - protected abstract function getMapHTML( array $params, Parser $parser, $mapName );
35 -
3623 public function __construct( iMappingService $service ) {
3724 $this->service = $service;
3825 }
@@ -89,6 +76,28 @@
9077 }
9178
9279 /**
 80+ * Returns the HTML to display the map.
 81+ *
 82+ * @since 0.8
 83+ *
 84+ * @param array $params
 85+ * @param Parser $parser
 86+ * @param string $mapName
 87+ *
 88+ * @return string
 89+ */
 90+ protected function getMapHTML( array $params, Parser $parser, $mapName ) {
 91+ return Html::element(
 92+ 'div',
 93+ array(
 94+ 'id' => $mapName,
 95+ 'style' => "width: {$params['width']}; height: {$params['height']}; background-color: #cccccc; overflow: hidden;",
 96+ ),
 97+ wfMsg( 'maps-loading-map' )
 98+ );
 99+ }
 100+
 101+ /**
93102 * Returns the JSON with the maps data.
94103 *
95104 * @since 0.8
Index: branches/Maps0.8/includes/features/Maps_BaseMap.php
@@ -10,7 +10,7 @@
1111 *
1212 * @author Jeroen De Dauw
1313 */
14 -abstract class MapsBaseMap {
 14+class MapsBaseMap {
1515
1616 /**
1717 * @since 0.6.x
@@ -27,19 +27,6 @@
2828 protected $properties = array();
2929
3030 /**
31 - * Returns the HTML to display the map.
32 - *
33 - * @since 0.8
34 - *
35 - * @param array $params
36 - * @param Parser $parser
37 - * @param string $mapName
38 - *
39 - * @return string
40 - */
41 - protected abstract function getMapHTML( array $params, Parser $parser, $mapName );
42 -
43 - /**
4431 * Constructor.
4532 *
4633 * @param MapsMappingService $service
@@ -91,6 +78,28 @@
9279 }
9380
9481 /**
 82+ * Returns the HTML to display the map.
 83+ *
 84+ * @since 0.8
 85+ *
 86+ * @param array $params
 87+ * @param Parser $parser
 88+ * @param string $mapName
 89+ *
 90+ * @return string
 91+ */
 92+ protected function getMapHTML( array $params, Parser $parser, $mapName ) {
 93+ return Html::element(
 94+ 'div',
 95+ array(
 96+ 'id' => $mapName,
 97+ 'style' => "width: {$params['width']}; height: {$params['height']}; background-color: #cccccc; overflow: hidden;",
 98+ ),
 99+ wfMsg( 'maps-loading-map' )
 100+ );
 101+ }
 102+
 103+ /**
95104 * Returns the JSON with the maps data.
96105 *
97106 * @since 0.7.3

Follow-up revisions

RevisionCommit summaryAuthorDate
r83359follow up to r83358jeroendedauw02:32, 6 March 2011

Status & tagging log