芝麻web文件管理V1.00
编辑当前文件:/home/strato/chroot/opt/RZphp80/includes/Var_Dump/Renderer/XML.php
| // +----------------------------------------------------------------------+ /** * Wrapper for the var_dump function. * * " The var_dump function displays structured information about expressions * that includes its type and value. Arrays are explored recursively * with values indented to show structure. " * * The Var_Dump class captures the output of the var_dump function, * by using output control functions, and then uses external renderer * classes for displaying the result in various graphical ways : * simple text, HTML/XHTML text, HTML/XHTML table, XML, ... * * @category PHP * @package Var_Dump * @author Frederic Poeydomenge
* @copyright 1997-2006 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version CVS: $Id: XML.php 233111 2007-04-02 09:38:10Z fredericpoeydome $ * @link http://pear.php.net/package/Var_Dump */ /** * Include the base class for all renderers */ require_once 'Var_Dump/Renderer/Common.php'; /** * A concrete renderer for Var_Dump * * Returns a representation of a variable in XML * DTD : PEARDIR/data/Var_Dump/renderer-xml.dtd * * @category PHP * @package Var_Dump * @author Frederic Poeydomenge
* @copyright 1997-2006 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version CVS: $Id: XML.php 233111 2007-04-02 09:38:10Z fredericpoeydome $ * @link http://pear.php.net/package/Var_Dump */ class Var_Dump_Renderer_XML extends Var_Dump_Renderer_Common { /** * Class constructor. * * @param array $options Parameters for the rendering. * @access public */ function Var_Dump_Renderer_XML($options = array()) { $this->setOptions($options); } /** * Returns the string representation of a variable * * @return string The string representation of the variable. * @access public */ function toString() { if (count($this->family) == 1) { return $this->_toString_Single(); } else { return $this->_toString_Array(); } } /** * Returns the string representation of a single variable * * @return string The string representation of a single variable. * @access private */ function _toString_Single() { return '
' . '
' . htmlspecialchars($this->type[0]) . '
' . '
' . htmlspecialchars($this->value[0]) . '
' . '
'; } /** * Returns the string representation of a multiple variable * * @return string The string representation of a multiple variable. * @access private */ function _toString_Array() { $txt = ''; $counter = count($this->family); $depth = 0; for ($c = 0 ; $c < $counter ; $c++) { switch ($this->family[$c]) { case VAR_DUMP_START_GROUP : if ($this->depth[$c] > 0) { $txt .= $this->_spacer($depth) . '
group
' . "\n" . $this->_spacer($depth++) . '
' . "\n"; } $txt .= $this->_spacer($depth) . '
' . "\n"; break; case VAR_DUMP_FINISH_GROUP : $txt .= $this->_spacer($depth) . '
' . "\n"; if ($this->depth[$c] > 0) { $txt .= $this->_spacer(--$depth) . '
' . "\n" . $this->_spacer(--$depth) . '' . "\n"; $depth--; } break; case VAR_DUMP_START_ELEMENT_NUM : case VAR_DUMP_START_ELEMENT_STR : $txt .= $this->_spacer(++$depth) . '
' . "\n" . $this->_spacer(++$depth) . '
' . htmlspecialchars($this->value[$c]) . '
' . "\n"; break; case VAR_DUMP_FINISH_ELEMENT : case VAR_DUMP_FINISH_STRING : $txt .= $this->_spacer($depth) . '
' . htmlspecialchars($this->type[$c]) . '
' . "\n". $this->_spacer($depth--) . '
' . htmlspecialchars($this->value[$c]) . '
' . "\n" . $this->_spacer($depth--) . '
' . "\n"; break; } } return $txt; } /** * Returns a spacer string to prefix the line * * @param integer $depth Depth level. * @return string Spacer string * @access private */ function _spacer($depth) { return str_repeat(' ', $depth << 1); } } ?>