-
Notifications
You must be signed in to change notification settings - Fork 0
/
Topbar.hooks.php
53 lines (46 loc) · 1.45 KB
/
Topbar.hooks.php
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* __ __ _ _ _ _
* \ \ / / (_) | | | | |
* \ \ /\ / / __ _| |_| |__ _ __ ___| |_
* \ \/ \/ / '__| | __| '_ \ | '_ \ / _ \ __|
* \ /\ /| | | | |_| | | |_| | | | __/ |_
* \/ \/ |_| |_|\__|_| |_(_)_| |_|\___|\__|
*
* @author Kevin Kragenbrink <[email protected]>
* @created 18th January 2012
* @edited 19th January 2012
* @version 1.0.0
*/
// Validate entrypoint.
if ( !defined( 'MEDIAWIKI' ) ) {
die( 'This file is a MediaWiki extension, it is not a valid entry point' );
}
/**
* Sets up the Topbar hooks.
*/
class TopbarHooks {
/**
* Constructs the TopbarHooks class.
*/
public function __construct() {
global $wgHooks;
// Setup hooks.
$wgHooks['BeforePageDisplay'][] = 'TopbarHooks::hookBeforePageDisplay';
}
/**
* Adds the topbar navigation to the page.
*
* @static
* @param &$out OutputPage The Page being rendered
* @param &$skin Skin The Skin object that will be used to render the page.
* @return bool
*/
public static function hookBeforePageDisplay(&$out, &$skin) {
wfDebugLog('Topbar', __METHOD__);
global $wgScriptPath;
$out->addScriptFile($wgScriptPath . '/extensions/Topbar/js/Topbar.js');
$out->addStyle($wgScriptPath . '/extensions/Topbar/css/Topbar.css');
return true;
}
}