Created
January 28, 2010 19:28
-
-
Save oremj/289057 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$wgExtensionFunctions[] = 'efVideoSetUp'; | |
function videoCreateAttrs($args) { | |
$attrs = array(); | |
foreach($args as $key => $value) { | |
$attrs[] = sprintf('%s="%s"', $key, htmlspecialchars($value)); | |
} | |
return implode(" ", $attrs); | |
} | |
function efVideoSetUp() { | |
global $wgParser; | |
$wgParser->setHook('video', 'efVideoRender'); | |
$wgParser->setHook('source', 'efSourceRender'); | |
return true; | |
} | |
function efVideoRender($input, $args, $parser, $frame) { | |
$output = $parser->recursiveTagParse($input, $frame); | |
return "<video " . videoCreateAttrs($args) . ">$output</video>"; | |
} | |
function efSourceRender($input, $args, $parser, $frame) { | |
return "<source " . videoCreateAttrs($args) . "/>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment