- md5
- 89cc806aeb864f972524c98a237476ba
- sha1
- 15e905115032d94f583cdb8010986e1b5b756575
- sha256
- e71e451e5007a120e4b13b7dffc86adab0411a1d6d1ef0ce946b62eeab48ac50
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Document;
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Factory as CmsFactory;
/**
* XmlDocument class, provides an easy interface to parse and display XML output
*
* @since 1.7.0
*/
class XmlDocument extends Document
{
/**
* Document name
*
* @var string
* @since 3.0.0
*/
protected $name = 'joomla';
/**
* Class constructor
*
* @param array $options Associative array of options
*
* @since 1.7.0
*/
public function __construct($options = array())
{
parent::__construct($options);
// Set mime type
$this->_mime = 'application/xml';
// Set document type
$this->_type = 'xml';
}
/**
* Render the document.
*
* @param boolean $cache If true, cache the output
* @param array $params Associative array of attributes
*
* @return string The rendered data
*
* @since 1.7.0
*/
public function render($cache = false, $params = array())
{
parent::render();
CmsFactory::getApplication()->setHeader('Content-disposition', 'inline; filename="' . $this->getName() . '.xml"', true);
return $this->getBuffer();
}
/**
* Returns the document name
*
* @return string
*
* @since 1.7.0
*/
public function getName()
{
return $this->name;
}
/**
* Sets the document name
*
* @param string $name Document name
*
* @return XmlDocument instance of $this to allow chaining
*
* @since 1.7.0
*/
public function setName($name = 'joomla')
{
$this->name = $name;
return $this;
}
}
No other release has this exact content. See every version of this file.