Open main menu

Extension:PChartWiki

MediaWiki extensions manual
OOjs UI icon advanced.svg
pChartWiki
Release status: experimental
Implementation Tag
Description Adds <pchart> tag for creating pCharts
Author(s) Ripley Jonez
License GNU General Public License 2.0
Download No link
Translate the PChartWiki extension if it is available at translatewiki.net
Check usage and version matrix.

What can this extension do?Edit

The pChartWiki feature produces an embedded image from wikitext, much in the same way as Erik Zachte's EasyTimeline. It works as a wrapper for the pChart php class (Version 1.27d), http://pchart.sourceforge.net/

What isn't in this extension?Edit

The following methods have not been carried over from the original pChart class, but that doesn't mean they wont in the future.

  • ImportFromCSV
  • drawFromPNG
  • drawFromGIF
  • drawFromJPG
  • Stroke
  • setImageMap
  • getImageMap

UsageEdit

This code is INCOMPLETE and will only render a radar graph. It has NOT been TESTED for any vulnerabilities either.

Download instructionsEdit

Please cut and paste the code found below and place it in $IP/extensions/ExtensionName/ExtensionName.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

InstallationEdit

To install this extension, add the following to LocalSettings.php:

#add configuration parameters here
#setup user rights here
require_once("$IP/extensions/pChartWiki/pChart.php");

Configuration parametersEdit

User rightsEdit

CodeEdit

<?php
/**
 * pChartWiki - pChart extension
 * To use, include this file from your LocalSettings.php
 * To configure, set members of $pChartWikiSettings after the inclusion
 *
 * @file
 * @ingroup Extensions
 * @author Ripley Jonez <xxx@gmail.com (nospam: xxx=endofzero)>
 * @license GNU General Public License version 2
 * @link http://www.mediawiki.org/wiki/Extension:pChartWiki Documentation
 */

//$fontPath = $IP.'/extensions/pChartWiki/pChart/Fonts';
$fontPath = '/usr/share/fonts/truetype/freefont';

require("$IP/extensions/pChartWiki/pChart/pData.class");
require("$IP/extensions/pChartWiki/pChart/pChart.class");

class pChartWikiSettings {
	// Update this timestamp to force older rendered timelines
	// to be generated when the page next gets rendered.
	// Can help to resolve old image-generation bugs.
	var $epochTimestamp = '20010115000000';
};

$pChartWikiSettings = new pChartWikiSettings;

$wgHooks['ParserFirstCallInit'][] = 'pChartWikiExtension';
$wgExtensionCredits['parserhook'][] = array(
	'path' => __FILE__,
	'name' => 'pChartWiki',
	'author' => 'Ripley Jonez',
	'url' => 'http://www.mediawiki.org/wiki/Extension:pChartWiki',
	'descriptionmsg' => 'pchart-desc',
	'license-name' => 'GPL-2.0',
);
$wgExtensionMessagesFiles['pChart'] = dirname(__FILE__) . '/pChart.i18n.php';

function pChartWikiExtension( &$parser ) {
	$parser->setHook( 'pchart', 'renderpChart' );
	return true;
}

