1 | <?php |
||
17 | class SemanticMapsSetup { |
||
18 | |||
19 | private $mwGlobals; |
||
20 | private $mappingServices; |
||
21 | |||
22 | private function __construct( array &$mwGlobals, MappingServices $mappingServices ) { |
||
26 | |||
27 | public static function newFromMediaWikiGlobals( array &$mwGlobals, MappingServices $mappingServices ) { |
||
30 | |||
31 | public function initExtension() { |
||
32 | // Hook for initializing the Geographical Data types. |
||
33 | $this->mwGlobals['wgHooks']['SMW::DataType::initTypes'][] = function() { |
||
34 | DataTypeRegistry::getInstance()->registerDatatype( |
||
35 | '_geo', |
||
36 | CoordinateValue::class, |
||
37 | SMWDataItem::TYPE_GEO |
||
38 | ); |
||
39 | |||
40 | return true; |
||
41 | }; |
||
42 | |||
43 | // Hook for defining the default query printer for queries that ask for geographical coordinates. |
||
44 | $this->mwGlobals['wgHooks']['SMWResultFormat'][] = 'Maps\MediaWiki\MapsHooks::addGeoCoordsDefaultFormat'; |
||
45 | |||
46 | $this->registerGoogleMaps(); |
||
47 | $this->registerLeaflet(); |
||
48 | |||
49 | $this->mwGlobals['smwgResultFormats']['kml'] = KmlPrinter::class; |
||
50 | |||
51 | $this->mwGlobals['smwgResultAliases'][$this->mwGlobals['egMapsDefaultService']][] = 'map'; |
||
52 | MapPrinter::registerDefaultService( $this->mwGlobals['egMapsDefaultService'] ); |
||
53 | |||
54 | // Internationalization |
||
55 | $this->mwGlobals['wgMessagesDirs']['SemanticMaps'] = __DIR__ . '/i18n'; |
||
56 | } |
||
57 | |||
58 | private function registerGoogleMaps() { |
||
68 | |||
69 | private function registerLeaflet() { |
||
79 | |||
80 | } |
||
81 |