Skip to content

Instantly share code, notes, and snippets.

@dogmatic69
Created March 3, 2010 23:05
Show Gist options
  • Save dogmatic69/321161 to your computer and use it in GitHub Desktop.
Save dogmatic69/321161 to your computer and use it in GitHub Desktop.
<?php
// add this code to $ip/extentions/Gist/Gist.php
// include this in your LocalSettings.php require_once( "$IP/extensions/Gist/Gist.php" );
// Usage <gist>{id}</gist>
$wgHooks['ParserFirstCallInit'][] = 'efGistParserInit';
function efGistParserInit(&$parser) {
$parser->setHook( 'gist', 'efGistRender' );
return true;
}
function efGistRender($input, $args, $parser, $frame) {
if ((int)$input > 0) {
return '<script src="http://gist.github.com/'.(int)$input.'.js"></script>';
}
return 'Not valid id';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment