1
|
|
|
<?php |
|
|
|
|
2
|
|
|
|
3
|
|
|
use SES\HookRegistry; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* @see https://github.com/SemanticMediaWiki/SemanticSignup/ |
7
|
|
|
* @link https://www.mediawiki.org/wiki/Extension:SemanticSignup |
8
|
|
|
* |
9
|
|
|
* @license GNU GPL v3+ |
10
|
|
|
* @author Jeroen De Dauw <[email protected]> |
11
|
|
|
* |
12
|
|
|
* @defgroup SES SemanticSignup |
13
|
|
|
*/ |
14
|
|
|
if ( !defined( 'MEDIAWIKI' ) ) { |
15
|
|
|
die( 'This file is part of the SemanticSignup extension, it is not a valid entry point.' ); |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
if ( version_compare( $GLOBALS[ 'wgVersion' ], '1.19', 'lt' ) ) { |
19
|
|
|
die( '<b>Error:</b> This version of <a href="https://github.com/SemanticMediaWiki/SemanticSignup/">SemanticSignup</a> is only compatible with MediaWiki 1.19 or above. You need to upgrade MediaWiki first.' ); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
if ( !defined( 'SF_VERSION' ) || version_compare( SF_VERSION, '2.8', 'lt' ) ) { |
23
|
|
|
die( '<b>Error:</b> This version of <a href="https://github.com/SemanticMediaWiki/SemanticSignup/">SemanticSignup</a> is only compatible with Semantic Forms 2.8 or above. You need to upgrade <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms">Semantic Forms</a> first.' ); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
if ( defined( 'SES_VERSION' ) ) { |
27
|
|
|
// Do not initialize more than once. |
28
|
|
|
return 1; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
define( 'SES_VERSION', '1.1-alpha' ); |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @codeCoverageIgnore |
35
|
|
|
*/ |
36
|
|
|
call_user_func( function () { |
37
|
|
|
|
38
|
|
|
// Register extension info |
39
|
|
|
$GLOBALS['wgExtensionCredits']['semantic'][] = array( |
40
|
|
|
'path' => __DIR__, |
41
|
|
|
'name' => 'Semantic Signup', |
42
|
|
|
'version' => SES_VERSION, |
43
|
|
|
'author' => array( |
44
|
|
|
'Serg Kutny', |
45
|
|
|
'[https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]', |
46
|
|
|
'...' |
47
|
|
|
), |
48
|
|
|
'url' => 'https://www.mediawiki.org/wiki/Extension:SemanticSignup', |
49
|
|
|
'descriptionmsg' => 'ses-desc', |
50
|
|
|
'license-name' => 'GPL-3.0+' |
51
|
|
|
); |
52
|
|
|
|
53
|
|
|
$GLOBALS['wgMessagesDirs']['semantic-signup'] = __DIR__ . '/i18n'; |
54
|
|
|
|
55
|
|
|
$GLOBALS['wgExtensionMessagesFiles']['semantic-signup'] = __DIR__ . '/i18n/SemanticSignup.i18n.php'; |
56
|
|
|
$GLOBALS['wgExtensionMessagesFiles']['semantic-signup-magic'] = __DIR__ . '/i18n/SemanticSignup.i18n.magic.php'; |
57
|
|
|
$GLOBALS['wgExtensionMessagesFiles']['semantic-signup-alias'] = __DIR__ . '/i18n/SemanticSignup.i18n.aliases.php'; |
58
|
|
|
|
59
|
|
|
$GLOBALS['wgSpecialPages']['SemanticSignup'] = '\SES\SpecialSemanticSignup'; |
60
|
|
|
|
61
|
|
|
$GLOBALS['egSemanticSignupSettings'] = array(); |
62
|
|
|
|
63
|
|
|
// Finalize extension setup |
64
|
|
|
$GLOBALS['wgExtensionFunctions'][] = function() { |
65
|
|
|
|
66
|
|
|
$hookRegistry = new HookRegistry(); |
67
|
|
|
$hookRegistry->register( $GLOBALS['wgHooks'] ); |
68
|
|
|
}; |
69
|
|
|
|
70
|
|
|
} ); |
71
|
|
|
|
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.