-
Notifications
You must be signed in to change notification settings - Fork 7
/
Booty.class.php
96 lines (79 loc) · 2.28 KB
/
Booty.class.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
class Booty{
/**
* Booty is a static singleton, it cannot be instantiated.
*/
private function __construct(){}
public static $skinOptions = array();
public static $baseURL = '';
public static $readyHandlers = array();
/**
* Set up the various hooks needed
*
* Handler for Hook: BeforeInit
*/
public static function init(){
self::$baseURL = $GLOBALS['egBootyBaseURL'];
self::initSkin();
self::initLayouts();
//pass options along to skinny
//Skinny::setOptions($options);
//self::setOptions($options);
//$wgHooks['ResourceLoaderRegisterModules'][] = 'Booty::registerResources';
foreach(self::$readyHandlers as $fn){
$fn();
}
//$wgExtensionFunctions[] = "Booty::tags";
return true;
}
public static function onReady( $fn ){
array_push(self::$readyHandlers, $fn);
}
/**
* Init the skin. Give it a chance to define resources etc
*/
public static function initSkin( ){
SkinBooty::init();
}
/**
* Initialize layouts from $egBootyLayouts config
*/
public static function initLayouts( ){
foreach( $GLOBALS['egBootyLayouts'] as $name => $config ){
Booty::addLayout( $name, $config );
}
}
/**
* Convenience methods for SkinBooty
*/
public static function setOptions($options, $reset=false){
if($reset===true){
self::$skinOptions = array();
}
self::$skinOptions = Skinny::mergeOptionsArrays( self::$skinOptions, $options );
}
public static function addLayout( $name, $config ){
SkinBooty::addLayout( $name, $config );
}
public static function extendLayout( $extend, $name, $config ){
SkinBooty::extendLayout( $extend, $name, $config );
}
public static function setLayoutOptions( $layout_name, $options ){
SkinBooty::setLayoutOptions( $layout_name, $options );
}
public static function setLayoutTemplateOptions( $layout_name, $options ){
SkinBooty::setLayoutTemplateOptions( $layout_name, $options );
}
public static function addModules( $modules, $auto=false ){
SkinBooty::addModules( $modules, $auto );
}
public static function loadModules( $modules ){
SkinBooty::autoloadModules( $modules );
}
public static function addModulesToLayout( $layout, $modules ){
SkinBooty::addModulesToLayout( $layout, $modules );
}
public static function addTemplatePath( $path ){
SkinBooty::addTemplatePath( $path );
}
}