1 | <?php |
||
2 | |||
3 | declare( strict_types = 1 ); |
||
4 | |||
5 | namespace ModernTimeline; |
||
6 | |||
7 | class ModernTimelineSetup { |
||
8 | |||
9 | public static function onExtensionFunction(): void { |
||
10 | self::doSmwCheck(); |
||
11 | |||
12 | $GLOBALS['smwgResultFormats']['moderntimeline'] = ModernTimelinePrinter::class; |
||
13 | } |
||
14 | |||
15 | private static function doSmwCheck(): void { |
||
16 | if ( !defined( 'SMW_VERSION' ) ) { |
||
17 | |||
18 | if ( PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' ) { |
||
19 | die( "\nThe 'Modern Timeline' extension requires 'Semantic MediaWiki' to be installed and enabled.\n" ); |
||
0 ignored issues
–
show
|
|||
20 | } |
||
21 | |||
22 | die( |
||
0 ignored issues
–
show
|
|||
23 | '<b>Error:</b> The <a href="https://professional.wiki/en/extension/modern-timeline">Modern Timeline</a> ' . |
||
24 | 'extension requires <a href="https://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki">Semantic MediaWiki</a> to be ' . |
||
25 | 'installed and enabled.<br />' |
||
26 | ); |
||
27 | } |
||
28 | } |
||
29 | |||
30 | } |
||
31 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.