summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/ModernTimeline/src/ModernTimelineSetup.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/ModernTimeline/src/ModernTimelineSetup.php')
-rw-r--r--www/wiki/extensions/ModernTimeline/src/ModernTimelineSetup.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/www/wiki/extensions/ModernTimeline/src/ModernTimelineSetup.php b/www/wiki/extensions/ModernTimeline/src/ModernTimelineSetup.php
new file mode 100644
index 00000000..f2853953
--- /dev/null
+++ b/www/wiki/extensions/ModernTimeline/src/ModernTimelineSetup.php
@@ -0,0 +1,30 @@
+<?php
+
+declare( strict_types = 1 );
+
+namespace ModernTimeline;
+
+class ModernTimelineSetup {
+
+ public static function onExtensionFunction() {
+ self::doSmwCheck();
+
+ $GLOBALS['smwgResultFormats']['moderntimeline'] = ModernTimelinePrinter::class;
+ }
+
+ private static function doSmwCheck() {
+ if ( !defined( 'SMW_VERSION' ) ) {
+
+ if ( PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' ) {
+ die( "\nThe 'Modern Timeline' extension requires 'Semantic MediaWiki' to be installed and enabled.\n" );
+ }
+
+ die(
+ '<b>Error:</b> The <a href="https://github.com/ProfessionalWiki/ModernTimeline">Modern Timeline</a> ' .
+ 'extension requires <a href="https://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki">Semantic MediaWiki</a> to be ' .
+ 'installed and enabled.<br />'
+ );
+ }
+ }
+
+}