tags, and runs it through the # external script "graphcnv", which generates an ASCII, HTML, SVG or PNG # graph from it. $wgExtensionFunctions[] = "wfGraphExtension"; function wfGraphExtension() { global $wgParser; # register the extension with the WikiText parser # the second parameter is the callback function for processing the text between the tags $wgParser->setHook( "graph", "renderGraph" ); } # for Special::Version: $wgExtensionCredits['parserhook'][] = array( 'name' => 'graph extension', 'author' => 'Tels', 'url' => 'http://wwww.bloodgate.com/perl/graph/', 'version' => 'v0.21', ); # The callback function for converting the input text to HTML output function renderGraph( $input ) { global $wgInputEncoding; if( !is_executable( "graph/graphcnv" ) ) { return "graph/graphcnv is not executable"; } $cmd = "graph/graphcnv ". escapeshellarg($input) . " " . escapeshellarg($wgInputEncoding); $output = `$cmd`; if (strlen($output) == 0) { return "Couldn't execute graph/graphcnv" . ' See the manual for help.'; } return $output; } ?>