r64707 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64706‎ | r64707 | r64708 >
Date:15:04, 7 April 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.3 - made compatible with Maps 0.6
Modified paths:
  • /trunk/extensions/UKGeocodingForMaps/GoogleMaps/UKG_GoogleMaps.php (modified) (history)
  • /trunk/extensions/UKGeocodingForMaps/GoogleMaps/UKG_GoogleMapsDispUkPoint.php (modified) (history)
  • /trunk/extensions/UKGeocodingForMaps/INSTALL (modified) (history)
  • /trunk/extensions/UKGeocodingForMaps/ParserFunctions/DisplayUkPoint/UKG_BaseUkPointMap.php (modified) (history)
  • /trunk/extensions/UKGeocodingForMaps/ParserFunctions/DisplayUkPoint/UKG_DisplayUkPoint.php (modified) (history)
  • /trunk/extensions/UKGeocodingForMaps/UKGeocodingForMaps.php (modified) (history)
  • /trunk/extensions/UKGeocodingForMaps/UKGeocodingForMaps_Settings.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UKGeocodingForMaps/ParserFunctions/DisplayUkPoint/UKG_DisplayUkPoint.php
@@ -19,7 +19,7 @@
2020 $wgHooks['LanguageGetMagic'][] = 'efUKGDisplayUkPointMagic';
2121 $wgHooks['ParserFirstCallInit'][] = 'efUKGRegisterDisplayPoint';
2222
23 -$egMapsAvailableFeatures['pf']['hooks'][] = 'UKGDisplayUkPoint';
 23+$egMapsFeatures['pf'][] = 'UKGDisplayUkPoint::initialize';
