Index: trunk/extensions/UKGeocodingForMaps/ParserFunctions/DisplayUkPoint/UKG_DisplayUkPoint.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | $wgHooks['LanguageGetMagic'][] = 'efUKGDisplayUkPointMagic'; |
21 | 21 | $wgHooks['ParserFirstCallInit'][] = 'efUKGRegisterDisplayPoint'; |
22 | 22 | |
23 | | -$egMapsAvailableFeatures['pf']['hooks'][] = 'UKGDisplayUkPoint'; |
| 23 | +$egMapsFeatures['pf'][] = 'UKGDisplayUkPoint::initialize'; |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Adds the magic words for the parser functions. |
— | — | @@ -94,7 +94,7 @@ |
95 | 95 | |
96 | 96 | if ( ! MapsParserFunctions::paramIsPresent( 'service', $map, $paramInfo ) ) $map['service'] = ''; |
97 | 97 | |
98 | | - $map['service'] = MapsMapper::getValidService( $map['service'], 'pf', 'display_uk_point' ); |
| 98 | + $map['service'] = MapsMapper::getValidService( $map['service'], 'display_uk_point' ); |
99 | 99 | |
100 | 100 | $mapClass = MapsParserFunctions::getParserClassInstance( $map['service'], 'display_uk_point' ); |
101 | 101 | |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | 'criteria' => array( |
119 | 119 | 'in_array' => $egMapsAvailableServices |
120 | 120 | ), |
121 | | - 'default' => $egMapsDefaultServices['pf'] |
| 121 | + 'default' => $egMapsDefaultServices['display_uk_point'] |
122 | 122 | ), |
123 | 123 | 'coordinates' => array( |
124 | 124 | 'aliases' => array( 'coords', 'location', 'locations' ), |
Index: trunk/extensions/UKGeocodingForMaps/ParserFunctions/DisplayUkPoint/UKG_BaseUkPointMap.php |
— | — | @@ -31,12 +31,12 @@ |
32 | 32 | * Handles the request from the parser hook by doing the work that's common for all |
33 | 33 | * mapping services, calling the specific methods and finally returning the resulting output. |
34 | 34 | * |
35 | | - * @param unknown_type $parser |
| 35 | + * @param Parser $parser |
36 | 36 | * @param array $params |
37 | 37 | * |
38 | 38 | * @return html |
39 | 39 | */ |
40 | | - public final function displayMap( &$parser, array $params ) { |
| 40 | + public final function displayMap( Parser &$parser, array $params ) { |
41 | 41 | $this->setMapSettings(); |
42 | 42 | |
43 | 43 | $this->featureParameters = MapsDisplayPoint::$parameters; |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | |
54 | 54 | $this->setZoom(); |
55 | 55 | |
56 | | - $this->addSpecificMapHTML(); |
| 56 | + $this->addSpecificMapHTML( $parser ); |
57 | 57 | } |
58 | 58 | |
59 | 59 | return $this->output . $this->errorList; |
— | — | @@ -89,9 +89,6 @@ |
90 | 90 | foreach ( $this->coordinates as $coordinates ) { |
91 | 91 | $args = explode( '~', $coordinates ); |
92 | 92 | |
93 | | - $args[0] = str_replace( '″', '"', $args[0] ); |
94 | | - $args[0] = str_replace( '′', "'", $args[0] ); |
95 | | - |
96 | 93 | $markerData = array( 'location' => $args[0] ); |
97 | 94 | |
98 | 95 | 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 |
3 | 3 | |
4 | 4 | http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/UKGeocodingForMaps/ |
5 | 5 | |
Index: trunk/extensions/UKGeocodingForMaps/UKGeocodingForMaps.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | die( 'Not an entry point.' ); |
23 | 23 | } |
24 | 24 | |
25 | | -define( 'UKG_VERSION', '0.2 a1' ); |
| 25 | +define( 'UKG_VERSION', '0.3 a1' ); |
26 | 26 | |
27 | 27 | $ukggScriptPath = ( isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions' ) . '/UKGeocodingForMaps'; |
28 | 28 | $ukggDir = dirname( __FILE__ ) . '/'; |
Index: trunk/extensions/UKGeocodingForMaps/UKGeocodingForMaps_Settings.php |
— | — | @@ -26,4 +26,6 @@ |
27 | 27 | include_once $ukggDir . 'GoogleMaps/UKG_GoogleMaps.php'; // Google Maps |
28 | 28 | |
29 | 29 | # 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 @@ |
68 | 68 | * @see MapsBaseMap::addSpecificMapHTML() |
69 | 69 | * |
70 | 70 | */ |
71 | | - public function addSpecificMapHTML() { |
72 | | - global $wgJsMimeType, $egValidatorErrorLevel; |
| 71 | + public function addSpecificMapHTML( Parser $parser ) { |
| 72 | + global $egValidatorErrorLevel; |
73 | 73 | |
74 | | - $onloadFunctions = MapsGoogleMaps::addOverlayOutput( $this->output, $this->mapName, $this->overlays, $this->controls ); |
| 74 | + MapsGoogleMaps::addOverlayOutput( $this->output, $this->mapName, $this->overlays, $this->controls ); |
75 | 75 | |
76 | 76 | if ( $egValidatorErrorLevel >= Validator_ERRORS_WARN ) { |
77 | 77 | $couldNotGeocodeMsg = Xml::escapeJsString( wfMsg( 'ukgeocoding_couldNotGeocode' ) ); |
— | — | @@ -79,15 +79,21 @@ |
80 | 80 | $showErrorJs = ''; |
81 | 81 | } |
82 | 82 | |
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 |
87 | 95 | addOnloadHook( function() { |
88 | 96 | var map = initializeGoogleMap('$this->mapName', |
89 | 97 | { |
90 | | - width: $this->width, |
91 | | - height: $this->height, |
92 | 98 | lat: 0, |
93 | 99 | lon: 0, |
94 | 100 | zoom: $this->zoom, |
— | — | @@ -122,12 +128,10 @@ |
123 | 129 | for(i in markers) { |
124 | 130 | usePointFromPostcode(markers[i], updateGoogleMap); |
125 | 131 | } |
126 | | -}); |
127 | | -/*]]>*/ </script> |
128 | | -EOT; |
129 | | - |
130 | | - $this->output .= $onloadFunctions; |
131 | | - |
| 132 | +}); |
| 133 | +EOT |
| 134 | + ) |
| 135 | + ); |
132 | 136 | } |
133 | 137 | |
134 | 138 | } |
Index: trunk/extensions/UKGeocodingForMaps/GoogleMaps/UKG_GoogleMaps.php |
— | — | @@ -10,4 +10,6 @@ |
11 | 11 | die( 'Not an entry point.' ); |
12 | 12 | } |
13 | 13 | |
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 |