|
@@ -7,41 +7,41 @@ discard block |
|
|
block discarded – undo |
|
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 ( isset( $GLOBALS['wgWikimediaJenkinsCI'] ) && $GLOBALS['wgWikimediaJenkinsCI'] == true ) { |
|
15
|
|
- if ( is_readable( __DIR__ . '/../../vendor/autoload.php' ) ) { |
|
|
14
|
+if (isset($GLOBALS['wgWikimediaJenkinsCI']) && $GLOBALS['wgWikimediaJenkinsCI'] == true) { |
|
|
15
|
+ if (is_readable(__DIR__ . '/../../vendor/autoload.php')) { |
|
16
|
16
|
require_once __DIR__ . '/../../vendor/autoload.php'; |
|
17
|
17
|
} |
|
18
|
|
-} elseif ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { |
|
|
18
|
+} elseif (is_readable(__DIR__ . '/vendor/autoload.php')) { |
|
19
|
19
|
require_once __DIR__ . '/vendor/autoload.php'; |
|
20
|
20
|
} |
|
21
|
21
|
|
|
22
|
22
|
$GLOBALS['wgExtensionFunctions'][] = function() { |
|
23
|
|
- if ( version_compare( $GLOBALS['wgVersion'], '1.23', '<' ) ) { |
|
24
|
|
- if ( !defined( 'SF_VERSION' ) || version_compare( 'SF_VERSION', '2.8', 'lt' ) ) { |
|
25
|
|
- 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.' ); |
|
|
23
|
+ if (version_compare($GLOBALS['wgVersion'], '1.23', '<')) { |
|
|
24
|
+ if (!defined('SF_VERSION') || version_compare('SF_VERSION', '2.8', 'lt')) { |
|
|
25
|
+ 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
|
26
|
} |
|
27
|
27
|
} |
|
28
|
28
|
|
|
29
|
|
- if ( version_compare( $GLOBALS['wgVersion'], '1.25', '>' ) ) { |
|
30
|
|
- if ( !\ExtensionRegistry::getInstance()->isLoaded( 'SemanticForms' ) ) { |
|
31
|
|
- 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.' ); |
|
|
29
|
+ if (version_compare($GLOBALS['wgVersion'], '1.25', '>')) { |
|
|
30
|
+ if (!\ExtensionRegistry::getInstance()->isLoaded('SemanticForms')) { |
|
|
31
|
+ 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
|
32
|
} |
|
33
|
33
|
} |
|
34
|
34
|
}; |
|
35
|
35
|
|
|
36
|
36
|
// Do not initialize more than once. |
|
37
|
|
-if ( defined( 'SFS_VERSION' ) ) { |
|
|
37
|
+if (defined('SFS_VERSION')) { |
|
38
|
38
|
return 1; |
|
39
|
39
|
} |
|
40
|
40
|
|
|
41
|
|
-define( 'SFS_VERSION', '1.3.0' ); |
|
|
41
|
+define('SFS_VERSION', '1.3.0'); |
|
42
|
42
|
|
|
43
|
|
-if ( function_exists( 'wfLoadExtension' ) ) { |
|
44
|
|
- wfLoadExtension( 'SemanticFormsSelect' ); |
|
|
43
|
+if (function_exists('wfLoadExtension')) { |
|
|
44
|
+ wfLoadExtension('SemanticFormsSelect'); |
|
45
|
45
|
// Keep i18n globals so mergeMessageFileList.php doesn't break |
|
46
|
46
|
$GLOBALS['wgMessagesDirs']['SemanticFormsSelect'] = __DIR__ . '/i18n'; |
|
47
|
47
|
/* wfWarn( |
|
@@ -54,12 +54,12 @@ discard block |
|
|
block discarded – undo |
|
54
|
54
|
/** |
|
55
|
55
|
* @codeCoverageIgnore |
|
56
|
56
|
*/ |
|
57
|
|
-call_user_func( function() { |
|
|
57
|
+call_user_func(function() { |
|
58
|
58
|
|
|
59
|
59
|
$GLOBALS['wgExtensionCredits']['semantic'][] = array( |
|
60
|
60
|
'path' => __FILE__, |
|
61
|
61
|
'name' => 'Semantic Forms Select', |
|
62
|
|
- 'author' =>array( 'Jason Zhang', 'Toni Hermoso Pulido', '...' ), |
|
|
62
|
+ 'author' =>array('Jason Zhang', 'Toni Hermoso Pulido', '...'), |
|
63
|
63
|
'url' => 'https://www.mediawiki.org/wiki/Extension:SemanticFormsSelect', |
|
64
|
64
|
'descriptionmsg' => 'semanticformsselect-desc', |
|
65
|
65
|
'version' => SFS_VERSION, |
|
@@ -75,20 +75,20 @@ discard block |
|
|
block discarded – undo |
|
75
|
75
|
$GLOBALS['wgSF_Select_debug'] = 0; |
|
76
|
76
|
|
|
77
|
77
|
// Register resource files |
|
78
|
|
- $extensionPathParts = explode( DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR , __DIR__, 2 ); |
|
|
78
|
+ $extensionPathParts = explode(DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2); |
|
79
|
79
|
|
|
80
|
80
|
$GLOBALS['wgResourceModules']['ext.sf_select.scriptselect'] = array( |
|
81
|
|
- 'localBasePath' => __DIR__ , |
|
82
|
|
- 'remoteExtPath' => end( $extensionPathParts ), |
|
|
81
|
+ 'localBasePath' => __DIR__, |
|
|
82
|
+ 'remoteExtPath' => end($extensionPathParts), |
|
83
|
83
|
'position' => 'bottom', |
|
84
|
|
- 'scripts' => array( 'res/scriptSelect.js' ), |
|
|
84
|
+ 'scripts' => array('res/scriptSelect.js'), |
|
85
|
85
|
'dependencies' => array( |
|
86
|
86
|
'ext.semanticforms.main' |
|
87
|
87
|
) |
|
88
|
88
|
); |
|
89
|
89
|
|
|
90
|
90
|
$GLOBALS['wgExtensionFunctions'][] = function() { |
|
91
|
|
- $GLOBALS['sfgFormPrinter']->setInputTypeHook( 'SF_Select', '\SFS\SemanticFormsSelect::init', array() ); |
|
|
91
|
+ $GLOBALS['sfgFormPrinter']->setInputTypeHook('SF_Select', '\SFS\SemanticFormsSelect::init', array()); |
|
92
|
92
|
}; |
|
93
|
93
|
|
|
94
|
94
|
} ); |