2424
2525 /**
2626 * Adds the magic words for the parser functions.
@@ -94,7 +94,7 @@
9595
9696 if ( ! MapsParserFunctions::paramIsPresent( 'service', $map, $paramInfo ) ) $map['service'] = '';
9797
98 - $map['service'] = MapsMapper::getValidService( $map['service'], 'pf', 'display_uk_point' );
 98+ $map['service'] = MapsMapper::getValidService( $map['service'], 'display_uk_point' );
9999
100100 $mapClass = MapsParserFunctions::getParserClassInstance( $map['service'], 'display_uk_point' );
101101
@@ -117,7 +117,7 @@
118118 'criteria' => array(
119119 'in_array' => $egMapsAvailableServices
120120 ),
121 - 'default' => $egMapsDefaultServices['pf']
 121+ 'default' => $egMapsDefaultServices['display_uk_point']
122122 ),
123123 'coordinates' => array(
124124 'aliases' => array( 'coords', 'location', 'locations' ),
Index: trunk/extensions/UKGeocodingForMaps/ParserFunctions/DisplayUkPoint/UKG_BaseUkPointMap.php
@@ -31,12 +31,12 @@
3232 * Handles the request from the parser hook by doing the work that's common for all
3333 * mapping services, calling the specific methods and finally returning the resulting output.
3434 *
35 - * @param unknown_type $parser
 35+ * @param Parser $parser
3636 * @param array $params
3737 *
3838 * @return html
3939 */
40 - public final function displayMap( &$parser, array $params ) {
 40+ public final function displayMap( Parser &$parser, array $params ) {
4141 $this->setMapSettings();
4242
4343 $this->featureParameters = MapsDisplayPoint::$parameters;
@@ -52,7 +52,7 @@
5353
5454 $this->setZoom();
5555
56 - $this->addSpecificMapHTML();
 56+ $this->addSpecificMapHTML( $parser );
5757 }
5858
5959 return $this->output . $this->errorList;
@@ -89,9 +89,6 @@
9090 foreach ( $this->coordinates as $coordinates ) {
9191 $args = explode( '~', $coordinates );
9292
93 - $args[0] = str_replace( '″', '"', $args[0] );
94 - $args[0] = str_replace( '′', "'", $args[0] );
95 -
9693 $markerData = array( 'location' => $args[0] );
9794
9895 if ( count( $args ) > 1 ) {
Index: trunk/extensions/UKGeocodingForMaps/INSTALL
@@ -1,4 +1,4 @@
2 -You can get version 0.2 from SVN at
 2+You can get version 0.3 from SVN at
33
44 http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/UKGeocodingForMaps/
55
Index: trunk/extensions/UKGeocodingForMaps/UKGeocodingForMaps.php
@@ -21,7 +21,7 @@
2222 die( 'Not an entry point.' );
2323 }
2424
25 -define( 'UKG_VERSION', '0.2 a1' );
 25+define( 'UKG_VERSION', '0.3 a1' );
2626
2727 $ukggScriptPath = ( isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions' ) . '/UKGeocodingForMaps';
2828 $ukggDir = dirname( __FILE__ ) . '/';
Index: trunk/extensions/UKGeocodingForMaps/UKGeocodingForMaps_Settings.php
@@ -26,4 +26,6 @@
2727 include_once $ukggDir . 'GoogleMaps/UKG_GoogleMaps.php'; // Google Maps
2828
2929 # Your Google AJAX search API key. Required for displaying Google Maps with the display_uk_point(s) parser function.
30 -$egGoogleAjaxSearchKey = ''; # http://code.google.com/apis/ajaxsearch/signup.html
\ No newline at end of file
 30+$egGoogleAjaxSearchKey = ''; # http://code.google.com/apis/ajaxsearch/signup.html
 31+
 32+$egMapsDefaultServices['display_uk_point'] = 'googlemaps2';
\ No newline at end of file
Index: trunk/extensions/UKGeocodingForMaps/GoogleMaps/UKG_GoogleMapsDispUkPoint.php
@@ -67,10 +67,10 @@
6868 * @see MapsBaseMap::addSpecificMapHTML()
6969 *
7070 */
71 - public function addSpecificMapHTML() {
72 - global $wgJsMimeType, $egValidatorErrorLevel;
 71+ public function addSpecificMapHTML( Parser $parser ) {
 72+ global $egValidatorErrorLevel;
7373
74 - $onloadFunctions = MapsGoogleMaps::addOverlayOutput( $this->output, $this->mapName, $this->overlays, $this->controls );
 74+ MapsGoogleMaps::addOverlayOutput( $this->output, $this->mapName, $this->overlays, $this->controls );
7575
7676 if ( $egValidatorErrorLevel >= Validator_ERRORS_WARN ) {
7777 $couldNotGeocodeMsg = Xml::escapeJsString( wfMsg( 'ukgeocoding_couldNotGeocode' ) );
@@ -79,15 +79,21 @@
8080 $showErrorJs = '';
8181 }
8282
83 - $this->output .= <<<EOT
84 -<div id="$this->mapName"></div>
85 -<div id="{$this->mapName}_errors"></div>
86 -<script type="$wgJsMimeType"> /*<![CDATA[*/
 83+ $this->output .= Html::element(
 84+ 'div',
 85+ array(
 86+ 'id' => $this->mapName,
 87+ 'style' => "width: $this->width; height: $this->height; background-color: #cccccc;",
 88+ ),
 89+ wfMsg('maps-loading-map')
 90+ ) . "<div id='{$this->mapName}_errors'></div>";
 91+
 92+ $parser->getOutput()->addHeadItem(
 93+ Html::inlineScript(
 94+ <<<EOT
8795 addOnloadHook( function() {
8896 var map = initializeGoogleMap('$this->mapName',
8997 {
90 - width: $this->width,
91 - height: $this->height,
9298 lat: 0,
9399 lon: 0,
94100 zoom: $this->zoom,
@@ -122,12 +128,10 @@
123129 for(i in markers) {
124130 usePointFromPostcode(markers[i], updateGoogleMap);
125131 }
126 -});
127 -/*]]>*/ </script>
128 -EOT;
129 -
130 - $this->output .= $onloadFunctions;
131 -
 132+});
 133+EOT
 134+ )
 135+ );
132136 }
133137
134138 }
Index: trunk/extensions/UKGeocodingForMaps/GoogleMaps/UKG_GoogleMaps.php
@@ -10,4 +10,6 @@
1111 die( 'Not an entry point.' );
1212 }
1313
14 -$egMapsServices['googlemaps2']['pf']['display_uk_point'] = array( 'class' => 'UKGGoogleMapsDispUkPoint', 'file' => 'UKGeocodingForMaps/GoogleMaps/UKG_GoogleMapsDispUkPoint.php' );
\ No newline at end of file
 14+$egMapsServices[MapsGoogleMaps::SERVICE_NAME]['features']['display_uk_point'] = 'UKGGoogleMapsDispUkPoint';
 15+
 16+$wgAutoloadClasses['UKGGoogleMapsDispUkPoint'] = dirname( __FILE__ ) . '/UKG_GoogleMapsDispUkPoint.php';
\ No newline at end of file

Status & tagging log