mirror of
https://github.com/Oreolek/debug-toolbar.git
synced 2024-04-25 21:59:17 +03:00
allow Toolbar to show configs
This commit is contained in:
parent
39bcea2299
commit
b261675d35
|
@ -79,6 +79,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)
|
||||
{
|
||||
|
@ -459,6 +465,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
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -217,6 +217,9 @@
|
|||
<li onclick="debugToolbar.showvar(this, 'vars-server'); return false;">SERVER</li>
|
||||
<li onclick="debugToolbar.showvar(this, 'vars-cookie'); return false;">COOKIE</li>
|
||||
<li onclick="debugToolbar.showvar(this, 'vars-session'); return false;">SESSION</li>
|
||||
<?php if (Kohana::$config->load('debug_toolbar.panels.configs')): ?>
|
||||
<li onclick="debugToolbar.showvar(this, 'vars-config'); return false;">CONFIG</li>
|
||||
<?php endif ?>
|
||||
</ul>
|
||||
<div style="display: none;" id="vars-post">
|
||||
<?php echo isset($_POST) ? Debug::vars($_POST) : Debug::vars(array()) ?>
|
||||
|
@ -236,6 +239,20 @@
|
|||
<div style="display: none;" id="vars-session">
|
||||
<?php echo isset($_SESSION) ? Debug::vars($_SESSION) : Debug::vars(array()) ?>
|
||||
</div>
|
||||
<?php if (Kohana::$config->load('debug_toolbar.panels.configs')): ?>
|
||||
<div style="display: none;" id="vars-config">
|
||||
<ul class="configmenu">
|
||||
<?php foreach($configs as $name => $config) { ?>
|
||||
<li onclick="debugToolbar.toggle('vars-config-<?php echo $name ?>'); return false;" class="<?php echo Text::alternate('odd','even') ?>">
|
||||
<div><?php echo $name ?></div>
|
||||
<div style="display: none" id="vars-config-<?php echo $name ?>">
|
||||
<pre><?php echo Debug::dump($config) ?></pre>
|
||||
</div>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
|
|
Loading…
Reference in a new issue