enable() and disable() methods added (implements #21)

This commit is contained in:
biakaveron 2013-01-25 00:42:03 +04:00
parent a34fef373f
commit ad6d6cb444
1 changed files with 30 additions and 0 deletions

View File

@ -31,6 +31,13 @@ abstract class Kohana_Debugtoolbar {
*/
protected static $_custom_tabs = array();
/**
* Can we render toolbar?
*
* @var bool
*/
protected static $_enabled = TRUE;
/**
* Benchmark name
*
@ -406,6 +413,24 @@ abstract class Kohana_Debugtoolbar {
$firephp->fb(array($message, $table), FirePHP::TABLE);
}
/**
* Disable toolbar
* @static
*/
public static function disable()
{
self::$_enabled = FALSE;
}
/**
* Enable toolbar
* @static
*/
public static function enable()
{
self::$_enabled = TRUE;
}
/**
* Determines if all the conditions are correct to display the toolbar
* (pretty kludgy, I know)
@ -415,6 +440,11 @@ abstract class Kohana_Debugtoolbar {
*/
public static function is_enabled()
{
// disabled with Debugtoolbar::disable() call
if (self::$_enabled === FALSE) {
return FALSE;
}
$config = Kohana::$config->load('debug_toolbar');
// Auto render if secret key isset