Completed
Push — vishual ( da6cc4...124318 )
by Jeroen De
07:54
created

Maps.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 22 and the first side effect is on line 18.

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.

Loading history...
2
3
/**
4
 * Initialization file for the Maps extension.
5
 *
6
 * @links https://github.com/JeroenDeDauw/Maps/blob/master/README.md#maps Documentation
7
 * @links https://github.com/JeroenDeDauw/Maps/issues Support
8
 * @links https://github.com/JeroenDeDauw/Maps Source code
9
 *
10
 * @license https://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
11
 * @author Jeroen De Dauw < [email protected] >
12
 */
13
14
use Maps\MapsSetup;
15
16
if ( defined( 'Maps_COORDS_FLOAT' ) ) {
17
	// Do not initialize more than once.
18
	return 1;
19
}
20
21
// The different coordinate notations.
22
define( 'Maps_COORDS_FLOAT', 'float' );
23
define( 'Maps_COORDS_DMS', 'dms' );
24
define( 'Maps_COORDS_DM', 'dm' );
25
define( 'Maps_COORDS_DD', 'dd' );
26
27
require_once __DIR__ . '/Maps_Settings.php';
28
29
// Include the composer autoloader if it is present.
30
if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
31
	include_once( __DIR__ . '/vendor/autoload.php' );
32
}
33
34
// Internationalization
35
$GLOBALS['wgMessagesDirs']['Maps'] = __DIR__ . '/i18n';
36
$GLOBALS['wgExtensionMessagesFiles']['MapsMagic'] = __DIR__ . '/Maps.i18n.magic.php';
37
$GLOBALS['wgExtensionMessagesFiles']['MapsAlias'] = __DIR__ . '/Maps.i18n.alias.php';
38
39
$GLOBALS['wgExtensionFunctions'][] = function() {
40
	if ( $GLOBALS['egMapsDisableExtension'] ) {
41
		return true;
42
	}
43
44
	if ( defined( 'Maps_VERSION' ) ) {
45
		// Do not initialize more than once.
46
		return true;
47
	}
48
49
	// Only initialize the extension when all dependencies are present.
50
	if ( !defined( 'Validator_VERSION' ) ) {
51
		throw new Exception( 'You need to have Validator installed in order to use Maps' );
52
	}
53
54
	if ( version_compare( $GLOBALS['wgVersion'], '1.27c', '<' ) ) {
55
		throw new Exception(
56
			'This version of Maps requires MediaWiki 1.27 or above; use Maps 4.2.x for older versions.'
57
			. ' More information at https://github.com/JeroenDeDauw/Maps/blob/master/INSTALL.md'
58
		);
59
	}
60
61
	define( 'Maps_VERSION', '5.7 alpha' );
62
	define( 'SM_VERSION', Maps_VERSION );
63
64
	( new MapsSetup( $GLOBALS ) )->setup();
65
66
	return true;
67
};
68
69