Index: trunk/extensions/Maps/Maps.php |
— | — | @@ -1,21 +1,21 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -/** |
| 4 | +/** |
5 | 5 | * Initialization file for the Maps extension. |
6 | 6 | * Extension documentation: http://www.mediawiki.org/wiki/Extension:Maps |
7 | 7 | * |
8 | 8 | * @file Maps.php |
9 | 9 | * @ingroup Maps |
10 | | - * |
| 10 | + * |
11 | 11 | * @author Jeroen De Dauw |
12 | 12 | */ |
13 | 13 | |
14 | 14 | /** |
15 | 15 | * This documenation group collects source code files belonging to Maps. |
16 | 16 | * |
17 | | - * Please do not use this group name for other code. If you have an extension to |
| 17 | + * Please do not use this group name for other code. If you have an extension to |
18 | 18 | * Maps, please use your own group defenition. |
19 | | - * |
| 19 | + * |
20 | 20 | * @defgroup Maps Maps |
21 | 21 | */ |
22 | 22 | |
— | — | @@ -33,41 +33,41 @@ |
34 | 34 | echo '<b>Warning:</b> You need to have <a href="http://www.mediawiki.org/wiki/Extension:Validator">Validator</a> installed in order to use <a href="http://www.mediawiki.org/wiki/Extension:Maps">Maps</a>.'; |
35 | 35 | } |
36 | 36 | else { |
37 | | - define( 'Maps_VERSION', '0.6 a17' ); |
38 | | - |
| 37 | + define( 'Maps_VERSION', '0.6 a18' ); |
| 38 | + |
39 | 39 | // The different coordinate notations. |
40 | 40 | define( 'Maps_COORDS_FLOAT', 'float' ); |
41 | 41 | define( 'Maps_COORDS_DMS', 'dms' ); |
42 | 42 | define( 'Maps_COORDS_DM', 'dm' ); |
43 | 43 | define( 'Maps_COORDS_DD', 'dd' ); |
44 | | - |
| 44 | + |
45 | 45 | // The symbols to use for degrees, minutes and seconds. |
46 | 46 | define( 'Maps_GEO_DEG', '°' ); |
47 | 47 | define( 'Maps_GEO_MIN', "'" ); |
48 | | - define( 'Maps_GEO_SEC', '"' ); |
49 | | - |
| 48 | + define( 'Maps_GEO_SEC', '"' ); |
| 49 | + |
50 | 50 | $egMapsScriptPath = ( isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions' ) . '/Maps'; |
51 | 51 | $egMapsDir = dirname( __FILE__ ) . '/'; |
52 | | - |
| 52 | + |
53 | 53 | // To ensure Maps remains compatible with pre 1.16. |
54 | 54 | if ( version_compare( $wgVersion, '1.16', '<' ) ) { |
55 | 55 | $wgAutoloadClasses['Html'] = $egMapsDir . 'Compat/Html.php'; |
56 | 56 | } |
57 | | - |
58 | | - $egMapsStyleVersion = $wgStyleVersion . '-' . Maps_VERSION; |
59 | | - |
| 57 | + |
| 58 | + $egMapsStyleVersion = $wgStyleVersion . '-' . Maps_VERSION; |
| 59 | + |
60 | 60 | $egMapsFeatures = array(); |
61 | | - $egMapsServices = array(); |
62 | | - |
| 61 | + $egMapsServices = array(); |
| 62 | + |
63 | 63 | // Include the settings file. |
64 | 64 | require_once( $egMapsDir . 'Maps_Settings.php' ); |
65 | | - |
| 65 | + |
66 | 66 | $wgExtensionMessagesFiles['Maps'] = $egMapsDir . 'Maps.i18n.php'; |
67 | | - |
| 67 | + |
68 | 68 | if( version_compare( $wgVersion, '1.16alpha', '>=' ) ) { |
69 | | - $wgExtensionMessagesFiles['Maps'] = $egMapsDir . 'Maps.i18n.magic.php'; |
70 | | - } |
71 | | - |
| 69 | + $wgExtensionMessagesFiles['MapsMagic'] = $egMapsDir . 'Maps.i18n.magic.php'; |
| 70 | + } |
| 71 | + |
72 | 72 | // Register the initialization function of Maps. |
73 | 73 | $wgExtensionFunctions[] = 'efMapsSetup'; |
74 | 74 | |
— | — | @@ -80,31 +80,31 @@ |
81 | 81 | function efMapsSetup() { |
82 | 82 | global $wgExtensionCredits, $wgLang, $wgAutoloadClasses, $IP, $wgStyleVersion, $wgScriptPath, $wgJsMimeType, $wgExtensionAssetsPath; |
83 | 83 | global $egMapsDefaultService, $egMapsAvailableServices, $egMapsServices, $egMapsDefaultGeoService, $egMapsScriptPath; |
84 | | - global $egMapsAvailableGeoServices, $egMapsDir, $egMapsAvailableFeatures, $egMapsUseMinJs, $egMapsJsExt, $egMapsStyleVersion; |
85 | | - |
| 84 | + global $egMapsAvailableGeoServices, $egMapsDir, $egMapsAvailableFeatures, $egMapsUseMinJs, $egMapsJsExt, $egMapsStyleVersion; |
| 85 | + |
86 | 86 | // Autoload the general classes |
87 | | - $wgAutoloadClasses['MapsCoordinateParser'] = $egMapsDir . 'Maps_CoordinateParser.php'; |
88 | | - $wgAutoloadClasses['MapsMapper'] = $egMapsDir . 'Maps_Mapper.php'; |
89 | | - |
| 87 | + $wgAutoloadClasses['MapsCoordinateParser'] = $egMapsDir . 'Maps_CoordinateParser.php'; |
| 88 | + $wgAutoloadClasses['MapsMapper'] = $egMapsDir . 'Maps_Mapper.php'; |
| 89 | + |
90 | 90 | wfLoadExtensionMessages( 'Maps' ); |
91 | 91 | |
92 | 92 | wfRunHooks( 'MappingFeatureLoad' ); |
93 | 93 | wfRunHooks( 'MappingServiceLoad' ); |
94 | | - |
| 94 | + |
95 | 95 | // Remove all hooked in services that should not be available. |
96 | 96 | foreach ( $egMapsServices as $service => $data ) { |
97 | 97 | if ( ! in_array( $service, $egMapsAvailableServices ) ) unset( $egMapsServices[$service] ); |
98 | 98 | } |
99 | 99 | $egMapsAvailableServices = array_keys( $egMapsServices ); |
100 | | - |
| 100 | + |
101 | 101 | // Enure that the default service is one of the enabled ones. |
102 | | - $egMapsDefaultService = in_array( $egMapsDefaultService, $egMapsAvailableServices ) ? $egMapsDefaultService : $egMapsAvailableServices[0]; |
103 | | - |
| 102 | + $egMapsDefaultService = in_array( $egMapsDefaultService, $egMapsAvailableServices ) ? $egMapsDefaultService : $egMapsAvailableServices[0]; |
| 103 | + |
104 | 104 | // Creation of a list of internationalized service names. |
105 | 105 | $services = array(); |
106 | 106 | foreach ( array_keys( $egMapsServices ) as $name ) $services[] = wfMsg( 'maps_' . $name ); |
107 | 107 | $services_list = $wgLang->listToText( $services ); |
108 | | - |
| 108 | + |
109 | 109 | $wgExtensionCredits['parserhook'][] = array( |
110 | 110 | 'path' => __FILE__, |
111 | 111 | 'name' => wfMsg( 'maps_name' ), |
— | — | @@ -119,9 +119,9 @@ |
120 | 120 | ); |
121 | 121 | |
122 | 122 | MapsMapper::initialize(); |
123 | | - |
| 123 | + |
124 | 124 | $egMapsJsExt = $egMapsUseMinJs ? '.min.js' : '.js'; |
125 | | - |
| 125 | + |
126 | 126 | return true; |
127 | 127 | } |
128 | 128 | |
— | — | @@ -130,11 +130,11 @@ |
131 | 131 | */ |
132 | 132 | function efMapsAddToAdminLinks( &$admin_links_tree ) { |
133 | 133 | $displaying_data_section = $admin_links_tree->getSection( wfMsg( 'smw_adminlinks_displayingdata' ) ); |
134 | | - |
| 134 | + |
135 | 135 | // Escape if SMW hasn't added links. |
136 | 136 | if ( is_null( $displaying_data_section ) ) return true; |
137 | 137 | $smw_docu_row = $displaying_data_section->getRow( 'smw' ); |
138 | | - |
| 138 | + |
139 | 139 | $maps_docu_label = wfMsg( 'adminlinks_documentation', wfMsg( 'maps_name' ) ); |
140 | 140 | $smw_docu_row->addItem( AlItem::newFromExternalLink( 'http://www.mediawiki.org/wiki/Extension:Maps', $maps_docu_label ) ); |
141 | 141 | |