@@ -7,37 +7,37 @@ discard block |
||
7 | 7 | * @defgroup SFS SemanticFormsSelect |
8 | 8 | */ |
9 | 9 | |
10 | -if ( version_compare( $GLOBALS[ 'wgVersion' ], '1.23', 'lt' ) ) { |
|
11 | - 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.' ); |
|
10 | +if (version_compare($GLOBALS['wgVersion'], '1.23', 'lt')) { |
|
11 | + 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.'); |
|
12 | 12 | } |
13 | 13 | |
14 | -if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { |
|
14 | +if (is_readable(__DIR__ . '/vendor/autoload.php')) { |
|
15 | 15 | require_once __DIR__ . '/vendor/autoload.php'; |
16 | 16 | } |
17 | 17 | |
18 | 18 | $GLOBALS['wgExtensionFunctions'][] = function() { |
19 | - if ( version_compare( $GLOBALS['wgVersion'], '1.23', '<' ) ) { |
|
20 | - if ( !defined( 'SF_VERSION' ) || version_compare( 'SF_VERSION', '2.8', 'lt' ) ) { |
|
21 | - 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.' ); |
|
19 | + if (version_compare($GLOBALS['wgVersion'], '1.23', '<')) { |
|
20 | + if (!defined('SF_VERSION') || version_compare('SF_VERSION', '2.8', 'lt')) { |
|
21 | + 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 | 22 | } |
23 | 23 | } |
24 | 24 | |
25 | - if ( version_compare( $GLOBALS['wgVersion'], '1.25', '>' ) ) { |
|
26 | - if ( !\ExtensionRegistry::getInstance()->isLoaded( 'SemanticForms' ) ) { |
|
27 | - die( '<b>Error:</b> <a href="https://www.mediawiki.org/wiki/Extension:SemanticFormsSelect">Semantic Forms Selects</a> is a Semantic Forms extension. You need to install <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms">Semantic Forms</a> first.' ); |
|
25 | + if (version_compare($GLOBALS['wgVersion'], '1.25', '>')) { |
|
26 | + if (!\ExtensionRegistry::getInstance()->isLoaded('SemanticForms')) { |
|
27 | + die('<b>Error:</b> <a href="https://www.mediawiki.org/wiki/Extension:SemanticFormsSelect">Semantic Forms Selects</a> is a Semantic Forms extension. You need to install <a href="https://www.mediawiki.org/wiki/Extension:Semantic_Forms">Semantic Forms</a> first.'); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | }; |
31 | 31 | |
32 | 32 | // Do not initialize more than once. |
33 | -if ( defined( 'SFS_VERSION' ) ) { |
|
33 | +if (defined('SFS_VERSION')) { |
|
34 | 34 | return 1; |
35 | 35 | } |
36 | 36 | |
37 | -define( 'SFS_VERSION', '1.3.0' ); |
|
37 | +define('SFS_VERSION', '1.3.0'); |
|
38 | 38 | |
39 | -if ( function_exists( 'wfLoadExtension' ) ) { |
|
40 | - wfLoadExtension( 'SemanticFormsSelect' ); |
|
39 | +if (function_exists('wfLoadExtension')) { |
|
40 | + wfLoadExtension('SemanticFormsSelect'); |
|
41 | 41 | // Keep i18n globals so mergeMessageFileList.php doesn't break |
42 | 42 | $GLOBALS['wgMessagesDirs']['SemanticFormsSelect'] = __DIR__ . '/i18n'; |
43 | 43 | /* wfWarn( |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * @codeCoverageIgnore |
52 | 52 | */ |
53 | -call_user_func( function() { |
|
53 | +call_user_func(function() { |
|
54 | 54 | |
55 | 55 | $GLOBALS['wgExtensionCredits']['semantic'][] = array( |
56 | 56 | 'path' => __FILE__, |
57 | 57 | 'name' => 'Semantic Forms Select', |
58 | - 'author' =>array( 'Jason Zhang', 'Toni Hermoso Pulido', '...' ), |
|
58 | + 'author' =>array('Jason Zhang', 'Toni Hermoso Pulido', '...'), |
|
59 | 59 | 'url' => 'https://www.mediawiki.org/wiki/Extension:SemanticFormsSelect', |
60 | 60 | 'descriptionmsg' => 'semanticformsselect-desc', |
61 | 61 | 'version' => SFS_VERSION, |
@@ -71,20 +71,20 @@ discard block |
||
71 | 71 | $GLOBALS['wgSF_Select_debug'] = 0; |
72 | 72 | |
73 | 73 | // Register resource files |
74 | - $extensionPathParts = explode( DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR , __DIR__, 2 ); |
|
74 | + $extensionPathParts = explode(DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2); |
|
75 | 75 | |
76 | 76 | $GLOBALS['wgResourceModules']['ext.sf_select.scriptselect'] = array( |
77 | - 'localBasePath' => __DIR__ , |
|
78 | - 'remoteExtPath' => end( $extensionPathParts ), |
|
77 | + 'localBasePath' => __DIR__, |
|
78 | + 'remoteExtPath' => end($extensionPathParts), |
|
79 | 79 | 'position' => 'bottom', |
80 | - 'scripts' => array( 'res/scriptSelect.js' ), |
|
80 | + 'scripts' => array('res/scriptSelect.js'), |
|
81 | 81 | 'dependencies' => array( |
82 | 82 | 'ext.semanticforms.main' |
83 | 83 | ) |
84 | 84 | ); |
85 | 85 | |
86 | 86 | $GLOBALS['wgExtensionFunctions'][] = function() { |
87 | - $GLOBALS['sfgFormPrinter']->setInputTypeHook( 'SF_Select', '\SFS\SemanticFormsSelect::init', array() ); |
|
87 | + $GLOBALS['sfgFormPrinter']->setInputTypeHook('SF_Select', '\SFS\SemanticFormsSelect::init', array()); |
|
88 | 88 | }; |
89 | 89 | |
90 | 90 | } ); |