@@ -6,51 +6,51 @@ discard block |
||
6 | 6 | * |
7 | 7 | * @defgroup SFS SemanticFormsSelect |
8 | 8 | */ |
9 | -if ( !defined( 'MEDIAWIKI' ) ) { |
|
10 | - die( 'This file is part of the SemanticFormsSelect extension, it is not a valid entry point.' ); |
|
9 | +if (!defined('MEDIAWIKI')) { |
|
10 | + die('This file is part of the SemanticFormsSelect extension, it is not a valid entry point.'); |
|
11 | 11 | } |
12 | 12 | |
13 | -if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { |
|
14 | - require_once( __DIR__ . '/vendor/autoload.php' ); |
|
13 | +if (file_exists(__DIR__ . '/vendor/autoload.php')) { |
|
14 | + require_once(__DIR__ . '/vendor/autoload.php'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | // A workaround to stay compatible with the 3.4.x release. |
18 | -if ( defined( 'SMW_VERSION' ) ) { |
|
18 | +if (defined('SMW_VERSION')) { |
|
19 | 19 | $GLOBALS['wgExtensionFunctions'][] = function() { |
20 | 20 | // This global variable is needed so that other extensions can |
21 | 21 | // hook into it to add their own input types. |
22 | - $GLOBALS['sfgFormPrinter'] = new StubObject( 'sfgFormPrinter', 'SFFormPrinter' ); |
|
22 | + $GLOBALS['sfgFormPrinter'] = new StubObject('sfgFormPrinter', 'SFFormPrinter'); |
|
23 | 23 | }; |
24 | 24 | } else { |
25 | - $GLOBALS['sfgFormPrinter'] = new StubObject( 'sfgFormPrinter', 'SFFormPrinter' ); |
|
25 | + $GLOBALS['sfgFormPrinter'] = new StubObject('sfgFormPrinter', 'SFFormPrinter'); |
|
26 | 26 | } |
27 | 27 | |
28 | -if ( version_compare( $GLOBALS[ 'wgVersion' ], '1.23', 'lt' ) ) { |
|
29 | - die( '<b>Error:</b> This version of <a href="https://github.com/SemanticMediaWiki/SemanticFormsSelect/">SemanticFormsSelect</a> is only compatible with MediaWiki 1.23 or above. You need to upgrade MediaWiki first.' ); |
|
28 | +if (version_compare($GLOBALS['wgVersion'], '1.23', 'lt')) { |
|
29 | + die('<b>Error:</b> This version of <a href="https://github.com/SemanticMediaWiki/SemanticFormsSelect/">SemanticFormsSelect</a> is only compatible with MediaWiki 1.23 or above. You need to upgrade MediaWiki first.'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $GLOBALS['wgExtensionFunctions'][] = function() { |
33 | - if ( version_compare( SF_VERSION, '2.8', '<' ) ) { |
|
34 | - die( '<b>Error:</b> This version of <a href="https://github.com/SemanticMediaWiki/SemanticFormsSelect/">SemanticFormsSelect</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.' ); |
|
33 | + if (version_compare(SF_VERSION, '2.8', '<')) { |
|
34 | + die('<b>Error:</b> This version of <a href="https://github.com/SemanticMediaWiki/SemanticFormsSelect/">SemanticFormsSelect</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.'); |
|
35 | 35 | } |
36 | 36 | }; |
37 | 37 | |
38 | 38 | // Do not initialize more than once. |
39 | -if ( defined( 'SFS_VERSION' ) ) { |
|
39 | +if (defined('SFS_VERSION')) { |
|
40 | 40 | return 1; |
41 | 41 | } |
42 | 42 | |
43 | -define( 'SFS_VERSION', '1.3.0' ); |
|
43 | +define('SFS_VERSION', '1.3.0'); |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @codeCoverageIgnore |
47 | 47 | */ |
48 | -call_user_func( function() { |
|
48 | +call_user_func(function() { |
|
49 | 49 | |
50 | 50 | $GLOBALS['wgExtensionCredits']['semantic'][] = array( |
51 | 51 | 'path' => __FILE__, |
52 | 52 | 'name' => 'Semantic Forms Select', |
53 | - 'author' =>array( 'Jason Zhang', 'Toni Hermoso Pulido', '...' ), |
|
53 | + 'author' =>array('Jason Zhang', 'Toni Hermoso Pulido', '...'), |
|
54 | 54 | 'url' => 'https://www.mediawiki.org/wiki/Extension:SemanticFormsSelect', |
55 | 55 | 'description' => 'Allows to generate a select field in a semantic form whose values are retrieved from a query', |
56 | 56 | 'version' => SFS_VERSION, |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | $GLOBALS['wgSF_Select_debug'] = 0; |
65 | 65 | |
66 | 66 | // Register resource files |
67 | - $extensionPathParts = explode( DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR , __DIR__, 2 ); |
|
67 | + $extensionPathParts = explode(DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2); |
|
68 | 68 | |
69 | 69 | $GLOBALS['wgResourceModules']['ext.sf_select.scriptselect'] = array( |
70 | - 'localBasePath' => __DIR__ , |
|
71 | - 'remoteExtPath' => end( $extensionPathParts ), |
|
70 | + 'localBasePath' => __DIR__, |
|
71 | + 'remoteExtPath' => end($extensionPathParts), |
|
72 | 72 | 'position' => 'bottom', |
73 | - 'scripts' => array( 'res/scriptSelect.js' ), |
|
73 | + 'scripts' => array('res/scriptSelect.js'), |
|
74 | 74 | 'dependencies' => array( |
75 | 75 | 'ext.semanticforms.main' |
76 | 76 | ) |
77 | 77 | ); |
78 | 78 | |
79 | 79 | $GLOBALS['wgExtensionFunctions'][] = function() { |
80 | - $GLOBALS['sfgFormPrinter']->setInputTypeHook( 'SF_Select', '\SFS\SemanticFormsSelect::init', array() ); |
|
80 | + $GLOBALS['sfgFormPrinter']->setInputTypeHook('SF_Select', '\SFS\SemanticFormsSelect::init', array()); |
|
81 | 81 | }; |
82 | 82 | |
83 | 83 | } ); |