@@ -7,52 +7,52 @@ discard block |
||
7 | 7 | * @defgroup SFS SemanticFormsSelect |
8 | 8 | */ |
9 | 9 | |
10 | -if ( isset( $wgWikimediaTravisCI ) && $wgWikimediaTravisCI == true ) { |
|
11 | - if ( is_readable( __DIR__ . '/../../vendor/extensions/SemanticForms/SemanticForms.php' ) ) { |
|
10 | +if (isset($wgWikimediaTravisCI) && $wgWikimediaTravisCI == true) { |
|
11 | + if (is_readable(__DIR__ . '/../../vendor/extensions/SemanticForms/SemanticForms.php')) { |
|
12 | 12 | require_once __DIR__ . '/../../vendor/extensions/SemanticForms/SemanticForms.php'; |
13 | 13 | } |
14 | -} elseif ( is_readable( __DIR__ . '/vendor/extensions/SemanticForms/SemanticForms.php' ) ) { |
|
14 | +} elseif (is_readable(__DIR__ . '/vendor/extensions/SemanticForms/SemanticForms.php')) { |
|
15 | 15 | require_once __DIR__ . '/vendor/extensions/SemanticForms/SemanticForms.php'; |
16 | 16 | } |
17 | 17 | |
18 | -if ( !defined( 'MEDIAWIKI' ) ) { |
|
19 | - die( 'This file is part of the SemanticFormsSelect extension, it is not a valid entry point.' ); |
|
18 | +if (!defined('MEDIAWIKI')) { |
|
19 | + die('This file is part of the SemanticFormsSelect extension, it is not a valid entry point.'); |
|
20 | 20 | } |
21 | 21 | |
22 | -if ( version_compare( $GLOBALS[ 'wgVersion' ], '1.23c', 'lt' ) ) { |
|
23 | - 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.' ); |
|
22 | +if (version_compare($GLOBALS['wgVersion'], '1.23c', 'lt')) { |
|
23 | + 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.'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | $GLOBALS['wgExtensionFunctions'][] = function() { |
27 | - if ( version_compare( $GLOBALS['wgVersion'], '1.25c', '<' ) ) { |
|
28 | - if ( !defined( 'SF_VERSION' ) || !version_compare( 'SF_VERSION', '2.8', '<' ) ) { |
|
29 | - 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.' ); |
|
27 | + if (version_compare($GLOBALS['wgVersion'], '1.25c', '<')) { |
|
28 | + if (!defined('SF_VERSION') || !version_compare('SF_VERSION', '2.8', '<')) { |
|
29 | + 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.'); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | - if ( version_compare( $GLOBALS['wgVersion'], '1.26c', '>' ) ) { |
|
34 | - if ( !\ExtensionRegistry::getInstance()->isLoaded( 'SemanticForms' ) ) { |
|
35 | - 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.' ); |
|
33 | + if (version_compare($GLOBALS['wgVersion'], '1.26c', '>')) { |
|
34 | + if (!\ExtensionRegistry::getInstance()->isLoaded('SemanticForms')) { |
|
35 | + 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.'); |
|
36 | 36 | } |
37 | 37 | } |
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 | } ); |