-
Notifications
You must be signed in to change notification settings - Fork 7
/
Booty.extension.php
50 lines (40 loc) · 1.25 KB
/
Booty.extension.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
<?php
class BootyExtension {
public static function __callStatic($name, $fargs)
{
$wgParser = $GLOBALS['wgParser'];
$input = $fargs[0];
$class = FALSE;
if(is_array($fargs[1])) {
if(array_key_exists('class', $fargs[1])) {
$class = $fargs[1]['class'];
}
}
return '<div class="' . $name . ($class?' '.$class:'') . '">' . $wgParser->recursiveTagParse($input) . '</div>';
}
public static function heroUnit($parser){
$args = func_get_args();
array_shift($args);//unshift parser from start of argument list
$content = array_pop($args); //pop content argument from end of argument list
$opts = array(
'class'=>'',
'id'=>''
);
//run through any remaining arguments and explode any key=val strings into options
if(count($args) > 0){
foreach($args as $arg){
$parts = explode('=', $arg);
if(count($parts)===2 && isset($opts[$parts[0]])){
$opts[$parts[0]] = $parts[1];
}
}
}
return '<div class="hero-unit '.$opts['class'].'" id="'.$opts['id'].'">'.$content.'</div>';
}
public static function setSkin($parser, $skin){
/* @todo: in order to work with parsercache this needs to cache the value in wikitext and retreive it
before the skin is initialized */
Bootstrap::$pageSkin = $skin;
return true;
}
}