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