diff --git a/classes/kohana/debugtoolbar.php b/classes/kohana/debugtoolbar.php index 8d05a2d..a2fc29d 100644 --- a/classes/kohana/debugtoolbar.php +++ b/classes/kohana/debugtoolbar.php @@ -76,6 +76,12 @@ abstract class Kohana_DebugToolbar { ->set('total_memory', $queries['memory']); } + // Configs panel + if ($config->panels['configs'] === TRUE) + { + $template->set('configs', self::get_configs()); + } + // Files panel if ($config->panels['files'] === TRUE) { @@ -400,6 +406,47 @@ abstract class Kohana_DebugToolbar { $firephp->fb(array($message, $table), FirePHP::TABLE); } + /** + * Collect (custom) configs + * + * @static + * @return array + */ + public static function get_configs() + { + $inc_paths = Kohana::include_paths(); + // delete SYSPATH + array_pop($inc_paths); + + $configs = array(); + + foreach ($inc_paths as $inc_path) + { + foreach ((array)glob($inc_path.'/config/*.php') as $filename) + { + $filename = pathinfo($filename, PATHINFO_FILENAME); + + if (in_array($filename, (array)Kohana::$config->load('debug_toolbar.skip_configs'))) { + continue; + } + + if ( ! isset($configs[$filename])) { + try { + $configs[$filename] = Kohana::$config->load($filename)->as_array(); + } + catch (Exception $e) + { + $configs[$filename] = NULL; + } + } + } + } + + ksort($configs); + + return $configs; + } + /** * Disable toolbar * @static diff --git a/config/debug_toolbar.php b/config/debug_toolbar.php index 94581e2..b8a1b83 100644 --- a/config/debug_toolbar.php +++ b/config/debug_toolbar.php @@ -24,6 +24,7 @@ $config['panels'] = array( 'benchmarks' => TRUE, 'database' => TRUE, 'vars' => TRUE, + 'configs' => TRUE, // also depends on 'vars' values 'ajax' => TRUE, 'files' => TRUE, 'modules' => TRUE, @@ -42,6 +43,11 @@ $config['align'] = 'right'; */ $config['secret_key'] = FALSE; +/** + * Exclude configs + */ +$config['skip_configs'] = array('database', 'encrypt'); + /** * Disabled routes */ diff --git a/views/toolbar.php b/views/toolbar.php index 55a7ffe..12fe768 100644 --- a/views/toolbar.php +++ b/views/toolbar.php @@ -211,6 +211,9 @@
  • SERVER
  • COOKIE
  • SESSION
  • + load('debug_toolbar.panels.configs')): ?> +
  • CONFIG
  • +