mirror of
https://github.com/filp/whoops.git
synced 2026-09-12 10:46:20 +00:00
Add PrettyPageHandler::showBranding(bool) to add ability to hide 'damnit' branding
This commit is contained in:
@@ -27,6 +27,14 @@ $app['debug'] = true;
|
||||
|
||||
if($app['debug']) {
|
||||
$app->register(new DamnitServiceProvider);
|
||||
|
||||
// Example: Extend the error page to disable the 'damnit' branding
|
||||
// in the top-right corner, so those big-wigs at the office wont'
|
||||
// throw a tantrum:
|
||||
$app['damnit.error_page_handler'] = $app->extend('damnit.error_page_handler', function($handler) {
|
||||
$handler->showBranding(true);
|
||||
return $handler;
|
||||
});
|
||||
}
|
||||
|
||||
$app->get('/', function() use($app) {
|
||||
|
||||
@@ -20,6 +20,11 @@ class PrettyPageHandler extends Handler
|
||||
*/
|
||||
private $extraTables = array();
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $showBranding = true;
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
@@ -44,12 +49,13 @@ class PrettyPageHandler extends Handler
|
||||
$frames = $inspector->getFrames();
|
||||
|
||||
$v = (object) array(
|
||||
'name' => explode('\\', $inspector->getExceptionName()),
|
||||
'message' => $inspector->getException()->getMessage(),
|
||||
'frames' => $frames,
|
||||
'hasFrames' => !!count($frames),
|
||||
'handler' => $this,
|
||||
'handlers' => $this->getRun()->getHandlers(),
|
||||
'name' => explode('\\', $inspector->getExceptionName()),
|
||||
'message' => $inspector->getException()->getMessage(),
|
||||
'frames' => $frames,
|
||||
'hasFrames' => !!count($frames),
|
||||
'handler' => $this,
|
||||
'handlers' => $this->getRun()->getHandlers(),
|
||||
'showBranding' => $this->showBranding,
|
||||
|
||||
'tables' => array(
|
||||
'GET Data' => $_GET,
|
||||
@@ -83,6 +89,15 @@ class PrettyPageHandler extends Handler
|
||||
return Handler::QUIT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the `damnit` branding be visible in the top-right corner?
|
||||
* @param bool $showBranding
|
||||
*/
|
||||
public function showBranding($showBranding = true)
|
||||
{
|
||||
$this->showBranding = (bool) $showBranding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an entry to the list of tables displayed in the template.
|
||||
* The expected data is a simple associative array. Any nested arrays
|
||||
|
||||
@@ -296,9 +296,11 @@
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="branding">
|
||||
generated by the <strong><a href="http://github.com/filp/damnit">damnit!</a></strong> php error handler
|
||||
</div>
|
||||
<?php if($v->showBranding): ?>
|
||||
<div class="branding">
|
||||
generated by the <strong><a href="http://github.com/filp/damnit">damnit!</a></strong> php error handler
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<header>
|
||||
<div class="exception">
|
||||
<h3 class="exc-title">
|
||||
|
||||
Reference in New Issue
Block a user