move secret key and environment checks in is_enabled method up
This commit is contained in:
parent
d8e4b71b3f
commit
f2895a906b
|
@ -392,6 +392,16 @@ class Kohana_DebugToolbar {
|
|||
public static function is_enabled()
|
||||
{
|
||||
$config = Kohana::config('debug_toolbar');
|
||||
|
||||
// Auto render if secret key isset
|
||||
if ($config->secret_key !== FALSE and isset($_GET[$config->secret_key]))
|
||||
return TRUE;
|
||||
|
||||
// Don't auto render when in PRODUCTION (this can obviously be
|
||||
// overridden by the above secret key)
|
||||
if (Kohana::$environment == Kohana::PRODUCTION)
|
||||
return FALSE;
|
||||
|
||||
// Don't auto render toolbar for ajax requests
|
||||
if (Request::initial()->is_ajax())
|
||||
return FALSE;
|
||||
|
@ -404,15 +414,6 @@ class Kohana_DebugToolbar {
|
|||
if ($config->auto_render !== TRUE)
|
||||
return FALSE;
|
||||
|
||||
// Auto render if secret key isset
|
||||
if ($config->secret_key !== FALSE and isset($_GET[$config->secret_key]))
|
||||
return TRUE;
|
||||
|
||||
// Don't auto render when in PRODUCTION (this can obviously be
|
||||
// overridden by the above secret key)
|
||||
if (Kohana::$environment == Kohana::PRODUCTION)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue