forked from aaronpk/Bootstrap-Skin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBootstrapExtension.php
46 lines (34 loc) · 1.18 KB
/
BootstrapExtension.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
<?php
$wgExtensionFunctions[] = "BootstrapSetup";
$wgExtensionCredits['parserhook'][] = array(
'name' => 'Bootstrap',
'author' => 'Aaron Parecki',
'description' => 'Adds <nowiki><span6></nowiki> tags to support Bootstrap layouts',
'url' => 'https://github.com/aaronpk/Bootstrap-Skin'
);
function BootstrapSetup() {
global $wgParser;
for($i=1; $i<=16; $i++)
$wgParser->setHook('span'.$i, array('BootstrapExtension','span'.$i));
$wgParser->setHook('span-one-third', array('BootstrapExtension','span-one-third'));
$wgParser->setHook('span-two-thirds', array('BootstrapExtension','span-two-thirds'));
$wgParser->setHook('row', array('BootstrapExtension','row'));
$wgParser->setHook('mediagrid', array('BootstrapExtension','mediagrid'));
}
class BootstrapExtension {
public static function mediagrid()
{
}
public static function __callStatic($name, $fargs)
{
global $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>';
}
}