summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/ModernTimeline/src/ModernTimelineSetup.php
blob: f285395343f1e21ee811f28a763b9192a2141016 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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 />'
			);
		}
	}

}