- md5
- 0e3e7cbc73fd47457cbb38b165339d95
- sha1
- 895e00d2437bc0a35c6001a59dfb45256e3a5fbd
- sha256
- 1ee77764b170b7cbeb9f4d465333ff89ba9e71c930623f30448c4745130abcaf
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
<?php
/**
* @package Joomla.Legacy
* @subpackage Utilities
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
JLog::add('JXMLElement is deprecated. Use SimpleXMLElement.', JLog::WARNING, 'deprecated');
/**
* Wrapper class for php SimpleXMLElement.
*
* @package Joomla.Legacy
* @subpackage Utilities
* @since 11.1
* @deprecated 13.3 (Platform) & 4.0 (CMS) - Use SimpleXMLElement instead.
*/
class JXMLElement extends SimpleXMLElement
{
/**
* Get the name of the element.
*
* @return string
*
* @since 11.1
* @deprecated 13.3 Use SimpleXMLElement::getName() instead.
*/
public function name()
{
JLog::add('JXMLElement::name() is deprecated, use SimpleXMLElement::getName() instead.', JLog::WARNING, 'deprecated');
return (string) $this->getName();
}
/**
* Return a well-formed XML string based on SimpleXML element
*
* @param boolean $compressed Should we use indentation and newlines ?
* @param string $indent Indention character.
* @param integer $level The level within the document which informs the indentation.
*
* @return string
*
* @since 11.1
* @deprecated 13.3 Use SimpleXMLElement::asXML() instead.
*/
public function asFormattedXML($compressed = false, $indent = "\t", $level = 0)
{
JLog::add('JXMLElement::asFormattedXML() is deprecated, use SimpleXMLElement::asXML() instead.', JLog::WARNING, 'deprecated');
$out = '';
// Start a new line, indent by the number indicated in $level
$out .= ($compressed) ? '' : "\n" . str_repeat($indent, $level);
// Add a <, and add the name of the tag
$out .= '<' . $this->getName();
// For each attribute, add attr="value"
foreach ($this->attributes() as $attr)
{
$out .= ' ' . $attr->getName() . '="' . htmlspecialchars((string) $attr, ENT_COMPAT, 'UTF-8') . '"';
}
// If there are no children and it contains no data, end it off with a />
if (!count($this->children()) && !(string) $this)
{
$out .= " />";
}
else
{
// If there are children
if (count($this->children()))
{
// Close off the start tag
$out .= '>';
$level++;
// For each child, call the asFormattedXML function (this will ensure that all children are added recursively)
foreach ($this->children() as $child)
{
$out .= $child->asFormattedXML($compressed, $indent, $level);
}
$level--;
// Add the newline and indentation to go along with the close tag
$out .= ($compressed) ? '' : "\n" . str_repeat($indent, $level);
}
elseif ((string) $this)
{
// If there is data, close off the start tag and add the data
$out .= '>' . htmlspecialchars((string) $this, ENT_COMPAT, 'UTF-8');
}
// Add the end tag
$out .= '</' . $this->getName() . '>';
}
return $out;
}
}
The same content is in 13 releases, Joomla 3.2.2 to 3.3.6. See them all, or every version of this file.