CoreFiles by mySites.guru
HtmlRenderer.php69 lines, 1,499 bytes, from Joomla_4.0.0-alpha5-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha3
md5
695444097e68627e5c8ca1a6d2ccdd3b
sha1
85150b02327634806a2b89ebece6d8cf5640e34f
sha256
838537b18dc8109b9550794cfa2a5a71afc54108bbe3058a2ebd0653eb8528cf
<?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
 */

namespace Joomla\CMS\Error\Renderer;

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Error\AbstractRenderer;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;

/**
 * HTML error page renderer
 *
 * @since  4.0
 * @todo   Change this renderer to use JDocumentHtml instead of JDocumentError, the latter is only used for B/C at this time
 */
class HtmlRenderer extends AbstractRenderer
{
	/**
	 * The format (type) of the error page
	 *
	 * @var    string
	 * @since  4.0
	 */
	protected $type = 'error';

	/**
	 * Render the error page for the given object
	 *
	 * @param   \Throwable  $error  The error object to be rendered
	 *
	 * @return  string
	 *
	 * @since   4.0
	 */
	public function render(\Throwable $error): string
	{
		$app = Factory::getApplication();

		// Get the current template from the application
		$template = $app->getTemplate();

		// Push the error object into the document
		$this->getDocument()->setError($error);

		if (ob_get_contents())
		{
			ob_end_clean();
		}

		$this->getDocument()->setTitle(Text::_('Error') . ': ' . $error->getCode());

		return $this->getDocument()->render(
			false,
			[
				'template'  => $template,
				'directory' => JPATH_THEMES,
				'debug'     => JDEBUG,
				'csp_nonce' => $app->get('csp_nonce'),
			]
		);
	}
}

The same content is in 2 releases, Joomla 4.0.0-alpha5 to 4.0.0-alpha6. See them all, or every version of this file.