| 1 |  |  | <?php | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * Initialization file for the Semantic Maps extension. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @licence GNU GPL v2+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @author Jeroen De Dauw < [email protected] > | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | if ( !defined( 'MEDIAWIKI' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | 	die( 'Not an entry point.' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | if ( defined( 'SM_VERSION' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | 	// Do not initialize more than once. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | 	return 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | if ( version_compare( $GLOBALS['wgVersion'], '1.23c', '<' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | 	throw new Exception( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | 		'This version of Semantic Maps requires MediaWiki 1.23 or above; use Semantic Maps 3.3.x for older versions.' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 		. ' See https://github.com/SemanticMediaWiki/SemanticMaps/blob/master/INSTALL.md for more info.' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 	); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | if ( !defined( 'Maps_VERSION' ) && is_readable( __DIR__ . '/vendor/autoload.php' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 	include_once( __DIR__ . '/vendor/autoload.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | if ( !defined( 'Maps_VERSION' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 	throw new Exception( 'You need to have Maps installed in order to use Semantic Maps' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | define( 'SM_VERSION', '3.4.0-alpha' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | require_once __DIR__ . '/SM_Settings.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | SemanticMaps::newFromMediaWikiGlobals( $GLOBALS )->initExtension(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | $GLOBALS['wgExtensionFunctions'][] = function() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 	// Hook for initializing the Geographical Data types. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 	$GLOBALS['wgHooks']['SMW::DataType::initTypes'][] = 'SemanticMapsHooks::initGeoDataTypes'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 	// Hook for defining the default query printer for queries that ask for geographical coordinates. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	$GLOBALS['wgHooks']['SMWResultFormat'][] = 'SemanticMapsHooks::addGeoCoordsDefaultFormat'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 	// Hook for adding a Semantic Maps links to the Admin Links extension. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 	$GLOBALS['wgHooks']['AdminLinks'][] = 'SemanticMapsHooks::addToAdminLinks'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 	$GLOBALS['wgHooks']['sfFormPrinterSetup'][] = 'SemanticMaps\FormInputsSetup::run'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | }; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |  * @codeCoverageIgnore | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | class SemanticMaps { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 	private $mwGlobals; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 	public static function newFromMediaWikiGlobals( array &$mwGlobals ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 		return new self( $mwGlobals ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  | 	private function __construct( array &$mwGlobals ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 		$this->mwGlobals =& $mwGlobals; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 	 * @since 3.4 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 	public function initExtension() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 		$this->mwGlobals['wgExtensionCredits']['semantic'][] = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 			'path' => __FILE__, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 			'name' => 'Semantic Maps', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 			'version' => SM_VERSION, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | 			'author' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 				'[https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 			], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 			'url' => 'https://github.com/SemanticMediaWiki/SemanticMaps/blob/master/README.md#semantic-maps', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  | 			'descriptionmsg' => 'semanticmaps-desc', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 			'license-name'   => 'GPL-2.0+' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | 		]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  | 		$this->registerResourceModules(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 		$this->registerGoogleMaps(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 		$this->registerLeaflet(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | 		$this->registerOpenLayers(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 		$this->mwGlobals['smwgResultFormats']['kml'] = SMKMLPrinter::class; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  | 		$this->mwGlobals['smwgResultAliases'][$this->mwGlobals['egMapsDefaultServices']['qp']][] = 'map'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  | 		// Internationalization | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | 		$this->mwGlobals['wgMessagesDirs']['SemanticMaps'] = __DIR__ . '/i18n'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  | 	private function registerResourceModules() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  | 		$moduleTemplate = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 			'position' => 'bottom', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | 			'group' => 'ext.semanticmaps', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  | 		]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | 		$this->mwGlobals['wgResourceModules']['ext.sm.forminputs'] = $moduleTemplate + [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  | 			'dependencies' => [ 'ext.maps.coord' ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  | 			'localBasePath' => __DIR__ . '/src/forminputs', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 			'remoteExtPath' => 'SemanticMaps/src/forminputs', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 			'scripts' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 				'jquery.mapforminput.js' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  | 			], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 			'messages' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | 				'semanticmaps_enteraddresshere', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  | 				'semanticmaps-updatemap', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | 				'semanticmaps_lookupcoordinates', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | 				'semanticmaps-forminput-remove', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 				'semanticmaps-forminput-add', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  | 				'semanticmaps-forminput-locations' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  | 			] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | 		]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  | 		$this->mwGlobals['wgResourceModules']['ext.sm.common'] = $moduleTemplate + [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  | 			'localBasePath' => __DIR__ . '/src', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  | 			'remoteExtPath' => 'SemanticMaps/src', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 			'scripts' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  | 				'ext.sm.common.js' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 			] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 		]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  | 	private function registerGoogleMaps() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  | 		$moduleTemplate = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  | 			'localBasePath' => __DIR__ . '/src/services/GoogleMaps3', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  | 			'remoteExtPath' => 'SemanticMaps/src/services/GoogleMaps3', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 			'group' => 'ext.semanticmaps', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  | 		]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  | 		$this->mwGlobals['wgResourceModules']['ext.sm.fi.googlemaps3ajax'] = $moduleTemplate + [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  | 				'dependencies' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 					'ext.maps.googlemaps3', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 					'ext.sm.common' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  | 				], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  | 				'scripts' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | 					'ext.sm.googlemaps3ajax.js' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  | 				] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | 			]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | 		$this->mwGlobals['wgResourceModules']['ext.sm.fi.googlemaps3'] = $moduleTemplate + [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 				'dependencies' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  | 					'ext.sm.fi.googlemaps3.single', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 				], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  | 				'scripts' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  | 					'ext.sm.googlemapsinput.js', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | 				], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  | 			]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  | 		$this->mwGlobals['wgResourceModules']['ext.sm.fi.googlemaps3.single'] = $moduleTemplate + [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  | 				'dependencies' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  | 					'ext.maps.googlemaps3', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | 					'ext.sm.forminputs', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | 				], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  | 				'scripts' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  | 					'jquery.googlemapsinput.js', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  | 				], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  | 				'messages' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | 				] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  | 			]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 		MapsMappingServices::registerServiceFeature( 'googlemaps3', 'fi', 'SMGoogleMaps3FormInput' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 		/* @var MapsMappingService $googleMaps */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 		$googleMaps = MapsMappingServices::getServiceInstance( 'googlemaps3' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  | 		$googleMaps->addResourceModules( array( 'ext.sm.fi.googlemaps3ajax' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 		SMMapPrinter::registerService( $googleMaps ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  | 		$this->mwGlobals['smwgResultFormats'][$googleMaps->getName()] = SMMapPrinter::class; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | 		$this->mwGlobals['smwgResultAliases'][$googleMaps->getName()] = $googleMaps->getAliases(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  | 	private function registerLeaflet() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | 		$this->mwGlobals['wgResourceModules']['ext.sm.fi.leafletajax'] = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  | 			'localBasePath' => __DIR__ . '/src/services/Leaflet', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  | 			'remoteExtPath' => 'SemanticMaps/src/services/Leaflet', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  | 			'group' => 'ext.semanticmaps', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  | 			'dependencies' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 				'ext.maps.leaflet', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 				'ext.sm.common' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  | 			], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | 			'scripts' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  | 				'ext.sm.leafletajax.js' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  | 			] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 		]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  | 		/* @var MapsMappingService $leaflet */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | 		$leaflet = MapsMappingServices::getServiceInstance( 'leaflet' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  | 		$leaflet->addResourceModules( array( 'ext.sm.fi.leafletajax' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  | 		SMMapPrinter::registerService( $leaflet ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  | 		$this->mwGlobals['smwgResultFormats'][$leaflet->getName()] = SMMapPrinter::class; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 		$this->mwGlobals['smwgResultAliases'][$leaflet->getName()] = $leaflet->getAliases(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 	private function registerOpenLayers() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  | 		$this->mwGlobals['wgResourceModules']['ext.sm.fi.openlayersajax'] = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  | 			'localBasePath' => __DIR__ . '/src/services/OpenLayers', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 			'remoteExtPath' => 'SemanticMaps/src/services/OpenLayers', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 			'group' => 'ext.semanticmaps', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 			'dependencies' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  | 				'ext.maps.openlayers', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 				'ext.sm.common' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  | 			], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | 			'scripts' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  | 				'ext.sm.openlayersajax.js' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | 			] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | 		]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  | 		/* @var MapsMappingService $openLayers */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  | 		$openLayers = MapsMappingServices::getServiceInstance( 'openlayers' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  | 		$openLayers->addResourceModules( array( 'ext.sm.fi.openlayersajax' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  | 		SMMapPrinter::registerService( $openLayers ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  | 		$this->mwGlobals['smwgResultFormats'][$openLayers->getName()] = SMMapPrinter::class; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  | 		$this->mwGlobals['smwgResultAliases'][$openLayers->getName()] = $openLayers->getAliases(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  | 	 * @since 3.4 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | 	 * @return string|null | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 231 |  |  | 	 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 232 |  |  | 	public static function getVersion() { | 
            
                                                                        
                            
            
                                    
            
            
                | 233 |  |  | 		return SM_VERSION; | 
            
                                                                        
                            
            
                                    
            
            
                | 234 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 236 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 237 |  |  |  | 
            
                        
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.