function renderpChart( $pchartsrc ){
	global  $wgUploadDirectory, $wgUploadPath, $IP, $pChartWikiSettings, $wgArticlePath, $wgTmpDirectory, $wgRenderHashAppend, $fontPath;


$debug = FALSE;

// Class initialisation
$DataSet = new pData;

//Parse source into array based on lines
	$pChartArray = explode("\n", $pchartsrc);
//Create hash based on tag source
	$hash = md5( $pchartsrc );
//Create a filename based on the hash
	if ($wgRenderHashAppend != "")
		$hash = md5( $hash . $wgRenderHashAppend );
	$dest = $wgUploadDirectory."/pchart/";
	if ( ! is_dir( $dest ) ) { mkdir( $dest, 0777 ); }
	if ( ! is_dir( $wgTmpDirectory ) ) { mkdir( $wgTmpDirectory, 0777 ); }
	$fname = $dest . $hash;
	$previouslyFailed = file_exists( $fname.".err" );
	$previouslyRendered = file_exists( $fname.".png" );
	$expired = $previouslyRendered &&
		( filemtime( $fname.".png" ) <
			wfTimestamp( TS_UNIX, $wgTimelineSettings->epochTimestamp ) );

	if ( $expired || ( !$previouslyRendered && !$previouslyFailed ) ){

	// This time, make a list of attributes and their values,
	// and dump them, along with the user input
//Parse through array and create chart
foreach( $pChartArray as $name => $value ){
//Only process if $value isn't blank
	if (trim($value) != ""){
//Separate command with values
		$parseString = explode(":",$value);

		switch (strtolower(trim($parseString[0]))){
			case debug:
				$debug=True;
				$attr[] = htmlspecialchars( "ON Debug" );
			break;

			case addpoint:
				$inputSplit = explode(";",$parseString[1]);
				if (count($inputSplit)==1){
					$DataSet->AddPoint((explode("," , trim($inputSplit[0]))));
					$attr[] = htmlspecialchars( "\$DataSet->AddPoint(array(".$inputSplit[0]."))" );
				}elseif (count($inputSplit)==2){
					$DataSet->AddPoint((explode("," , trim($inputSplit[0]))),trim($inputSplit[1]));
					$attr[] = htmlspecialchars( "\$DataSet->AddPoint(array(".$inputSplit[0]."),".trim($inputSplit[1]).")");
				}elseif (count($inputSplit)==3){
					$DataSet->AddPoint((explode("," , trim($inputSplit[0]))),trim($inputSplit[1]),trim($inputSplit[2]));
					$attr[] = htmlspecialchars( "\$DataSet->AddPoint(array(".$inputSplit[0]."),".trim($inputSplit[1]).",".trim($inputSplit[2]).")");
				}else{
					$attr[] = '<strong>ERR: ' . htmlspecialchars( $name ) . '</strong> = ' . htmlspecialchars( $parseString[0]." -> ".$parseString[1] );
				}	
			break;

			case addserie:
				$DataSet->AddSerie(trim($parseString[1]));
				$attr[] = htmlspecialchars( "\$DataSet->AddSerie(".trim($parseString[1]).")" );
			break;

			case addallseries:
				$DataSet->AddAllSeries();
				$attr[] = htmlspecialchars( "\$DataSet->AddAllSeries()");
			break;

			case removeserie:
				$DataSet->RemoveSerie(trim($parseString[1]));
				$attr[] = htmlspecialchars( "\$DataSet->RemoveSerie(".trim($parseString[1]).")" );
			break;

			case setabsciselabelserie:
				$inputSplit = explode(";",$parseString[1]);
				if (count($inputSplit)==0){
					$DataSet->SetAbsciseLabelSerie();
					$attr[] = htmlspecialchars( "\$DataSet->SetAbsciseLabelSerie()");
				}elseif (count($inputSplit)==1){
					$DataSet->SetAbsciseLabelSerie(trim($parseString[1]));
					$attr[] = htmlspecialchars( "\$DataSet->SetAbsciseLabelSerie(".trim($parseString[1]).")");
				}
			break;

			case setseriename:
				$inputSplit = explode(";",$parseString[1]);
				if (count($inputSplit)==1){
					$DataSet->SetSerieName(trim($inputSplit[0]));
					$attr[] = htmlspecialchars( "\$DataSet->SetSerieName($inputSplit[0])");
				}elseif (count($inputSplit)==2){
					$DataSet->SetSerieName(trim($inputSplit[0]),trim($inputSplit[1]));
					$attr[] = htmlspecialchars( "\$DataSet->SetSerieName($inputSplit[0],$inputSplit[1])");
				}else{
					$attr[] = '<strong>ERR: ' . htmlspecialchars( $name ) . '</strong> = ' . htmlspecialchars( $parseString[0]." -> ".$parseString[1] );
				}
			break;

			case setyaxisname:
				$DataSet->SetYAxisName(trim($parseString[1]));
				$attr[] = htmlspecialchars( "\$DataSet->SetYAxisName($parseString[1])");
			break;

			case setxaxisname:
				$DataSet->SetXAxisName(trim($parseString[1]));
				$attr[] = htmlspecialchars( "\$DataSet->SetXAxisName($parseString[1])");
			break;

			case setyaxisformat:
				$DataSet->SetYAxisFormat(trim($parseString[1]));
				$attr[] = htmlspecialchars( "\$DataSet->SetYAxisFormat($parseString[1])");
			break;

			case setxaxisformat:
				$DataSet->SetXAxisFormat(trim($parseString[1]));
				$attr[] = htmlspecialchars( "\$DataSet->SetXAxisFormat($parseString[1])");
			break;

			case setyaxisunit:
				$DataSet->SetYAxisUnit(trim($parseString[1]));
				$attr[] = htmlspecialchars( "\$DataSet->SetYAxisUnit($parseString[1])");
			break;

			case setxaxisunit:
				$DataSet->SetXAxisUnit(trim($parseString[1]));
				$attr[] = htmlspecialchars( "\$DataSet->SetXAxisUnit(".trim($parseString[1]).")");
			break;

			case removeseriename:
				$DataSet->removeSerieName(trim($parseString[1]));
				$attr[] = htmlspecialchars( "\$DataSet->removeSerieName(".trim($parseString[1]).")");
			break;


			case pchart:
				$inputSplit = explode(",",$parseString[1]);
				$Test = new pChart(trim($inputSplit[0]),trim($inputSplit[1]));
				$attr[] = htmlspecialchars( "\$Test = new pChart($inputSplit[0],$inputSplit[1])");
			break;

			case drawbackground:
				$inputSplit = explode(",",$parseString[1]);
				if (count($inputSplit)==3){
					$Test->drawBackground(trim($inputSplit[0]),trim($inputSplit[1]),trim($inputSplit[2]));
					$attr[] = htmlspecialchars( "\$Test->drawBackground($inputSplit[0],$inputSplit[1],$inputSplit[2])");
				}else{
					$attr[] = '<strong>ERR: ' . htmlspecialchars( $name ) . '</strong> = ' . htmlspecialchars( $parseString[0]." -> ".$parseString[1] );
				}
			break;

			case setfontproperties:
				$inputSplit = explode(",",$parseString[1]);
				$Test->setFontProperties("$fontPath/$inputSplit[0]",$inputSplit[1]);
				$attr[] = htmlspecialchars( "\$Test->setFontProperties($fontPath/$inputSplit[0],$inputSplit[1])");
			break;

			case drawfilledroundedrectangle:
				$inputSplit = explode(",",$parseString[1]);
				$Test->drawFilledRoundedRectangle($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6],$inputSplit[7]);
				$attr[] = htmlspecialchars( "\$Test->drawFilledRoundedRectangle($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6],$inputSplit[7])");
			break;

			case drawroundedrectangle:
				$inputSplit = explode(",",$parseString[1]);
				$Test->drawRoundedRectangle($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6],$inputSplit[7]);
				$attr[] = htmlspecialchars( "\$Test->drawRoundedRectangle($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6],$inputSplit[7])");
			break;

			case setgrapharea:
				$inputSplit = explode(",",$parseString[1]);
				if (count($inputSplit)==4){
					$Test->setGraphArea($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3]);
					$attr[] = htmlspecialchars( "\$Test->setGraphArea($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3])");
				}else{
					$attr[] = '<strong>ERR: ' . htmlspecialchars( $name ) . '</strong> = ' . htmlspecialchars( $parseString[0]." -> ".$parseString[1] );
				}
			break;

			case drawtreshold:
				$inputSplit = explode(",",$parseString[1]);
				if (count($inputSplit)==4){
					$Test->drawTreshold($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3]);
					$attr[] = htmlspecialchars( "\$Test->drawTreshold($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3])");
				}elseif (count($inputSplit)==5){
					$Test->drawTreshold($inputSplit[0],$inputSplit[1],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4]);
					$attr[] = htmlspecialchars( "\$Test->drawTreshold($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4])");
				}elseif (count($inputSplit)==6){
					$Test->drawTreshold($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5]);
					$attr[] = htmlspecialchars( "\$Test->drawTreshold($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5])");
				}elseif (count($inputSplit)==7){
					$Test->SetSerieName($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6]);
					$attr[] = htmlspecialchars( "\$Test->drawTreshold($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6])");
				}elseif (count($inputSplit)==8){
					$Test->SetSerieName($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6],$inputSplit[7]);
					$attr[] = htmlspecialchars( "\$Test->drawTreshold($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6],$inputSplit[7])");
				}else{
					$attr[] = '<strong>ERR: ' . htmlspecialchars( $name ) . '</strong> = ' . htmlspecialchars( $parseString[0]." -> ".$parseString[1] );
				}
			break;

			case drawradaraxis:
				$inputSplit = explode(",",$parseString[1]);
				$Test->drawRadarAxis($DataSet->GetData(),$DataSet->GetDataDescription(),$inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6],$inputSplit[7]);
				$attr[] = htmlspecialchars( "\$Test->drawRadarAxis(\$DataSet->GetData(),\$DataSet->GetDataDescription(),$inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6],$inputSplit[7])");
			break;

			case drawfilledradar:
				$inputSplit = explode(",",$parseString[1]);
				$Test->drawFilledRadar($DataSet->GetData(),$DataSet->GetDataDescription(),$inputSplit[0],$inputSplit[1]);
				$attr[] = htmlspecialchars( "\$Test->drawFilledRadar(\$DataSet->GetData(),\$DataSet->GetDataDescription(),$inputSplit[0],$inputSplit[1])");
			break;

			case drawlegend:
				$inputSplit = explode(",",$parseString[1]);
				$Test->drawLegend($inputSplit[0],$inputSplit[1],$DataSet->GetDataDescription(),$inputSplit[2],$inputSplit[3],$inputSplit[4]);
				$attr[] = htmlspecialchars( "\$Test->drawLegend($inputSplit[0],$inputSplit[1],\$DataSet->GetDataDescription(),$inputSplit[2],$inputSplit[3],$inputSplit[4])");
			break;

			case drawtitle:
				$inputSplit = explode(",",$parseString[1]);
				$Test->drawTitle($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6]);
				$attr[] = htmlspecialchars( "\$Test->drawTitle($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6])");
			break;

			case drawbargraph:
			$inputSplit = explode(",",$parseString[1]);
				if ($inputSplit[0]=="TRUE"){
					$Test->drawBarGraph($DataSet->GetData(),$DataSet->GetDataDescription(),TRUE);
				}else{
					$Test->drawBarGraph($DataSet->GetData(),$DataSet->GetDataDescription(),FALSE);
				}
					$attr[] = htmlspecialchars( "\$Test->drawBarGraph($inputSplit[0])");
			break;

			case drawstackedbargraph:
			$inputSplit = explode(",",$parseString[1]);
				if ($inputSplit[0]=="TRUE"){
					$Test->drawStackedBarGraph($DataSet->GetData(),$DataSet->GetDataDescription(),TRUE);
				}else{
					$Test->drawStackedBarGraph($DataSet->GetData(),$DataSet->GetDataDescription(),FALSE);
				}
					$attr[] = htmlspecialchars( "\$Test->drawStackedBarGraph($inputSplit[0])");
			break;

			case drawplotgraph:
				$inputSplit = explode(",",$parseString[1]);
				$Test->drawPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),3,2,255,255,255); 
				$attr[] = htmlspecialchars( "\$Test->drawTitle($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6])");
			break;

			case setyaxisname:
				$DataSet->SetYAxisName("$parseString[1]");
				$attr[] = htmlspecialchars( "\$DataSet->SetYAxisName($parseString[1])");
			break;

			case setyaxisunit:
				$DataSet->SetYAxisUnit("$parseString[1]");
				$attr[] = htmlspecialchars( "\$DataSet->SetYAxisUnit($parseString[1])");
			break;

			case drawgrapharea:
				$inputSplit = explode(",",$parseString[1]);
				if (trim($inputSplit[3])=="TRUE"){
					$Test->drawGraphArea($inputSplit[0],$inputSplit[1],$inputSplit[2],TRUE);
					$attr[] = htmlspecialchars( "\$Test->drawGraphArea($inputSplit[0],$inputSplit[1],$inputSplit[2],TRUE)");
				}else{
					$Test->drawGraphArea($inputSplit[0],$inputSplit[1],$inputSplit[2],FALSE);				
					$attr[] = htmlspecialchars( "\$Test->drawGraphArea($inputSplit[0],$inputSplit[1],$inputSplit[2],FALSE)");
				}
			break;

			case drawscale:
				$inputSplit = explode(",",$parseString[1]);
				if (count($inputSplit)==8){
					if ($inputSplit[0]=="SCALE_NORMAL"){
						if ($inputSplit[4]=="TRUE"){
							if ($inputSplit[7]=="TRUE"){
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,$inputSplit[1],$inputSplit[2],$inputSplit[3],TRUE,$inputSplit[5],$inputSplit[6],TRUE);
							}else{
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,$inputSplit[1],$inputSplit[2],$inputSplit[3],TRUE,$inputSplit[5],$inputSplit[6],FALSE);			
							}
						}else{
							if ($inputSplit[7]=="TRUE"){
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,$inputSplit[1],$inputSplit[2],$inputSplit[3],FALSE,$inputSplit[5],$inputSplit[6],TRUE);
							}else{
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,$inputSplit[1],$inputSplit[2],$inputSplit[3],FALSE,$inputSplit[5],$inputSplit[6],FALSE);			
							}
						}
					}elseif ($inputSplit[0]=="SCALE_START0"){
						if ($inputSplit[4]=="TRUE"){
							if ($inputSplit[7]=="TRUE"){
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_START0,$inputSplit[1],$inputSplit[2],$inputSplit[3],TRUE,$inputSplit[5],$inputSplit[6],TRUE);
							}else{
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_START0,$inputSplit[1],$inputSplit[2],$inputSplit[3],TRUE,$inputSplit[5],$inputSplit[6],FALSE);			
							}
						}else{
							if ($inputSplit[7]=="TRUE"){
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_START0,$inputSplit[1],$inputSplit[2],$inputSplit[3],FALSE,$inputSplit[5],$inputSplit[6],TRUE);
							}else{
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_START0,$inputSplit[1],$inputSplit[2],$inputSplit[3],FALSE,$inputSplit[5],$inputSplit[6],FALSE);			
							}
						}
				        }elseif ($inputSplit[0]=="SCALE_ADDALL"){
						if ($inputSplit[4]=="TRUE"){
							if ($inputSplit[7]=="TRUE"){
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_ADDALL,$inputSplit[1],$inputSplit[2],$inputSplit[3],TRUE,$inputSplit[5],$inputSplit[6],TRUE);
							}else{
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_ADDALL,$inputSplit[1],$inputSplit[2],$inputSplit[3],TRUE,$inputSplit[5],$inputSplit[6],FALSE);			
							}
						}else{
							if ($inputSplit[7]=="TRUE"){
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_ADDALL,$inputSplit[1],$inputSplit[2],$inputSplit[3],FALSE,$inputSplit[5],$inputSplit[6],TRUE);
							}else{
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_ADDALL,$inputSplit[1],$inputSplit[2],$inputSplit[3],FALSE,$inputSplit[5],$inputSplit[6],FALSE);			
							}
						}
					}elseif ($inputSplit[0]=="SCALE_ADDALLSTART0"){
						if ($inputSplit[4]=="TRUE"){
							if ($inputSplit[7]=="TRUE"){
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_ADDALLSTART0,$inputSplit[1],$inputSplit[2],$inputSplit[3],TRUE,$inputSplit[5],$inputSplit[6],TRUE);
							}else{
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_ADDALLSTART0,$inputSplit[1],$inputSplit[2],$inputSplit[3],TRUE,$inputSplit[5],$inputSplit[6],FALSE);			
							}
						}else{
							if ($inputSplit[7]=="TRUE"){
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_ADDALLSTART0,$inputSplit[1],$inputSplit[2],$inputSplit[3],FALSE,$inputSplit[5],$inputSplit[6],TRUE);
							}else{
								$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_ADDALLSTART0,$inputSplit[1],$inputSplit[2],$inputSplit[3],FALSE,$inputSplit[5],$inputSplit[6],FALSE);			
							}
						}
					}
				}else{
					$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,$inputSplit[1],$inputSplit[2],$inputSplit[3],TRUE,$inputSplit[5],$inputSplit[6]);
				}
				$attr[] = htmlspecialchars( "\$Test->drawScale(\$DataSet->GetData(),\$DataSet->GetDataDescription(),$inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6])");
			break;

			case drawrightscale:
				$inputSplit = explode(",",$parseString[1]);
				$Test->drawRightScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,$inputSplit[1],$inputSplit[2],$inputSplit[3],TRUE,$inputSplit[5],$inputSplit[6]);
				$attr[] = htmlspecialchars( "\$Test->drawRightScale(\$DataSet->GetData(),\$DataSet->GetDataDescription(),$inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5],$inputSplit[6])");
			break;

			case drawgrid:
				$inputSplit = explode(",",$parseString[1]);
				$Test->drawGrid($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5]);
				$attr[] = htmlspecialchars( "\$Test->drawGrid($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5])");
			break;

			case drawlinegraph:
				$inputSplit = explode(",",$parseString[1]);
				$Test->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());
				$attr[] = htmlspecialchars( "\$Test->drawLineGraph(\$DataSet->GetData(),\$DataSet->GetDataDescription())");
			break;
	
			case drawcubiccurve:
				$inputSplit = explode(",",$parseString[1]);
				$Test->drawCubicCurve($DataSet->GetData(),$DataSet->GetDataDescription());
				$attr[] = htmlspecialchars( "\$Test->drawCubicCurve(\$DataSet->GetData(),\$DataSet->GetDataDescription())");
			break;

			case drawfilledcubiccurve:
				$inputSplit = explode(",",$parseString[1]);
				$Test->drawFilledCubicCurve($DataSet->GetData(),$DataSet->GetDataDescription(),trim($inputSplit[0]),trim($inputSplit[1]));
				$attr[] = htmlspecialchars( "\$Test->drawFilledCubicCurve(\$DataSet->GetData(),\$DataSet->GetDataDescription(),$inputSplit[0],$inputSplit[1])");
			break;

			case setfixedscale:
				$inputSplit = explode(",",$parseString[1]);
				if (count($inputSplit)==2){
					$Test->setFixedScale($inputSplit[0],$inputSplit[1]);
					$attr[] = htmlspecialchars( "\$Test->setFixedScale($inputSplit[0],$inputSplit[1])");
				}elseif (count($inputSplit)==5){
					$Test->setFixedScale($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5]);
					$attr[] = htmlspecialchars( "\$Test->setFixedScale($inputSplit[0],$inputSplit[1],$inputSplit[2],$inputSplit[3],$inputSplit[4],$inputSplit[5])");
				}
			break;

			default:
				$attr[] = '<strong>ERR: ' . htmlspecialchars( $name ) . '</strong> = ' . htmlspecialchars( $parseString[0]." -> ".$parseString[1] );
		}			
	} // if
} // foreach

//$Test->setLabel($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie1",3,"Test");
//$Test->reportWarnings("GD");
$Test->Render($fname.".png");

//echo $fname;

		if (wfIsWindows()) {
			$ext = "gif";
		} else {
			$ext = "png";
		}

		$url = "{$wgUploadPath}/pchart/{$hash}.{$ext}";
		$txt = "<img src=\"" . htmlspecialchars( $url ) . "\">";
		if( $expired ) {
			// Replacing an older file, we may need to purge the old one.
			global $wgUseSquid;
			if( $wgUseSquid ) {
				$u = new SquidUpdate( array( $url ) );
				$u->doUpdate();
			}
		}
	}
	if ($debug==True){
	return $txt . implode( '<br />', $attr ) . "\n\n" . htmlspecialchars( $input );
	}else{
	return $txt;
	}
}

?>

External linksEdit