forked from tjvr/wiki-scratchblocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScratchblockHooks.php
More file actions
28 lines (24 loc) · 914 Bytes
/
ScratchblockHooks.php
File metadata and controls
28 lines (24 loc) · 914 Bytes
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
<?php
class ScratchblockHook {
// Ouput HTML for <scratchblocks> tag
public static function sbParserInit (Parser $parser) {
// Register <scratchblocks> and <sb> tag
$parser->setHook('scratchblocks', array( "ScratchblockHook", 'sbRenderTag') );
$parser->setHook('sb', array( "ScratchblockHook", 'sbRenderInlineTag') );
//throw new Exception(var_dump($parser));
return true;
}
public static function sbSetup() {
global $wgOut;
$wgOut->addModules('ext.scratchBlocks');
}
// Output HTML for <scratchblocks> tag
public static function sbRenderTag ($input, array $args, Parser $parser, PPFrame $frame) {
return '<pre class="blocks">' . htmlspecialchars($input) . '</pre>';
}
// Output HTML for inline <sb> tag
public static function sbRenderInlineTag ($input, array $args, Parser $parser, PPFrame $frame) {
return '<code class="blocks">' . htmlspecialchars($input) . '</code>';
}
}
?>