Index: trunk/extensions/Maps/Maps.php |
— | — | @@ -51,6 +51,8 @@ |
52 | 52 | |
53 | 53 | $egMapsStyleVersion = $wgStyleVersion . '-' . Maps_VERSION; |
54 | 54 | |
| 55 | + $egMapsUseRL = false; //method_exists( 'OutputPage', 'addModules' ); |
| 56 | + |
55 | 57 | $wgAutoloadClasses['MapsHooks'] = dirname( __FILE__ ) . '/Maps.hooks.php'; |
56 | 58 | |
57 | 59 | // Autoload the "includes/" classes and interfaces. |
— | — | @@ -160,7 +162,6 @@ |
161 | 163 | function efMapsSetup() { |
162 | 164 | global $wgExtensionCredits, $wgLang, $wgExtraNamespaces, $wgNamespaceAliases; |
163 | 165 | global $egMapsDefaultService, $egMapsAvailableServices; |
164 | | - global $egMapsDir, $egMapsUseMinJs; |
165 | 166 | |
166 | 167 | // This function has been deprecated in 1.16, but needed for earlier versions. |
167 | 168 | // It's present in 1.16 as a stub, but lets check if it exists in case it gets removed at some point. |
Index: trunk/extensions/Maps/Maps_Settings.php |
— | — | @@ -408,7 +408,7 @@ |
409 | 409 | 'ol-wms' => "<script type='$wgJsMimeType' src='http://clients.multimap.com/API/maps/1.1/metacarta_04'></script>", |
410 | 410 | ); |
411 | 411 | |
412 | | - if ( !method_exists( 'OutputPage', 'addModules' ) ) { |
| 412 | + if ( !$egMapsUseRL ) { |
413 | 413 | $egMapsOLLayerDependencies['osm'] = "<script type='$wgJsMimeType' src='$egMapsScriptPath/includes/services/OpenLayers/OSM/OpenStreetMap.js?$egMapsStyleVersion'></script>"; |
414 | 414 | } |
415 | 415 | |
Index: trunk/extensions/Maps/includes/Maps_MappingService.php |
— | — | @@ -105,6 +105,8 @@ |
106 | 106 | * @since 0.6.3 |
107 | 107 | */ |
108 | 108 | public final function addDependencies( &$parserOrOut ) { |
| 109 | + global $egMapsUseRL; |
| 110 | + |
109 | 111 | $dependencies = $this->getDependencyHtml(); |
110 | 112 | |
111 | 113 | // Only add a head item when there are dependencies. |
— | — | @@ -113,7 +115,7 @@ |
114 | 116 | $parserOrOut->getOutput()->addHeadItem( $dependencies ); |
115 | 117 | } |
116 | 118 | |
117 | | - if ( method_exists( $parserOrOut->getOutput(), 'addModules' ) ) { |
| 119 | + if ( $egMapsUseRL /* method_exists( $parserOrOut->getOutput(), 'addModules' ) */ ) { |
118 | 120 | $parserOrOut->getOutput()->addModules( $this->getResourceModules() ); |
119 | 121 | } |
120 | 122 | } |
— | — | @@ -122,7 +124,7 @@ |
123 | 125 | $parserOrOut->addHeadItem( md5( $dependencies ), $dependencies ); |
124 | 126 | } |
125 | 127 | |
126 | | - if ( method_exists( $parserOrOut, 'addModules' ) ) { |
| 128 | + if ( $egMapsUseRL /* method_exists( $parserOrOut, 'addModules' ) */ ) { |
127 | 129 | $parserOrOut->addModules( $this->getResourceModules() ); |
128 | 130 | } |
129 | 131 | } |
Index: trunk/extensions/Maps/includes/services/OpenLayers/Maps_ParamOLLayers.php |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | * @since 0.7 |
31 | 31 | */ |
32 | 32 | public function manipulate( Parameter &$parameter, array &$parameters ) { |
33 | | - global $egMapsOLLayerGroups, $egMapsOLAvailableLayers; |
| 33 | + global $egMapsOLLayerGroups, $egMapsOLAvailableLayers, $egMapsUseRL; |
34 | 34 | |
35 | 35 | $layerDefs = array(); |
36 | 36 | $layerNames = array(); |
— | — | @@ -88,9 +88,9 @@ |
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | | - $parameter->setValue( method_exists( 'OutputPage', 'addModules' ) ? $layerDefs : '[' . implode( ',', $layerDefs ) . ']' ); |
| 92 | + $parameter->setValue( $egMapsUseRL ? $layerDefs : '[' . implode( ',', $layerDefs ) . ']' ); |
93 | 93 | |
94 | | - MapsOpenLayers::addLayerDependencies( $this->getDependencies( $layerNames ) ); |
| 94 | + MapsMappingServices::getServiceInstance( 'openlayers' )->addLayerDependencies( $this->getDependencies( $layerNames ) ); |
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
Index: trunk/extensions/Maps/includes/services/OpenLayers/Maps_OpenLayersDispMap.php |
— | — | @@ -32,11 +32,11 @@ |
33 | 33 | * @since 0.7.3 |
34 | 34 | */ |
35 | 35 | public function getMapHTML( array $params, Parser $parser ) { |
36 | | - global $wgLang; |
| 36 | + global $wgLang, $egMapsUseRL; |
37 | 37 | |
38 | 38 | $mapName = $this->service->getMapId(); |
39 | 39 | |
40 | | - if ( !method_exists( 'OutputPage', 'addModules' ) ) { |
| 40 | + if ( !$egMapsUseRL ) { |
41 | 41 | $langCode = $wgLang->getCode(); |
42 | 42 | $centreLat = MapsMapper::encodeJsVar( $params['centre']['lat'] ); |
43 | 43 | $centreLon = MapsMapper::encodeJsVar( $params['centre']['lon'] ); |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | $centreLon, |
50 | 50 | $centreLat, |
51 | 51 | $zoom, |
52 | | - {$params['layers'][0]}, |
| 52 | + {$params['layers']}, |
53 | 53 | [{$params['controls']}], |
54 | 54 | [], |
55 | 55 | "$langCode" |
Index: trunk/extensions/Maps/includes/services/OpenLayers/Maps_OpenLayers.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | * @since 0.7 |
33 | 33 | */ |
34 | 34 | public function addParameterInfo( array &$params ) { |
35 | | - global $egMapsOLLayers, $egMapsOLControls; |
| 35 | + global $egMapsOLLayers, $egMapsOLControls, $egMapsUseRL; |
36 | 36 | |
37 | 37 | $params['zoom']->addCriteria( new CriterionInRange( 0, 19 ) ); |
38 | 38 | $params['zoom']->setDefault( self::getDefaultZoom() ); |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | new ParamManipulationFunctions( 'strtolower' ) |
45 | 45 | ); |
46 | 46 | |
47 | | - if ( !method_exists( 'OutputPage', 'addModules' ) ) { |
| 47 | + if ( !$egMapsUseRL ) { |
48 | 48 | $params['controls']->addManipulations( |
49 | 49 | new ParamManipulationImplode( ',', "'" ) |
50 | 50 | ); |
— | — | @@ -112,9 +112,9 @@ |
113 | 113 | * @return array |
114 | 114 | */ |
115 | 115 | protected function getDependencies() { |
116 | | - global $egMapsStyleVersion, $egMapsScriptPath; |
| 116 | + global $egMapsStyleVersion, $egMapsScriptPath, $egMapsUseRL; |
117 | 117 | |
118 | | - if ( method_exists( 'OutputPage', 'addModules' ) ) { |
| 118 | + if ( $egMapsUseRL ) { |
119 | 119 | return array(); |
120 | 120 | } |
121 | 121 | else { |
Index: trunk/extensions/Maps/includes/Maps_Mapper.php |
— | — | @@ -45,9 +45,7 @@ |
46 | 46 | public static function addInlineScript( iMappingService $service, $script ) { |
47 | 47 | static $addOnloadJs = false; |
48 | 48 | |
49 | | - $hasRL = method_exists( 'ParserOutput', 'addModules' ); |
50 | | - |
51 | | - if ( $hasRL && !$addOnloadJs ) { |
| 49 | + if ( method_exists( 'OutputPage', 'addModules' ) && !$addOnloadJs ) { |
52 | 50 | global $egMapsScriptPath, $egMapsStyleVersion; |
53 | 51 | |
54 | 52 | $service->addDependency( |
— | — | @@ -58,7 +56,7 @@ |
59 | 57 | } |
60 | 58 | |
61 | 59 | $service->addDependency( Html::inlineScript( |
62 | | - ( $hasRL ? 'addMapsOnloadHook' : 'addOnloadHook' ) . "( function() { $script } );" |
| 60 | + ( method_exists( 'OutputPage', 'addModules' ) ? 'addMapsOnloadHook' : 'addOnloadHook' ) . "( function() { $script } );" |
63 | 61 | ) ); |
64 | 62 | } |
65 | 63 | |
Index: trunk/extensions/Maps/includes/features/Maps_BaseMap.php |
— | — | @@ -67,6 +67,8 @@ |
68 | 68 | * @return html |
69 | 69 | */ |
70 | 70 | public final function renderMap( array $params, Parser $parser ) { |
| 71 | + global $egMapsUseRL; |
| 72 | + |
71 | 73 | $this->setCentre( $params ); |
72 | 74 | |
73 | 75 | if ( $params['zoom'] == 'null' ) { |
— | — | @@ -75,7 +77,7 @@ |
76 | 78 | |
77 | 79 | $output = $this->getMapHTML( $params, $parser ); |
78 | 80 | |
79 | | - if ( method_exists( 'OutputPage', 'addModules' ) ) { |
| 81 | + if ( $egMapsUseRL ) { |
80 | 82 | $output .= $this->getJSON( $params, $parser ); |
81 | 83 | } |
82 | 84 | |