Index: trunk/extensions/Maps/Maps.php |
— | — | @@ -14,11 +14,11 @@ |
15 | 15 | die( 'Not an entry point.' ); |
16 | 16 | } |
17 | 17 | |
18 | | -define('Maps_VERSION', '0.2'); |
| 18 | +define('Maps_VERSION', '0.3'); |
19 | 19 | |
20 | 20 | $egMapsScriptPath = $wgScriptPath . '/extensions/Maps'; |
21 | 21 | $egMapsIP = $IP . '/extensions/Maps'; |
22 | | -$egMapsIncludePath = 'http://' . $_SERVER["HTTP_HOST"] . $egMapsScriptPath; |
| 22 | +$egMapsIncludePath = $wgServer . $egMapsScriptPath; |
23 | 23 | |
24 | 24 | // Include the settings file |
25 | 25 | require_once($egMapsIP . '/Maps_Settings.php'); |
— | — | @@ -37,20 +37,25 @@ |
38 | 38 | $wgAutoloadClasses['MapsGeocoder'] = $egMapsIP . '/Maps_Geocoder.php'; |
39 | 39 | $wgAutoloadClasses['MapsBaseGeocoder'] = $egMapsIP . '/Maps_BaseGeocoder.php'; |
40 | 40 | |
| 41 | +// Add the services |
| 42 | +$wgAutoloadClasses['MapsGoogleMaps'] = $egMapsIP . '/GoogleMaps/Maps_GoogleMaps.php'; |
| 43 | +$wgAutoloadClasses['MapsYahooMaps'] = $egMapsIP . '/YahooMaps/Maps_YahooMaps.php'; |
| 44 | +$wgAutoloadClasses['MapsOpenLayers'] = $egMapsIP . '/OpenLayers/Maps_OpenLayers.php'; |
| 45 | + |
41 | 46 | // Array containing all map services made available by Maps. |
42 | 47 | // This does not reflect the enabled mapping services, see $egMapsAvailableServices in Maps_Settings.php for this. |
43 | 48 | // Each array item represents a service: the key is the main service name (used in switch statements), |
44 | 49 | // and the array values are the aliases for the main name (so can also be used as service=alias). |
45 | | -$egMapsServices = array('googlemaps' => array('google', 'googlemap', 'gmap', 'gmaps'), |
46 | | - 'openlayers' => array('layers', 'openlayer'), |
47 | | - 'yahoomaps' => array('yahoo', 'yahoomap', 'ymap', 'ymaps') |
48 | | - ); |
49 | | - |
| 50 | +$egMapsServices = array(); |
| 51 | +$egMapsServices['googlemaps'] = array('aliases' => array('google', 'googlemap', 'gmap', 'gmaps')); |
| 52 | +$egMapsServices['openlayers'] = array('aliases' => array('layers', 'openlayer')); |
| 53 | +$egMapsServices['yahoomaps'] = array('aliases' => array('yahoo', 'yahoomap', 'ymap', 'ymaps')); |
| 54 | + |
50 | 55 | /** |
51 | 56 | * Initialization function for the Maps extension |
52 | 57 | */ |
53 | 58 | function efMapsSetup() { |
54 | | - global $wgExtensionCredits, $wgExtensionCredits, $wgOut; |
| 59 | + global $wgExtensionCredits, $wgOut; |
55 | 60 | global $egMapsDefaultService, $egMapsAvailableServices, $egMapsServices, $egMapsMainServices, $egMapsScriptPath, $egMapsDefaultGeoService, $egMapsAvailableGeoServices; |
56 | 61 | |
57 | 62 | efMapsValidateGoogleMapsKey(); |
— | — | @@ -61,8 +66,6 @@ |
62 | 67 | |
63 | 68 | $egMapsMainServices = array_keys($egMapsServices); |
64 | 69 | |
65 | | - foreach($egMapsMainServices as $service) efMapsInitFormat($service); |
66 | | - |
67 | 70 | $services_list = implode(', ', $egMapsMainServices); |
68 | 71 | |
69 | 72 | wfLoadExtensionMessages( 'Maps' ); |
— | — | @@ -74,7 +77,7 @@ |
75 | 78 | 'author' => array("[http://bn2vs.com Jeroen De Dauw]", "[http://www.mediawiki.org/wiki/User:Yaron_Koren Yaron Koren]", "Robert Buzink", "Matt Williamson", "[http://www.sergeychernyshev.com Sergey Chernyshev]"), |
76 | 79 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Maps', |
77 | 80 | 'description' => wfMsg( 'maps_desc', $services_list ), |
78 | | - 'descriptionmsg' => array( 'maps_desc', $services_list ), |
| 81 | + 'descriptionmsg' => wfMsg( 'maps_desc', $services_list ), |
79 | 82 | ); |
80 | 83 | |
81 | 84 | efMapsAddParserHooks(); |
— | — | @@ -111,33 +114,6 @@ |
112 | 115 | } |
113 | 116 | |
114 | 117 | /** |
115 | | - * Initializes the result format depending on the map service |
116 | | - */ |
117 | | -function efMapsInitFormat( $format ) { |
118 | | - global $wgAutoloadClasses, $egMapsIP; |
119 | | - |
120 | | - switch ($format) { |
121 | | - case 'googlemaps': |
122 | | - $class = 'MapsGoogleMaps'; |
123 | | - $file = $egMapsIP . '/GoogleMaps/Maps_GoogleMaps'; |
124 | | - break; |
125 | | - case 'openlayers': |
126 | | - $class = 'MapsOpenLayers'; |
127 | | - $file = $egMapsIP . '/OpenLayers/Maps_OpenLayers'; |
128 | | - break; |
129 | | - case 'yahoomaps': |
130 | | - $class = 'MapsYahooMaps'; |
131 | | - $file = $egMapsIP . '/YahooMaps/Maps_YahooMaps'; |
132 | | - break; |
133 | | - } |
134 | | - |
135 | | - if (isset($class) && isset($file)) { |
136 | | - $wgAutoloadClasses[$class] = $file . '.php'; |
137 | | - } |
138 | | - |
139 | | -} |
140 | | - |
141 | | -/** |
142 | 118 | * Adds the magic words for the parser functions |
143 | 119 | */ |
144 | 120 | function efMapsFunctionMagic( &$magicWords, $langCode ) { |
Index: trunk/extensions/Maps/Maps_Mapper.php |
— | — | @@ -196,8 +196,8 @@ |
197 | 197 | global $egMapsServices; |
198 | 198 | |
199 | 199 | if (!array_key_exists($service, $egMapsServices)) { |
200 | | - foreach ($egMapsServices as $serviceName => $aliasList) { |
201 | | - if (in_array($service, $aliasList)) { |
| 200 | + foreach ($egMapsServices as $serviceName => $serviceInfo) { |
| 201 | + if (in_array($service, $serviceInfo['aliases'])) { |
202 | 202 | $service = $serviceName; |
203 | 203 | } |
204 | 204 | } |
Index: trunk/extensions/Maps/YahooMaps/Maps_YahooMaps.php |
— | — | @@ -8,6 +8,10 @@ |
9 | 9 | * @author Jeroen De Dauw |
10 | 10 | */ |
11 | 11 | |
| 12 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 13 | + die( 'Not an entry point.' ); |
| 14 | +} |
| 15 | + |
12 | 16 | class MapsYahooMaps extends MapsBaseMap { |
13 | 17 | |
14 | 18 | // http://developer.yahoo.com/maps/ajax |