Ejemplo n.º 1
0
/**
 * Hook callback that injects messages and things into the <head> tag
 * Does nothing if $parserOutput->mPlotterTag is not set
 */
function PlottersParserOutput( $outputPage, $parserOutput )  {
	if ( !empty( $parserOutput->mPlottersTag ) ) {
		// Output required javascript
		$genericname = "generic";
		$plotkitname = "plotkit";
		if ( $parserOutput->mplotter["$genericname"] ) {
			Plotters::setPlottersHeaders( $outputPage, 'generic' );
		} elseif ( $parserOutput->mplotter["$plotkitname"] ) {
			Plotters::setPlottersHeaders( $outputPage, 'plotkit' );
		}

		// Output user defined javascript
		$plotters = wfLoadPlotters();
		if ( !$plotters ) return true;

		$done = array();

		foreach ( $plotters as $pname => $code ) {
			$tname = strtolower( "$pname" );
			if ( $parserOutput->mplotter["$tname"] ) {
				wfApplyPlotterCode( $code, $outputPage, $done );
			}
		}
	}
	return true;
}