Skip to content

Instantly share code, notes, and snippets.

@oremj

oremj/gist:289057

Created Jan 28, 2010
Embed
What would you like to do?
<?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
You can’t perform that action at this time.