- md5
- ec4f8b58c7cc499b055a60bcb77d8fa9
- sha1
- 9fa41b97525f7f77c8a9f03d4c07c49750a09a86
- sha256
- ae10397cd8bd619ae0f696cbffd9ee52f947508560c95b04595ed3a5180539b9
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
<?php
/**
* @package Joomla.Libraries
* @subpackage Error
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
/**
* Displays the custom error page when an uncaught exception occurs.
*
* @package Joomla.Libraries
* @subpackage Error
* @since 3.0
*/
class JErrorPage
{
/**
* Render the error page based on an exception.
*
* @param Exception $error The exception for which to render the error page.
*
* @return void
*
* @since 3.0
*/
public static function render(Exception $error)
{
try
{
$app = JFactory::getApplication();
$document = JDocument::getInstance('error');
if (!$document)
{
// We're probably in an CLI environment
exit($error->getMessage());
$app->close(0);
}
$config = JFactory::getConfig();
// Get the current template from the application
$template = $app->getTemplate();
// Push the error object into the document
$document->setError($error);
if (ob_get_contents())
{
ob_end_clean();
}
$document->setTitle(JText::_('Error') . ': ' . $error->getCode());
$data = $document->render(
false,
array('template' => $template,
'directory' => JPATH_THEMES,
'debug' => $config->get('debug'))
);
// Failsafe to get the error displayed.
if (empty($data))
{
exit($error->getMessage());
}
else
{
// Do not allow cache
$app->allowCache(false);
$app->setBody($data);
echo $app->toString();
}
}
catch (Exception $e)
{
exit('Error displaying the error page: ' . $e->getMessage() . ': ' . $error->getMessage());
}
}
}
The same content is in 6 releases, Joomla 3.2.3 to 3.3.0. See them all, or every version of this file.