Index: trunk/extensions/Maps/Services/GoogleMaps3/Maps_GoogleMaps3.php |
— | — | @@ -128,9 +128,9 @@ |
129 | 129 | /** |
130 | 130 | * Loads the Google Maps API v3 and required JS files. |
131 | 131 | * |
132 | | - * @param Parser $parser |
| 132 | + * @param mixed $parserOrOut |
133 | 133 | */ |
134 | | - public static function addGMap3Dependencies( Parser &$parser ) { |
| 134 | + public static function addGMap3Dependencies( &$parserOrOut ) { |
135 | 135 | global $wgJsMimeType, $wgLang; |
136 | 136 | global $egGMaps3OnThisPage, $egMapsStyleVersion, $egMapsJsExt, $egMapsScriptPath; |
137 | 137 | |
— | — | @@ -138,22 +138,32 @@ |
139 | 139 | $egGMaps3OnThisPage = 0; |
140 | 140 | |
141 | 141 | $languageCode = self::getMappedLanguageCode( $wgLang->getCode() ); |
142 | | - $parser->getOutput()->addHeadItem( |
143 | | - Html::element( |
144 | | - 'script', |
145 | | - array( |
146 | | - 'type' => $wgJsMimeType, |
147 | | - 'src' => "http://maps.google.com/maps/api/js?sensor=false&language=$languageCode" |
148 | | - ) |
149 | | - ) . |
150 | | - Html::element( |
151 | | - 'script', |
152 | | - array( |
153 | | - 'type' => $wgJsMimeType, |
154 | | - 'src' => "$egMapsScriptPath/Services/GoogleMaps3/GoogleMap3Functions{$egMapsJsExt}?$egMapsStyleVersion" |
155 | | - ) |
156 | | - ) |
157 | | - ); |
| 142 | + |
| 143 | + if ( $parserOrOut instanceof Parser ) { |
| 144 | + $parser = $parserOrOut; |
| 145 | + |
| 146 | + $parser->getOutput()->addHeadItem( |
| 147 | + Html::element( |
| 148 | + 'script', |
| 149 | + array( |
| 150 | + 'type' => $wgJsMimeType, |
| 151 | + 'src' => "http://maps.google.com/maps/api/js?sensor=false&language=$languageCode" |
| 152 | + ) |
| 153 | + ) . |
| 154 | + Html::element( |
| 155 | + 'script', |
| 156 | + array( |
| 157 | + 'type' => $wgJsMimeType, |
| 158 | + 'src' => "$egMapsScriptPath/Services/GoogleMaps3/GoogleMap3Functions{$egMapsJsExt}?$egMapsStyleVersion" |
| 159 | + ) |
| 160 | + ) |
| 161 | + ); |
| 162 | + } |
| 163 | + else if ( $parserOrOut instanceof OutputPage ) { |
| 164 | + $out = $parserOrOut; |
| 165 | + $out->addScriptFile( "http://maps.google.com/maps/api/js?sensor=false&language=$languageCode" ); |
| 166 | + $out->addScriptFile( "$egMapsScriptPath/Services/GoogleMaps3/GoogleMap3Functions{$egMapsJsExt}?$egMapsStyleVersion" ); |
| 167 | + } |
158 | 168 | } |
159 | 169 | } |
160 | 170 | |
Index: trunk/extensions/Maps/Services/YahooMaps/Maps_YahooMaps.php |
— | — | @@ -154,31 +154,40 @@ |
155 | 155 | /** |
156 | 156 | * Loads the Yahoo! Maps API and required JS files. |
157 | 157 | * |
158 | | - * @param Parser $parser |
| 158 | + * @param mixed $parserOrOut |
159 | 159 | */ |
160 | | - public static function addYMapDependencies( Parser &$parser ) { |
| 160 | + public static function addYMapDependencies( &$parserOrOut ) { |
161 | 161 | global $wgJsMimeType; |
162 | 162 | global $egYahooMapsKey, $egMapsScriptPath, $egYahooMapsOnThisPage, $egMapsStyleVersion, $egMapsJsExt; |
163 | 163 | |
164 | 164 | if ( empty( $egYahooMapsOnThisPage ) ) { |
165 | 165 | $egYahooMapsOnThisPage = 0; |
166 | 166 | |
167 | | - $parser->getOutput()->addHeadItem( |
168 | | - Html::element( |
169 | | - 'script', |
170 | | - array( |
171 | | - 'type' => $wgJsMimeType, |
172 | | - 'src' => "http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=$egYahooMapsKey" |
173 | | - ) |
174 | | - ) . |
175 | | - Html::element( |
176 | | - 'script', |
177 | | - array( |
178 | | - 'type' => $wgJsMimeType, |
179 | | - 'src' => "$egMapsScriptPath/Services/YahooMaps/YahooMapFunctions{$egMapsJsExt}?$egMapsStyleVersion" |
180 | | - ) |
181 | | - ) |
182 | | - ); |
| 167 | + if ( $parserOrOut instanceof Parser ) { |
| 168 | + $parser = $parserOrOut; |
| 169 | + |
| 170 | + $parser->getOutput()->addHeadItem( |
| 171 | + Html::element( |
| 172 | + 'script', |
| 173 | + array( |
| 174 | + 'type' => $wgJsMimeType, |
| 175 | + 'src' => "http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=$egYahooMapsKey" |
| 176 | + ) |
| 177 | + ) . |
| 178 | + Html::element( |
| 179 | + 'script', |
| 180 | + array( |
| 181 | + 'type' => $wgJsMimeType, |
| 182 | + 'src' => "$egMapsScriptPath/Services/YahooMaps/YahooMapFunctions{$egMapsJsExt}?$egMapsStyleVersion" |
| 183 | + ) |
| 184 | + ) |
| 185 | + ); |
| 186 | + } |
| 187 | + else if ( $parserOrOut instanceof OutputPage ) { |
| 188 | + $out = $parserOrOut; |
| 189 | + $out->addScriptFile( "http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=$egYahooMapsKey" ); |
| 190 | + $out->addScriptFile( "$egMapsScriptPath/Services/YahooMaps/YahooMapFunctions{$egMapsJsExt}?$egMapsStyleVersion" ); |
| 191 | + } |
183 | 192 | } |
184 | 193 | } |
185 | 194 | |
Index: trunk/extensions/Maps/Services/OpenLayers/Maps_OpenLayers.php |
— | — | @@ -122,41 +122,51 @@ |
123 | 123 | /** |
124 | 124 | * If this is the first open layers map on the page, load the API, styles and extra JS functions. |
125 | 125 | * |
126 | | - * @param Parser $parser |
| 126 | + * @param mixed $parserOrOut |
127 | 127 | */ |
128 | | - public static function addOLDependencies( Parser &$parser ) { |
| 128 | + public static function addOLDependencies( &$parserOrOut ) { |
129 | 129 | global $wgJsMimeType; |
130 | 130 | global $egOpenLayersOnThisPage, $egMapsStyleVersion, $egMapsJsExt, $egMapsScriptPath; |
131 | 131 | |
132 | 132 | if ( empty( $egOpenLayersOnThisPage ) ) { |
133 | 133 | $egOpenLayersOnThisPage = 0; |
134 | 134 | |
135 | | - $parser->getOutput()->addHeadItem( |
136 | | - Html::element( |
137 | | - 'link', |
138 | | - array( |
139 | | - 'rel' => 'stylesheet', |
140 | | - 'type' => 'text/css', |
141 | | - 'href' => "$egMapsScriptPath/Services/OpenLayers/OpenLayers/theme/default/style.css" |
142 | | - ) |
143 | | - ) . |
144 | | - Html::element( |
145 | | - 'script', |
146 | | - array( |
147 | | - 'type' => $wgJsMimeType, |
148 | | - 'src' => "$egMapsScriptPath/Services/OpenLayers/OpenLayers/OpenLayers.js" |
149 | | - ) |
150 | | - ) . |
151 | | - Html::element( |
152 | | - 'script', |
153 | | - array( |
154 | | - 'type' => $wgJsMimeType, |
155 | | - 'src' => "$egMapsScriptPath/Services/OpenLayers/OpenLayerFunctions{$egMapsJsExt}?$egMapsStyleVersion" |
156 | | - ) |
157 | | - ) . |
158 | | - Html::inlineScript( 'initOLSettings(200, 100);' ) |
159 | | - ); |
160 | | - } |
| 135 | + if ( $parserOrOut instanceof Parser ) { |
| 136 | + $parser = $parserOrOut; |
| 137 | + |
| 138 | + $parser->getOutput()->addHeadItem( |
| 139 | + Html::element( |
| 140 | + 'link', |
| 141 | + array( |
| 142 | + 'rel' => 'stylesheet', |
| 143 | + 'type' => 'text/css', |
| 144 | + 'href' => "$egMapsScriptPath/Services/OpenLayers/OpenLayers/theme/default/style.css" |
| 145 | + ) |
| 146 | + ) . |
| 147 | + Html::element( |
| 148 | + 'script', |
| 149 | + array( |
| 150 | + 'type' => $wgJsMimeType, |
| 151 | + 'src' => "$egMapsScriptPath/Services/OpenLayers/OpenLayers/OpenLayers.js?$egMapsStyleVersion" |
| 152 | + ) |
| 153 | + ) . |
| 154 | + Html::element( |
| 155 | + 'script', |
| 156 | + array( |
| 157 | + 'type' => $wgJsMimeType, |
| 158 | + 'src' => "$egMapsScriptPath/Services/OpenLayers/OpenLayerFunctions{$egMapsJsExt}?$egMapsStyleVersion" |
| 159 | + ) |
| 160 | + ) . |
| 161 | + Html::inlineScript( 'initOLSettings(200, 100);' ) |
| 162 | + ); |
| 163 | + } |
| 164 | + else if ( $parserOrOut instanceof OutputPage ) { |
| 165 | + $out = $parserOrOut; |
| 166 | + $out->addStyle( "$egMapsScriptPath/Services/OpenLayers/OpenLayers/theme/default/style.css" ); |
| 167 | + $out->addScriptFile( "$egMapsScriptPath/Services/OpenLayers/OpenLayers/OpenLayers.js?$egMapsStyleVersion" ); |
| 168 | + $out->addScriptFile( "$egMapsScriptPath/Services/OpenLayers/OpenLayerFunctions{$egMapsJsExt}?$egMapsStyleVersion" ); |
| 169 | + } |
| 170 | + } |
161 | 171 | } |
162 | 172 | |
163 | 173 | /** |
Index: trunk/extensions/Maps/Services/GoogleMaps/Maps_GoogleMaps.php |
— | — | @@ -198,12 +198,12 @@ |
199 | 199 | /** |
200 | 200 | * Loads the Google Maps API and required JS files. |
201 | 201 | * |
202 | | - * @param Parser $parser |
| 202 | + * @param mixed $parserOrOut |
203 | 203 | */ |
204 | | - public static function addGMapDependencies( Parser &$parser ) { |
| 204 | + public static function addGMapDependencies( &$parserOrOut ) { |
205 | 205 | global $wgJsMimeType, $wgLang; |
206 | 206 | global $egGoogleMapsKey, $egGoogleMapsOnThisPage, $egMapsStyleVersion, $egMapsJsExt, $egMapsScriptPath; |
207 | | - |
| 207 | + |
208 | 208 | if ( empty( $egGoogleMapsOnThisPage ) ) { |
209 | 209 | $egGoogleMapsOnThisPage = 0; |
210 | 210 | |
— | — | @@ -211,23 +211,32 @@ |
212 | 212 | |
213 | 213 | $langCode = self::getMappedLanguageCode( $wgLang->getCode() ); |
214 | 214 | |
215 | | - $parser->getOutput()->addHeadItem( |
216 | | - Html::element( |
217 | | - 'script', |
218 | | - array( |
219 | | - 'type' => $wgJsMimeType, |
220 | | - 'src' => "http://maps.google.com/maps?file=api&v=2&key=$egGoogleMapsKey&hl=$langCode" |
221 | | - ) |
222 | | - ) . |
223 | | - Html::element( |
224 | | - 'script', |
225 | | - array( |
226 | | - 'type' => $wgJsMimeType, |
227 | | - 'src' => "$egMapsScriptPath/Services/GoogleMaps/GoogleMapFunctions{$egMapsJsExt}?$egMapsStyleVersion" |
228 | | - ) |
229 | | - ) . |
230 | | - Html::inlineScript( 'window.unload = GUnload;' ) |
231 | | - ); |
| 215 | + if ( $parserOrOut instanceof Parser ) { |
| 216 | + $parser = $parserOrOut; |
| 217 | + |
| 218 | + $parser->getOutput()->addHeadItem( |
| 219 | + Html::element( |
| 220 | + 'script', |
| 221 | + array( |
| 222 | + 'type' => $wgJsMimeType, |
| 223 | + 'src' => "http://maps.google.com/maps?file=api&v=2&key=$egGoogleMapsKey&hl=$langCode" |
| 224 | + ) |
| 225 | + ) . |
| 226 | + Html::element( |
| 227 | + 'script', |
| 228 | + array( |
| 229 | + 'type' => $wgJsMimeType, |
| 230 | + 'src' => "$egMapsScriptPath/Services/GoogleMaps/GoogleMapFunctions{$egMapsJsExt}?$egMapsStyleVersion" |
| 231 | + ) |
| 232 | + ) . |
| 233 | + Html::inlineScript( 'window.unload = GUnload;' ) |
| 234 | + ); |
| 235 | + } |
| 236 | + else if ( $parserOrOut instanceof OutputPage ) { |
| 237 | + $out = $parserOrOut; |
| 238 | + $out->addScriptFile( "http://maps.google.com/maps?file=api&v=2&key=$egGoogleMapsKey&hl=$langCode" ); |
| 239 | + $out->addScriptFile( "$egMapsScriptPath/Services/GoogleMaps/GoogleMapFunctions{$egMapsJsExt}?$egMapsStyleVersion" ); |
| 240 | + } |
232 | 241 | } |
233 | 242 | } |
234 | 243 | |
Index: trunk/extensions/Maps/Maps_Mapper.php |
— | — | @@ -218,7 +218,7 @@ |
219 | 219 | |
220 | 220 | return $allServiceValues; |
221 | 221 | } |
222 | | - |
| 222 | + |
223 | 223 | /** |
224 | 224 | * This function returns the definitions for the parameters used by every map feature. |
225 | 225 | * |