Created
March 3, 2010 23:05
-
-
Save dogmatic69/321161 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 | |
// 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