File manager - Edit - /home/jardides/www/Jardi-design/images/administrator/Error.tar
Back
Renderer/JsonRenderer.php 0000644 00000003471 15247132704 0011435 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\Renderer; use Joomla\Application\WebApplicationInterface; use Joomla\CMS\Error\AbstractRenderer; use Joomla\CMS\Factory; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * JSON error page renderer * * @since 4.0.0 */ class JsonRenderer extends AbstractRenderer { /** * The format (type) of the error page * * @var string * @since 4.0.0 */ protected $type = 'json'; /** * Render the error page for the given object * * @param \Throwable $error The error object to be rendered * * @return string * * @since 4.0.0 */ public function render(\Throwable $error): string { // Create our data object to be rendered $data = [ 'error' => true, 'code' => $error->getCode(), 'message' => $error->getMessage(), ]; // Include the stack trace if in debug mode if (JDEBUG) { $data['trace'] = $error->getTraceAsString(); } $app = Factory::getApplication(); if ($app instanceof WebApplicationInterface) { $errorCode = 500; if ($error->getCode() > 0) { $errorCode = $error->getCode(); } $app->setHeader('status', $errorCode); } // Push the data object into the document $this->getDocument()->setBuffer(json_encode($data)); if (ob_get_contents()) { ob_end_clean(); } return $this->getDocument()->render(); } } Renderer/HtmlRenderer.php 0000644 00000004335 15247132704 0011430 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\Renderer; use Joomla\CMS\Error\AbstractRenderer; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * HTML error page renderer * * @since 4.0.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.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.0 */ public function render(\Throwable $error): string { $app = Factory::getApplication(); // Get the current template from the application $template = $app->getTemplate(true); // Push the error object into the document $this->getDocument()->setError($error); // Add registry file for the template asset $wa = $this->getDocument()->getWebAssetManager()->getRegistry(); $wa->addTemplateRegistryFile($template->template, $app->getClientId()); if (!empty($template->parent)) { $wa->addTemplateRegistryFile($template->parent, $app->getClientId()); } if (ob_get_contents()) { ob_end_clean(); } $this->getDocument()->setTitle(Text::_('Error') . ': ' . $error->getCode()); return $this->getDocument()->render( false, [ 'template' => $template->template, 'directory' => JPATH_THEMES, 'debug' => JDEBUG, 'csp_nonce' => $app->get('csp_nonce'), 'templateInherits' => $template->parent, 'params' => $template->params, ] ); } } Renderer/CliRenderer.php 0000644 00000003111 15247132704 0011222 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\Renderer; use Joomla\CMS\Error\AbstractRenderer; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Cli error renderer * * @since 4.0.0 */ class CliRenderer extends AbstractRenderer { /** * The format (type) * * @var string * @since 4.0.0 */ protected $type = 'cli'; /** * Render the error for the given object. * * @param \Throwable $error The error object to be rendered * * @return string * * @since 4.0.0 */ public function render(\Throwable $error): string { $buffer = PHP_EOL . 'Error occurred: ' . $error->getMessage() . PHP_EOL . $this->getTrace($error); if ($prev = $error->getPrevious()) { $buffer .= PHP_EOL . PHP_EOL . 'Previous Exception: ' . $prev->getMessage() . PHP_EOL . $this->getTrace($prev); } return $buffer; } /** * Returns a trace for the given error. * * @param \Throwable $error The error * * @return string * * @since 4.0.0 */ private function getTrace(\Throwable $error): string { // Include the stack trace only if in debug mode if (!JDEBUG) { return ''; } return PHP_EOL . $error->getTraceAsString() . PHP_EOL; } } Renderer/JsonapiRenderer.php 0000644 00000006143 15247132704 0012126 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\Renderer; use Joomla\Application\WebApplicationInterface; use Joomla\CMS\Error\JsonApi\AuthenticationFailedExceptionHandler; use Joomla\CMS\Error\JsonApi\CheckinCheckoutExceptionHandler; use Joomla\CMS\Error\JsonApi\InvalidParameterExceptionHandler; use Joomla\CMS\Error\JsonApi\InvalidRouteExceptionHandler; use Joomla\CMS\Error\JsonApi\NotAcceptableExceptionHandler; use Joomla\CMS\Error\JsonApi\NotAllowedExceptionHandler; use Joomla\CMS\Error\JsonApi\ResourceNotFoundExceptionHandler; use Joomla\CMS\Error\JsonApi\SaveExceptionHandler; use Joomla\CMS\Error\JsonApi\SendEmailExceptionHandler; use Joomla\CMS\Factory; use Tobscure\JsonApi\ErrorHandler; use Tobscure\JsonApi\Exception\Handler\FallbackExceptionHandler; use Tobscure\JsonApi\Exception\Handler\ResponseBag; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * JSON error page renderer * * @since 4.0.0 */ class JsonapiRenderer extends JsonRenderer { /** * The format (type) of the error page * * @var string * @since 4.0.0 */ protected $type = 'jsonapi'; /** * Render the error page for the given object * * @param \Throwable $error The error object to be rendered * * @return string * * @since 4.0.0 */ public function render(\Throwable $error): string { if ($error instanceof \Exception) { $errors = new ErrorHandler(); $errors->registerHandler(new InvalidRouteExceptionHandler()); $errors->registerHandler(new AuthenticationFailedExceptionHandler()); $errors->registerHandler(new NotAcceptableExceptionHandler()); $errors->registerHandler(new NotAllowedExceptionHandler()); $errors->registerHandler(new InvalidParameterExceptionHandler()); $errors->registerHandler(new ResourceNotFoundExceptionHandler()); $errors->registerHandler(new SaveExceptionHandler()); $errors->registerHandler(new CheckinCheckoutExceptionHandler()); $errors->registerHandler(new SendEmailExceptionHandler()); $errors->registerHandler(new FallbackExceptionHandler(JDEBUG)); $response = $errors->handle($error); } else { $code = 500; $errorInfo = ['code' => $code, 'title' => 'Internal server error']; if (JDEBUG) { $errorInfo['detail'] = (string) $error; } $response = new ResponseBag($code, $errorInfo); } $this->getDocument()->setErrors($response->getErrors()); $app = Factory::getApplication(); if ($app instanceof WebApplicationInterface) { $app->setHeader('status', $response->getStatus()); } if (ob_get_contents()) { ob_end_clean(); } return $this->getDocument()->render(); } } Renderer/FeedRenderer.php 0000644 00000000722 15247132704 0011363 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\Renderer; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * RSS/Atom feed error page renderer * * @since 4.0.0 */ class FeedRenderer extends XmlRenderer { } Renderer/XmlRenderer.php 0000644 00000003272 15247132704 0011263 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\Renderer; use Joomla\CMS\Error\AbstractRenderer; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * XML error page renderer * * @since 4.0.0 */ class XmlRenderer extends AbstractRenderer { /** * The format (type) of the error page * * @var string * @since 4.0.0 */ protected $type = 'xml'; /** * Render the error page for the given object * * @param \Throwable $error The error object to be rendered * * @return string * * @since 4.0.0 */ public function render(\Throwable $error): string { // Create our data object to be rendered $xw = new \XMLWriter(); $xw->openMemory(); $xw->setIndent(true); $xw->setIndentString("\t"); $xw->startDocument('1.0', 'UTF-8'); $xw->startElement('error'); $xw->writeElement('code', $error->getCode()); $xw->writeElement('message', $error->getMessage()); // Include the stack trace if in debug mode if (JDEBUG) { $xw->writeElement('trace', $error->getTraceAsString()); } // End error element $xw->endElement(); // Push the data object into the document $this->getDocument()->setBuffer($xw->outputMemory(true)); if (ob_get_contents()) { ob_end_clean(); } return $this->getDocument()->render(); } } JsonApi/NotAllowedExceptionHandler.php 0000644 00000003035 15247132704 0014053 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\JsonApi; use Exception; use Joomla\CMS\Access\Exception\NotAllowed; use Tobscure\JsonApi\Exception\Handler\ExceptionHandlerInterface; use Tobscure\JsonApi\Exception\Handler\ResponseBag; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Handler for permission errors that should give a 403 * * @since 4.0.0 */ class NotAllowedExceptionHandler implements ExceptionHandlerInterface { /** * If the exception handler is able to format a response for the provided exception, * then the implementation should return true. * * @param \Exception $e The exception to be handled * * @return boolean * * @since 4.0.0 */ public function manages(Exception $e) { return $e instanceof NotAllowed; } /** * Handle the provided exception. * * @param Exception $e The exception being handled * * @return \Tobscure\JsonApi\Exception\Handler\ResponseBag * * @since 4.0.0 */ public function handle(Exception $e) { $status = 403; $error = ['title' => 'Access Denied']; $code = $e->getCode(); if ($code) { $error['code'] = $code; } return new ResponseBag($status, [$error]); } } JsonApi/ResourceNotFoundExceptionHandler.php 0000644 00000003074 15247132704 0015252 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\JsonApi; use Exception; use Joomla\CMS\MVC\Controller\Exception\ResourceNotFound; use Tobscure\JsonApi\Exception\Handler\ExceptionHandlerInterface; use Tobscure\JsonApi\Exception\Handler\ResponseBag; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Handler for invalid resource requests that should give a 404 * * @since 4.0.0 */ class ResourceNotFoundExceptionHandler implements ExceptionHandlerInterface { /** * If the exception handler is able to format a response for the provided exception, * then the implementation should return true. * * @param \Exception $e The exception to be handled * * @return boolean * * @since 4.0.0 */ public function manages(Exception $e) { return $e instanceof ResourceNotFound; } /** * Handle the provided exception. * * @param Exception $e The exception being handled * * @return \Tobscure\JsonApi\Exception\Handler\ResponseBag * * @since 4.0.0 */ public function handle(Exception $e) { $status = 404; $error = ['title' => 'Resource not found']; $code = $e->getCode(); if ($code) { $error['code'] = $code; } return new ResponseBag($status, [$error]); } } JsonApi/CheckinCheckoutExceptionHandler.php 0000644 00000003022 15247132704 0015031 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\JsonApi; use Exception; use Joomla\CMS\MVC\Controller\Exception\CheckinCheckout; use Tobscure\JsonApi\Exception\Handler\ExceptionHandlerInterface; use Tobscure\JsonApi\Exception\Handler\ResponseBag; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Handler for invalid checkin/checkout exceptions * * @since 4.0.0 */ class CheckinCheckoutExceptionHandler implements ExceptionHandlerInterface { /** * If the exception handler is able to format a response for the provided exception, * then the implementation should return true. * * @param \Exception $e The exception to be handled * * @return boolean * * @since 4.0.0 */ public function manages(Exception $e) { return $e instanceof CheckinCheckout; } /** * Handle the provided exception. * * @param Exception $e The exception being handled * * @return \Tobscure\JsonApi\Exception\Handler\ResponseBag * * @since 4.0.0 */ public function handle(Exception $e) { $status = 400; if ($e->getCode()) { $status = $e->getCode(); } $error = ['title' => $e->getMessage()]; return new ResponseBag($status, [$error]); } } JsonApi/SendEmailExceptionHandler.php 0000644 00000002762 15247132704 0013652 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\JsonApi; use Exception; use Joomla\CMS\MVC\Controller\Exception\SendEmail; use Tobscure\JsonApi\Exception\Handler\ExceptionHandlerInterface; use Tobscure\JsonApi\Exception\Handler\ResponseBag; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Handler for error when send email * * @since 4.0.0 */ class SendEmailExceptionHandler implements ExceptionHandlerInterface { /** * If the exception handler is able to format a response for the provided exception, * then the implementation should return true. * * @param \Exception $e The exception to be handled * * @return boolean * * @since 4.0.0 */ public function manages(Exception $e) { return $e instanceof SendEmail; } /** * Handle the provided exception. * * @param Exception $e The exception being handled * * @return \Tobscure\JsonApi\Exception\Handler\ResponseBag * * @since 4.0.0 */ public function handle(Exception $e) { $status = 400; if ($e->getCode()) { $status = $e->getCode(); } $error = ['title' => $e->getMessage()]; return new ResponseBag($status, [$error]); } } JsonApi/SaveExceptionHandler.php 0000644 00000003050 15247132704 0012676 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\JsonApi; use Exception; use Joomla\CMS\MVC\Controller\Exception\Save; use Tobscure\JsonApi\Exception\Handler\ExceptionHandlerInterface; use Tobscure\JsonApi\Exception\Handler\ResponseBag; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Handler for invalid checkin/checkout exceptions * * @since 4.0.0 */ class SaveExceptionHandler implements ExceptionHandlerInterface { /** * If the exception handler is able to format a response for the provided exception, * then the implementation should return true. * * @param \Exception $e The exception to be handled * * @return boolean * * @since 4.0.0 */ public function manages(Exception $e) { return $e instanceof Save; } /** * Handle the provided exception. * * @param Exception $e The exception being handled * * @return \Tobscure\JsonApi\Exception\Handler\ResponseBag * * @since 4.0.0 */ public function handle(Exception $e) { $status = 400; if ($e->getCode()) { $status = $e->getCode(); } $error = [ 'title' => $e->getMessage(), 'code' => $status, ]; return new ResponseBag($status, [$error]); } } JsonApi/AuthenticationFailedExceptionHandler.php 0000644 00000003067 15247132704 0016074 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\JsonApi; use Exception; use Joomla\CMS\Access\Exception\AuthenticationFailed; use Tobscure\JsonApi\Exception\Handler\ExceptionHandlerInterface; use Tobscure\JsonApi\Exception\Handler\ResponseBag; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Handler for permission errors that should give a 401 * * @since 4.0.0 */ class AuthenticationFailedExceptionHandler implements ExceptionHandlerInterface { /** * If the exception handler is able to format a response for the provided exception, * then the implementation should return true. * * @param \Exception $e The exception to be handled * * @return boolean * * @since 4.0.0 */ public function manages(Exception $e) { return $e instanceof AuthenticationFailed; } /** * Handle the provided exception. * * @param Exception $e The exception being handled * * @return \Tobscure\JsonApi\Exception\Handler\ResponseBag * * @since 4.0.0 */ public function handle(Exception $e) { $status = 401; $error = ['title' => 'Forbidden']; $code = $e->getCode(); if ($code) { $error['code'] = $code; } return new ResponseBag($status, [$error]); } } JsonApi/InvalidParameterExceptionHandler.php 0000644 00000002112 15247132704 0015225 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\JsonApi; use Exception; use Tobscure\JsonApi\Exception\Handler\ResponseBag; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Handler for invalid param * * @since 4.0.0 */ class InvalidParameterExceptionHandler extends \Tobscure\JsonApi\Exception\Handler\InvalidParameterExceptionHandler { /** * Handle the provided exception. * * @param Exception $e The exception being handled * * @return \Tobscure\JsonApi\Exception\Handler\ResponseBag * * @since 4.0.0 */ public function handle(Exception $e) { $status = 400; $error = ['title' => $e->getMessage()]; $code = $e->getCode(); if ($code) { $error['code'] = $code; } return new ResponseBag($status, [$error]); } } JsonApi/NotAcceptableExceptionHandler.php 0000644 00000003051 15247132704 0014505 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\JsonApi; use Exception; use Joomla\CMS\Application\Exception\NotAcceptable; use Tobscure\JsonApi\Exception\Handler\ExceptionHandlerInterface; use Tobscure\JsonApi\Exception\Handler\ResponseBag; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Handler for routing errors that should give a 406 * * @since 4.0.0 */ class NotAcceptableExceptionHandler implements ExceptionHandlerInterface { /** * If the exception handler is able to format a response for the provided exception, * then the implementation should return true. * * @param \Exception $e The exception to be handled * * @return boolean * * @since 4.0.0 */ public function manages(Exception $e) { return $e instanceof NotAcceptable; } /** * Handle the provided exception. * * @param Exception $e The exception being handled * * @return \Tobscure\JsonApi\Exception\Handler\ResponseBag * * @since 4.0.0 */ public function handle(Exception $e) { $status = 406; $error = ['title' => 'Not Acceptable']; $code = $e->getCode(); if ($code) { $error['code'] = $code; } return new ResponseBag($status, [$error]); } } JsonApi/InvalidRouteExceptionHandler.php 0000644 00000003071 15247132704 0014410 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error\JsonApi; use Exception; use Joomla\CMS\Router\Exception\RouteNotFoundException; use Tobscure\JsonApi\Exception\Handler\ExceptionHandlerInterface; use Tobscure\JsonApi\Exception\Handler\ResponseBag; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Handler for routing errors that should give a 404 * * @since 4.0.0 */ class InvalidRouteExceptionHandler implements ExceptionHandlerInterface { /** * If the exception handler is able to format a response for the provided exception, * then the implementation should return true. * * @param \Exception $e The exception to be handled * * @return boolean * * @since 4.0.0 */ public function manages(Exception $e) { return $e instanceof RouteNotFoundException; } /** * Handle the provided exception. * * @param Exception $e The exception being handled * * @return \Tobscure\JsonApi\Exception\Handler\ResponseBag * * @since 4.0.0 */ public function handle(Exception $e) { $status = 404; $error = ['title' => 'Resource not found']; $code = $e->getCode(); if ($code) { $error['code'] = $code; } return new ResponseBag($status, [$error]); } } AbstractRenderer.php 0000644 00000005634 15247132704 0010524 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error; use Joomla\CMS\Document\Document; use Joomla\CMS\Document\FactoryInterface; use Joomla\CMS\Factory; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Base class for error page renderers * * @since 4.0.0 */ abstract class AbstractRenderer implements RendererInterface { /** * The Document instance * * @var Document * @since 4.0.0 */ protected $document; /** * The format (type) of the error page * * @var string * @since 4.0.0 */ protected $type; /** * Retrieve the Document instance attached to this renderer * * @return Document * * @since 4.0.0 */ public function getDocument(): Document { // Load the document if not already if (!$this->document) { $this->document = $this->loadDocument(); } return $this->document; } /** * Get a renderer instance for the given type * * @param string $type The type of renderer to fetch * * @return static * * @since 4.0.0 * @throws \InvalidArgumentException */ public static function getRenderer(string $type) { // Build the class name $class = __NAMESPACE__ . '\\Renderer\\' . ucfirst(strtolower($type)) . 'Renderer'; // First check if an object may exist in the container and prefer that over everything else if (Factory::getContainer()->has($class)) { return Factory::getContainer()->get($class); } // Next check if a local class exists and use that if (class_exists($class)) { return new $class(); } // 404 Resource Not Found throw new \InvalidArgumentException(sprintf('There is not an error renderer for the "%s" format.', $type)); } /** * Create the Document object for this renderer * * @return Document * * @since 4.0.0 */ protected function loadDocument(): Document { $attributes = [ 'charset' => 'utf-8', 'lineend' => 'unix', 'tab' => "\t", 'language' => 'en-GB', 'direction' => 'ltr', ]; // If there is a Language instance in Factory then let's pull the language and direction from its metadata if (Factory::$language) { $attributes['language'] = Factory::getLanguage()->getTag(); $attributes['direction'] = Factory::getLanguage()->isRtl() ? 'rtl' : 'ltr'; } return Factory::getContainer()->get(FactoryInterface::class)->createDocument($this->type, $attributes); } } RendererInterface.php 0000644 00000001676 15247132704 0010663 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ namespace Joomla\CMS\Error; use Joomla\CMS\Document\Document; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Interface defining the rendering engine for the error handling layer * * @since 4.0.0 */ interface RendererInterface { /** * Retrieve the Document instance attached to this renderer * * @return Document * * @since 4.0.0 */ public function getDocument(): Document; /** * Render the error page for the given object * * @param \Throwable $error The error object to be rendered * * @return string * * @since 4.0.0 */ public function render(\Throwable $error): string; }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings