@@ -6,52 +6,52 @@ 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 ( version_compare( $GLOBALS[ 'wgVersion' ], '1.23', 'lt' ) ) { |
|
14 | - 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.' ); |
|
13 | +if (version_compare($GLOBALS['wgVersion'], '1.23', 'lt')) { |
|
14 | + 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.'); |
|
15 | 15 | } |
16 | 16 | |
17 | -if ( isset( $wgWikimediaTravisCI ) && $wgWikimediaTravisCI == true ) { |
|
18 | - if ( is_readable( __DIR__ . '/../../vendor/autoload.php' ) ) { |
|
17 | +if (isset($wgWikimediaTravisCI) && $wgWikimediaTravisCI == true) { |
|
18 | + if (is_readable(__DIR__ . '/../../vendor/autoload.php')) { |
|
19 | 19 | require_once __DIR__ . '/../../vendor/autoload.php'; |
20 | 20 | } |
21 | -} elseif ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { |
|
21 | +} elseif (is_readable(__DIR__ . '/vendor/autoload.php')) { |
|
22 | 22 | require_once __DIR__ . '/vendor/autoload.php'; |
23 | 23 | } |
24 | 24 | |
25 | 25 | $GLOBALS['wgExtensionFunctions'][] = function() { |
26 | - if ( version_compare( $GLOBALS['wgVersion'], '1.25c', '<' ) ) { |
|
27 | - if ( !defined( 'SF_VERSION' ) || version_compare( 'SF_VERSION', '2.8', '<' ) ) { |
|
28 | - 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.' ); |
|
26 | + if (version_compare($GLOBALS['wgVersion'], '1.25c', '<')) { |
|
27 | + if (!defined('SF_VERSION') || version_compare('SF_VERSION', '2.8', '<')) { |
|
28 | + 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.'); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | - if ( version_compare( $GLOBALS['wgVersion'], '1.26c', '>' ) ) { |
|
33 | - if ( !ExtensionRegistry::getInstance()->isLoaded( 'SemanticForms' ) ) { |
|
34 | - 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.' ); |
|
32 | + if (version_compare($GLOBALS['wgVersion'], '1.26c', '>')) { |
|
33 | + if (!ExtensionRegistry::getInstance()->isLoaded('SemanticForms')) { |
|
34 | + 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.'); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | }; |
38 | 38 | |
39 | 39 | // Do not initialize more than once. |
40 | -if ( defined( 'SFS_VERSION' ) ) { |
|
40 | +if (defined('SFS_VERSION')) { |
|
41 | 41 | return 1; |
42 | 42 | } |
43 | 43 | |
44 | -define( 'SFS_VERSION', '1.3.0' ); |
|
44 | +define('SFS_VERSION', '1.3.0'); |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @codeCoverageIgnore |
48 | 48 | */ |
49 | -call_user_func( function() { |
|
49 | +call_user_func(function() { |
|
50 | 50 | |
51 | 51 | $GLOBALS['wgExtensionCredits']['semantic'][] = array( |
52 | 52 | 'path' => __FILE__, |
53 | 53 | 'name' => 'Semantic Forms Select', |
54 | - 'author' =>array( 'Jason Zhang', 'Toni Hermoso Pulido', '...' ), |
|
54 | + 'author' =>array('Jason Zhang', 'Toni Hermoso Pulido', '...'), |
|
55 | 55 | 'url' => 'https://www.mediawiki.org/wiki/Extension:SemanticFormsSelect', |
56 | 56 | 'description' => 'Allows to generate a select field in a semantic form whose values are retrieved from a query', |
57 | 57 | 'version' => SFS_VERSION, |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | $GLOBALS['wgSF_Select_debug'] = 0; |
66 | 66 | |
67 | 67 | // Register resource files |
68 | - $extensionPathParts = explode( DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR , __DIR__, 2 ); |
|
68 | + $extensionPathParts = explode(DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2); |
|
69 | 69 | |
70 | 70 | $GLOBALS['wgResourceModules']['ext.sf_select.scriptselect'] = array( |
71 | - 'localBasePath' => __DIR__ , |
|
72 | - 'remoteExtPath' => end( $extensionPathParts ), |
|
71 | + 'localBasePath' => __DIR__, |
|
72 | + 'remoteExtPath' => end($extensionPathParts), |
|
73 | 73 | 'position' => 'bottom', |
74 | - 'scripts' => array( 'res/scriptSelect.js' ), |
|
74 | + 'scripts' => array('res/scriptSelect.js'), |
|
75 | 75 | 'dependencies' => array( |
76 | 76 | 'ext.semanticforms.main' |
77 | 77 | ) |
78 | 78 | ); |
79 | 79 | |
80 | 80 | $GLOBALS['wgExtensionFunctions'][] = function() { |
81 | - $GLOBALS['sfgFormPrinter']->setInputTypeHook( 'SF_Select', '\SFS\SemanticFormsSelect::init', array() ); |
|
81 | + $GLOBALS['sfgFormPrinter']->setInputTypeHook('SF_Select', '\SFS\SemanticFormsSelect::init', array()); |
|
82 | 82 | }; |
83 | 83 | |
84 | 84 | } ); |