本文整理汇总了PHP中XMLParser::CreateInputArray方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLParser::CreateInputArray方法的具体用法?PHP XMLParser::CreateInputArray怎么用?PHP XMLParser::CreateInputArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLParser
的用法示例。
在下文中一共展示了XMLParser::CreateInputArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RenderWikiPlot
/**
*RenderWikiPlot CallBack function
*
*This is the function that handles MediaWiki callbacks, and renders the actual plot.
*
*@access private
*@param string $input The content of the wikiplot tag
*@param array $argv Hash-array of the parameters of the wikiplot tag, with parameter-name as key and parameter-value as value.
*@param Parser $parser The parser of MediaWiki, if null parser is obtained from global variable
*@uses WikiPlotDeserializeBoolean()
*@uses WikiPlotDeserializeString()
*@uses WikiPlotDeserializeMixed()
*@uses WikiPlotDeserializeInteger()
*@uses WikiPlotDeserializeColor()
*@uses XMLParser
*@uses Plot
*@uses Graph
*@uses Cache
*@return string HTML that can be directly inserted into any website.
*/
function RenderWikiPlot($input, $argv, $parser = null)
{
//Get parser if not given as parameter
if (!$parser) {
$parser =& $GLOBALS['wgParser'];
}
/*Currently the parser*/
//Creating instance of plot
$Plot = new Plot();
//Getting and deserializing parameters
WikiPlotDeserializeBoolean($argv["grid"], $Plot->EnableGrid);
WikiPlotDeserializeBoolean($argv["axis"], $Plot->EnableAxis);
WikiPlotDeserializeString($argv["caption"], $Plot->Caption);
WikiPlotDeserializeMixed($argv["xspan"], $Plot->MinX, $Plot->MaxX);
WikiPlotDeserializeMixed($argv["yspan"], $Plot->MinY, $Plot->MaxY);
WikiPlotDeserializeMixed($argv["gridspace"], $Plot->XGridSpace, $Plot->YGridSpace);
WikiPlotDeserializeInteger($argv["height"], $Plot->Height);
WikiPlotDeserializeInteger($argv["width"], $Plot->Width);
WikiPlotDeserializeInteger($argv["captionfont"], $Plot->CaptionFont);
WikiPlotDeserializeInteger($argv["gridfont"], $Plot->GridFont);
WikiPlotDeserializeColor($argv["gridcolor"], $Plot->GridColor);
//Parsing Xml
$XmlParser = new XMLParser($input);
$Graphs = $XmlParser->CreateInputArray();
foreach ($Graphs as $Graph) {
$G = new Graph();
if (!is_array($Graph[1])) {
$G->Exp = $Graph[1];
WikiPlotDeserializeString($Graph[0]["label"], $G->Label);
WikiPlotDeserializeColor($Graph[0]["color"], $G->Color);
} else {
$G->Exp = $Graph[0];
}
array_push($Plot->Graphs, $G);
}
//Render the plot
//Get instance of cache
$cache = new cache();
//Url of the current plot
$PlotURL = "";
$PlotFileName = $Plot->GetHash() . ".png";
if (!$cache->FileExist($PlotFileName)) {
$Plot->SaveAs($cache->CachePath($PlotFileName));
} else {
$PlotURL = $cache->FileURL($PlotFileName);
}
$output = "<a href='{$PlotURL}' class='image' title='See the plot'><img src='{$PlotURL}'></a>";
return $output;
}