mirror of
https://github.com/Oreolek/debug-toolbar.git
synced 2024-04-27 14:49:18 +03:00
Custom sections added
This commit is contained in:
parent
e341a46ea3
commit
ded7c5affa
|
@ -31,6 +31,8 @@ abstract class Kohana_DebugToolbar {
|
|||
*/
|
||||
protected static $_custom_tabs = array();
|
||||
|
||||
protected static $_custom_sections = array();
|
||||
|
||||
/**
|
||||
* Can we render toolbar?
|
||||
*
|
||||
|
@ -104,6 +106,7 @@ abstract class Kohana_DebugToolbar {
|
|||
if ($config->panels['customs'] === TRUE)
|
||||
{
|
||||
$template->set('customs', self::get_customs());
|
||||
$template->set('sections', self::get_custom_sections());
|
||||
}
|
||||
|
||||
// FirePHP
|
||||
|
@ -163,6 +166,18 @@ abstract class Kohana_DebugToolbar {
|
|||
self::$_custom_tabs[$tab_name] = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register additional sections. Supports callbacks for title or content params
|
||||
*
|
||||
* @param mixed $title section title (string or callback)
|
||||
* @param mixed $data section content (string or callback)
|
||||
* @param string $logo @TODO not used
|
||||
*/
|
||||
public static function add_section($title, $data, $logo = NULL)
|
||||
{
|
||||
self::$_custom_sections[] = array($title, $data, $logo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user vars
|
||||
*
|
||||
|
@ -185,6 +200,27 @@ abstract class Kohana_DebugToolbar {
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom sections
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_custom_sections()
|
||||
{
|
||||
$result = array();
|
||||
foreach(self::$_custom_sections as $section)
|
||||
{
|
||||
list($title, $data, $logo) = $section;
|
||||
$result[] = array(
|
||||
'title' => is_callable($title) ? call_user_func($title) : (string)$title,
|
||||
'content' => is_callable($data) ? call_user_func($data) : $data,
|
||||
'logo' => $logo
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves query benchmarks from Database
|
||||
*
|
||||
|
|
|
@ -94,6 +94,12 @@
|
|||
|
||||
<!-- Custom data -->
|
||||
<?php if (Kohana::$config->load('debug_toolbar.panels.customs')): ?>
|
||||
<?php foreach($sections as $num => $section) : ?>
|
||||
<li onclick="debugToolbar.show('debug-custom-section-<?php echo $num ?>'); return false;">
|
||||
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAIMSURBVDjLpVNLaxNRFP6STmaKdFqrgYKWlGLSgoiKCwsKVnFRtBsVUSTNyj/gxv4Bl678AyKCoCulgmtd+W7romgzKT4QMW1G+5hMpnPnnuuZm6ZNawoVBw7n3pn5vvP4zkkopfA/j9F8cafO3FekCjGpIgKIvayftTXOkr71jkz2/UXA4HxXfz72gIx/lBsWSfiVtwiWHK8B3kRQeX/6lmnnkuDAwn0MJSKQEFChQCp9CcHixxgsGWw3B01uRKfx9t1HIP1POpoSdUulLyD0vqO26IAkDW7tgSZYeHPqcmpXxkTChKzOaAKSEdo6jnEWVY5ehFxdHs2cn55rScDR73H6DKyyRWs1R0haGdR+z8YZ3MyMTj9rpUKi/PLkUJuZfmX3nkNYmQBxzYprpyCA2XMRrvNAcdfDhgKkm6ttKTdW6jH4w4RpD/ALAaNzhH2kSwALoSJCd9+VhIqEVVeD4C1MclaOT0Ke0Cowq+X9eLHapLH23f1XreDzI27LfqT2HIfvzsRAyLB2N1coXV8vodUkfn16+HnnvrPDhrmXsxBY+fmOwcVlJh/IFebK207iuqSShg0rjer8B9TcWY7q38nmnRstm7g1gy9PDk2129mjinjy3OIvJjvI4PJ2u7CJgMEdUMmVuA9ShLez14rj/7RMDHzNAzTP/gCDvR2to968NSs9HBxqvu/E/gBCSoxk53STJQAAAABJRU5ErkJggg==" alt="customs">
|
||||
<?php echo $section['title'] ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
<li id="toggle-customs" onclick="debugToolbar.show('debug-customs'); return false;">
|
||||
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAIMSURBVDjLpVNLaxNRFP6STmaKdFqrgYKWlGLSgoiKCwsKVnFRtBsVUSTNyj/gxv4Bl678AyKCoCulgmtd+W7romgzKT4QMW1G+5hMpnPnnuuZm6ZNawoVBw7n3pn5vvP4zkkopfA/j9F8cafO3FekCjGpIgKIvayftTXOkr71jkz2/UXA4HxXfz72gIx/lBsWSfiVtwiWHK8B3kRQeX/6lmnnkuDAwn0MJSKQEFChQCp9CcHixxgsGWw3B01uRKfx9t1HIP1POpoSdUulLyD0vqO26IAkDW7tgSZYeHPqcmpXxkTChKzOaAKSEdo6jnEWVY5ehFxdHs2cn55rScDR73H6DKyyRWs1R0haGdR+z8YZ3MyMTj9rpUKi/PLkUJuZfmX3nkNYmQBxzYprpyCA2XMRrvNAcdfDhgKkm6ttKTdW6jH4w4RpD/ALAaNzhH2kSwALoSJCd9+VhIqEVVeD4C1MclaOT0Ke0Cowq+X9eLHapLH23f1XreDzI27LfqT2HIfvzsRAyLB2N1coXV8vodUkfn16+HnnvrPDhrmXsxBY+fmOwcVlJh/IFebK207iuqSShg0rjer8B9TcWY7q38nmnRstm7g1gy9PDk2129mjinjy3OIvJjvI4PJ2u7CJgMEdUMmVuA9ShLez14rj/7RMDHzNAzTP/gCDvR2to968NSs9HBxqvu/E/gBCSoxk53STJQAAAABJRU5ErkJggg==" alt="customs">
|
||||
customs
|
||||
|
@ -368,6 +374,17 @@
|
|||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<!-- Custom sections -->
|
||||
<?php if (Kohana::$config->load('debug_toolbar.panels.customs') && count($sections) > 0): ?>
|
||||
<?php foreach($sections as $num => $section) : ?>
|
||||
<div id="debug-custom-section-<?php echo $num ?>" class="top" style="display: none;">
|
||||
<div>
|
||||
<?php echo $section['content'] ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
<?php endif ?>
|
||||
|
||||
<!-- Custom data-->
|
||||
<?php if (Kohana::$config->load('debug_toolbar.panels.customs') && count($customs) > 0):
|
||||
$r_counter = 0; ?>
|
||||
|
|
Loading…
Reference in a new issue