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