first commit

This commit is contained in:
2026-04-30 14:38:11 +02:00
commit e22bbde336
1994 changed files with 613950 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?php defined('SYSPATH') or die('No direct script access.');
/*
* If true, the debug toolbar will be automagically displayed
* NOTE: if IN_PRODUCTION is set to TRUE, the toolbar will
* not automatically render, even if auto_render is TRUE
*/
$config['auto_render'] = TRUE;
/*
* If true, the toolbar will default to the minimized position
*/
$config['minimized'] = FALSE;
/*
* Location of icon images
* relative to your site_domain
*/
$config['icon_path'] = 'images/debug_toolbar';
/*
* List config files you would like to exclude
* from showing in the toolbar (without extension).
* Alternatively, set to true to stop all
* config files from showing.
*/
$config['skip_configs'] = array('database', 'encryption');
/*
* Log toolbar data to FirePHP
*/
$config['firephp_enabled'] = TRUE;
/*
* Enable or disable specific panels
*/
$config['panels'] = array(
'benchmarks' => TRUE,
'database' => TRUE,
'vars_and_config' => TRUE,
'logs' => TRUE,
'ajax' => TRUE,
'files' => TRUE
);
/*
* Toolbar alignment
* options: right, left, center
*/
$config['align'] = 'right';
/*
* Secret Key
*/
$config['secret_key'] = FALSE;

View File

@@ -0,0 +1,7 @@
<?php defined('SYSPATH') or die('No direct script access.');
if (Debug_Toolbar::is_enabled())
{
// Allows the debug toolbar to inject itsself into the html
Event::add('system.display', array('Debug_Toolbar', 'render'));
}

View File

@@ -0,0 +1,6 @@
<?php defined('SYSPATH') or die('No direct script access.');
/*
* Capture logs
*/
Event::add('system.log', array('Debug_Toolbar', 'log'));
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 793 B

View File

@@ -0,0 +1,366 @@
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Copyright (c) 2009 Aaron Forsander <aaron.forsander@gmail.com>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*/
/**
* Icons taken from the wonderful work of Mark James.
*
* More information available at:
* http://www.famfamfam.com/lab/icons/silk/
*/
/**
* Displays a debug toolbar at the top of the rendered web page.
*
* For more information see: http://projects.kohanaphp.com/projects/show/kohana-debug-toolbar
*
* @copyright Copyright (C) 2009 Aaron Forsander
* @author Aaron Forsander <aaron.forsander@gmail.com>
* @package Debug_Toolbar_Core
*/
class Debug_Toolbar_Core {
// Stores system.log events
public static $logs = array();
// Name for debug toolbar's benchmark
public static $benchmark_name = 'debug_toolbar';
/**
* Renders the Debug Toolbar
*
* @param bool print rendered output
* @return string debug toolbar rendered output
*/
public static function render($print = false)
{
Benchmark::start(self::$benchmark_name);
$template = new View('toolbar');
// Database panel
if (Kohana::config('debug_toolbar.panels.database') === TRUE)
{
$template->set('queries', self::get_queries());
}
// Logs panel
if (Kohana::config('debug_toolbar.panels.logs') === TRUE)
{
$template->set('logs', self::get_logs());
}
// Vars and Config panel
if (Kohana::config('debug_toolbar.panels.vars_and_config') === TRUE)
{
$template->set('configs', self::get_configs());
}
// Files panel
if (Kohana::config('debug_toolbar.panels.files') === TRUE)
{
$template->set('files', self::get_files());
}
// FirePHP
if (Kohana::config('debug_toolbar.firephp_enabled') === TRUE)
{
self::firephp();
}
// Set alignment for toolbar
switch (Kohana::config('debug_toolbar.align'))
{
case 'right':
case 'center':
case 'left':
$template->set('align', Kohana::config('debug_toolbar.align'));
break;
default:
$template->set('align', 'left');
}
// Javascript for toolbar
$template->set('scripts', file_get_contents(Kohana::find_file('views', 'toolbar', TRUE, 'js')));
// CSS for toolbar
$styles = file_get_contents(Kohana::find_file('views', 'toolbar', FALSE, 'css'));
Benchmark::stop(self::$benchmark_name);
// Benchmarks panel
if (Kohana::config('debug_toolbar.panels.benchmarks') === TRUE)
{
$template->set('benchmarks', self::get_benchmarks());
}
if (Event::$data and self::is_enabled())
{
// Try to add css just before the </head> tag
if (stripos(Event::$data, '</head>') !== FALSE)
{
Event::$data = str_ireplace('</head>', $styles.'</head>', Event::$data);
}
else
{
// No </head> tag found, append styles to output
$template->set('styles', $styles);
}
// Try to add js and HTML just before the </body> tag
if (stripos(Event::$data, '</body>') !== FALSE)
{
Event::$data = str_ireplace('</body>', $template->render().'</body>', Event::$data);
}
else
{
// Closing <body> tag not found, just append toolbar to output
Event::$data .= $template->render();
}
}
else
{
$template->set('styles', $styles);
return $template->render($print);
}
}
/**
* Hooks the system.log event to catch all log messages
*/
public static function log()
{
self::$logs[] = Event::$data;
}
/**
* Retrieves all Kohana logs captured by system.log
*/
public static function get_logs()
{
return self::$logs;
}
/**
* Retrieves query benchmarks from Database
*/
public static function get_queries()
{
return Database::$benchmarks;
}
/**
* Creates a formatted array of all Benchmarks
*
* @return array formatted benchmarks
*/
public static function get_benchmarks()
{
$benchmarks = array();
foreach ((array)Benchmark::get(TRUE) as $name => $benchmark)
{
$benchmarks[$name] = array(
'name' => ucwords(str_replace(array('_', '-'), ' ', str_replace(SYSTEM_BENCHMARK.'_', '', $name))),
'time' => $benchmark['time'],
'memory' => $benchmark['memory']
);
}
$benchmarks = array_slice($benchmarks, 1) + array_slice($benchmarks, 0, 1);
return $benchmarks;
}
/**
* Get config data
*
* @return array all configs included by Kohana
*/
private static function get_configs()
{
if (Kohana::config('debug_toolbar.skip_configs') === TRUE)
return array();
$inc_paths = Kohana::include_paths();
$configs = array();
foreach ((array)$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('debug_toolbar.skip_configs')))
continue;
if (!isset($configs[$filename]))
{
$configs[$filename] = Kohana::Config($filename);
}
}
}
return $configs;
}
/**
* Get list of included files
*
* @return array file currently included by php
*/
public static function get_files()
{
$files = (array)get_included_files();
sort($files);
return $files;
}
/**
* Add toolbar data to FirePHP console
*/
private static function firephp()
{
$firephp = FirePHP::getInstance(TRUE);
$firephp->fb('KOHANA DEBUG TOOLBAR:');
// Globals
$globals = array(
'Post' => empty($_POST) ? array() : $_POST,
'Get' => empty($_GET) ? array() : $_GET,
'Cookie' => empty($_COOKIE) ? array() : $_COOKIE,
'Session' => empty($_SESSION) ? array() : $_SESSION
);
foreach ($globals as $name => $global)
{
$table = array();
$table[] = array($name,'Value');
foreach((array)$global as $key => $value)
{
if (is_object($value))
{
$value = get_class($value).' [object]';
}
$table[] = array($key, $value);
}
$message = "$name: ".count($global).' variables';
$firephp->fb(array($message, $table), FirePHP::TABLE);
}
// Database
$queries = self::get_queries();
$total_time = $total_rows = 0;
$table = array();
$table[] = array('SQL Statement','Time','Rows');
foreach ((array)$queries as $query)
{
$table[] = array(
str_replace("\n",' ',$query['query']),
number_format($query['time'], 3),
$query['rows']
);
$total_time += $query['time'];
$total_rows += $query['rows'];
}
$message = 'Queries: '.count($queries).' SQL queries took '.
number_format($total_time, 3).' seconds and returned '.$total_rows.' rows';
$firephp->fb(array($message, $table), FirePHP::TABLE);
// Benchmarks
$benchmarks = self::get_benchmarks();
$table = array();
$table[] = array('Benchmark', 'Time', 'Memory');
foreach ((array)$benchmarks as $name => $benchmark)
{
$table[] = array(
ucwords(str_replace(array('_', '-'), ' ', str_replace(SYSTEM_BENCHMARK.'_', '', $name))),
number_format($benchmark['time'], 3). ' s',
text::bytes($benchmark['memory'])
);
}
$message = 'Benchmarks: '.count($benchmarks).' benchmarks took '.
number_format($benchmark['time'], 3).' seconds and used up '.
text::bytes($benchmark['memory']).' memory';
$firephp->fb(array($message, $table), FirePHP::TABLE);
}
/**
* Determines if all the conditions are correct to display the toolbar
* (pretty kludgy, I know)
*
* @returns bool toolbar enabled
*/
public static function is_enabled()
{
// Don't auto render toolbar for ajax requests
if (request::is_ajax())
return FALSE;
// Don't auto render toolbar if $_GET['debug'] = 'false'
if (isset($_GET['debug']) and strtolower($_GET['debug']) == 'false')
return FALSE;
// Don't auto render if auto_render config is FALSE
if (Kohana::config('debug_toolbar.auto_render') !== TRUE)
return FALSE;
// Auto render if secret key isset
$secret_key = Kohana::config('debug_toolbar.secret_key');
if ($secret_key !== FALSE and isset($_GET[$secret_key]))
return TRUE;
// Don't auto render when IN_PRODUCTION (this can obviously be
// overridden by the above secret key)
if (IN_PRODUCTION)
return FALSE;
return TRUE;
}
/**
* Return a filename without extension
*
* @param string name of a file
* @return string name of file with extension removed
*/
private static function _strip_ext($file)
{
return (($pos = strrpos($file, '.')) !== FALSE) ? substr($file, 0, $pos) : $file;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,192 @@
<style type="text/css">
/* Reset */
div#kohana-debug-toolbar,
div#kohana-debug-toolbar div,
div#kohana-debug-toolbar span,
div#kohana-debug-toolbar pre,
div#kohana-debug-toolbar h1,
div#kohana-debug-toolbar img,
div#kohana-debug-toolbar a,
div#kohana-debug-toolbar ul,
div#kohana-debug-toolbar li,
div#kohana-debug-toolbar table,
div#kohana-debug-toolbar tr,
div#kohana-debug-toolbar td,
div#kohana-debug-toolbar th {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: middle;
background: transparent;
line-height: 1;
text-transform: none;
font-size:100%;
}
div#kohana-debug-toolbar table {
border-collapse: collapse;
border-spacing: 0;
}
div#kohana-debug-toolbar :focus { outline: 0; }
div#kohana-debug-toolbar ul {
list-style:none;
}
/* Global */
div#kohana-debug-toolbar {
font-family: Arial, sans-serif;
font-size: 12px;
color: #333;
text-align: left;
line-height: 12px;
}
div#kohana-debug-toolbar h1 {
font-size: 16px;
font-weight: bold;
margin-top: 30px;
margin-bottom: 10px;
padding:0px 5px;
border: 0px;
background-color: #eee;
color: #000;
display:block;
}
div#kohana-debug-toolbar a,
div#kohana-debug-toolbar a:hover {
text-decoration: none;
color: #222;
}
div#kohana-debug-toolbar pre { line-height: 1.3 }
div#kohana-debug-toolbar .top {
position: absolute;
left: 0px;
top: 0px;
width: 100%;
z-index: 9999;
border-bottom: 1px solid #aaa;
background-color: #efefef;
padding: 10px;
}
/* Tables */
div#kohana-debug-toolbar table {
padding: 3px;
font-size: 11px;
border: 1px solid #999;
width: 99%;
margin:0px 5px;
font-family: monospace;
}
div#kohana-debug-toolbar td {
padding: 3px 3px;
vertical-align: top;
background-color: #eee;
}
div#kohana-debug-toolbar tr.odd td {
background-color: #ddd;
}
div#kohana-debug-toolbar th {
padding: 3px 5px;
vertical-align: top;
background-color: #999;
color: #eee;
white-space: nowrap;
}
div#kohana-debug-toolbar td,
div#kohana-debug-toolbar th {
border: 1px solid #efefef;
}
/* Toolbar */
div#kohana-debug-toolbar div#debug-toolbar {
position: fixed;
padding: 0 0 3px 0;
top: 0px;
opacity: 0.80;
filter: alpha(opacity:80);
z-index: 10000;
white-space: nowrap;
line-height: 16px;
background-color: #ccc;
}
div#kohana-debug-toolbar div#debug-toolbar.debug-toolbar-align-center { left: auto; right: auto; }
div#kohana-debug-toolbar div#debug-toolbar.debug-toolbar-align-right { right: 0; }
div#kohana-debug-toolbar div#debug-toolbar.debug-toolbar-align-left { left: 0; }
div#kohana-debug-toolbar div#debug-toolbar img { vertical-align: middle; }
div#kohana-debug-toolbar div#debug-toolbar ul.menu {
padding: 5px;
display: inline;
}
div#kohana-debug-toolbar div#debug-toolbar ul.menu li {
display: inline;
list-style: none;
padding: 0 5px;
border-right: 1px solid #aaa;
cursor: pointer;
line-height: 16px;
}
div#kohana-debug-toolbar div#debug-toolbar ul.menu li.last {
border: none;
}
/* Benchmarks */
div#kohana-debug-toolbar div#debug-benchmarks { padding: 3px 0px; }
/* SQL queries */
div#kohana-debug-toolbar div#debug-database { padding: 3px 0px; }
/* Vars & Config */
div#kohana-debug-toolbar div#debug-vars {
padding: 3px 0px;
}
div#kohana-debug-toolbar div#debug-vars pre {
background-color: #ddd;
padding: 5px;
color: #333;
}
div#kohana-debug-toolbar div#debug-vars .varmenu {
margin: 20px 0 0 0;
height: 23px;
}
div#kohana-debug-toolbar div#debug-vars .varmenu li {
float: left;
display: block;
padding: 5px;
margin: 0 6px 0 0;
border-top: 1px solid #999;
border-left: 1px solid #999;
border-right: 1px solid #999;
cursor: pointer;
}
div#kohana-debug-toolbar div#debug-vars .varmenu li.active {
background-color: #ddd;
color: #000;
}
div#kohana-debug-toolbar div#debug-vars .configmenu { background-color: #ddd; }
div#kohana-debug-toolbar div#debug-vars .configmenu li {
display: block;
padding: 5px;
cursor: pointer;
}
div#kohana-debug-toolbar div#debug-vars .configmenu li.odd { background-color: #eee; }
div#kohana-debug-toolbar div#debug-vars .configmenu li.even { background-color: #fff; }
div#kohana-debug-toolbar div#debug-vars .configmenu li.odd pre { background-color: #eee; }
div#kohana-debug-toolbar div#debug-vars .configmenu li.even pre { background-color: #fff; }
div#kohana-debug-toolbar div#debug-vars .configmenu li:hover.odd { background-color: #ddd; }
div#kohana-debug-toolbar div#debug-vars .configmenu li:hover.even { background-color: #ddd; }
div#kohana-debug-toolbar div#debug-vars .configmenu li:hover.odd pre { background-color: #ddd; }
div#kohana-debug-toolbar div#debug-vars .configmenu li:hover.even pre { background-color: #ddd; }
/* Logs & Msgs */
div#kohana-debug-toolbar div#debug-log {
padding: 3px 0px;
font-size: 11px;
}
/* Ajax */
div#kohana-debug-toolbar div#debug-ajax {
padding: 3px 0px;
font-size: 11px;
}
</style>

View File

@@ -0,0 +1,122 @@
var debugToolbar = {
// current toolbar section thats open
current: null,
// current vars and config section open
currentvar: null,
// current config section open
currentli: null,
// toggle a toolbar section
show : function(obj) {
if (obj == debugToolbar.current) {
debugToolbar.off(obj);
debugToolbar.current = null;
} else {
debugToolbar.off(debugToolbar.current);
debugToolbar.on(obj);
debugToolbar.current = obj;
}
},
// toggle a vars and configs section
showvar : function(li, obj) {
if (obj == debugToolbar.currentvar) {
debugToolbar.off(obj);
debugToolbar.currentli.className = '';
debugToolbar.currentli = null;
debugToolbar.currentvar = null;
} else {
debugToolbar.off(debugToolbar.currentvar);
if (debugToolbar.currentli)
debugToolbar.currentli.className = '';
debugToolbar.on(obj);
debugToolbar.currentvar = obj;
debugToolbar.currentli = li;
debugToolbar.currentli.className = 'active';
}
},
// turn an element on
on : function(obj) {
if (document.getElementById(obj) != null)
document.getElementById(obj).style.display = '';
},
// turn an element off
off : function(obj) {
if (document.getElementById(obj) != null)
document.getElementById(obj).style.display = 'none';
},
// toggle an element
toggle : function(obj) {
if (typeof obj == 'string')
obj = document.getElementById(obj);
if (obj)
obj.style.display = obj.style.display == 'none' ? '' : 'none';
},
// close the toolbar
close : function() {
document.getElementById('kohana-debug-toolbar').style.display = 'none';
},
swap: function() {
var toolbar = document.getElementById('debug-toolbar');
if (toolbar.className == 'debug-toolbar-align-center') {
toolbar.className = 'debug-toolbar-align-left';
} else if (toolbar.className == 'debug-toolbar-align-left') {
toolbar.className = 'debug-toolbar-align-right';
} else {
toolbar.className = 'debug-toolbar-align-center';
}
},
collapse: function() {
debugToolbar.toggle('debug-toolbar-menu');
}
};
/*
* Test for javascript libraries
* (only supports jQuery at the moment
*/
if (typeof jQuery != 'undefined') {
$(document).ready(function(){
// display ajax button in toolbar
$('#toggle-ajax').css({display: 'inline'});
// bind ajax event
$('#debug-ajax').bind("ajaxComplete", function(event, xmlrequest, ajaxOptions){
// add a new row to ajax table
$('#debug-ajax table').append(
'<tr class="even">' +
'<td>' + $('#debug-ajax table tr').size() +'<\/td>' +
'<td>jQuery ' + jQuery.fn.jquery + '<\/td>' +
'<td>' + xmlrequest.statusText + ' (' + xmlrequest.status + ')<\/td>' +
'<td>' + ajaxOptions.url + '<\/td>' +
'<\/tr>'
);
// stripe table
$('#debug-ajax table tbody tr:nth-child(even)').attr('class', 'odd');
// update count in toolbar
$('#toggle-ajax span').text($('#debug-ajax table tr').size()-1);
});
});
}
if (typeof Prototype != 'undefined') {
}

View File

@@ -0,0 +1,281 @@
<?php defined('SYSPATH') or die('No direct script access.') ?>
<!-- CSS styles (if not added to <head>) -->
<?php if (isset($styles)): ?>
<?php echo $styles ?>
<?php endif ?>
<!-- Javascript -->
<script type="text/javascript">
<?php echo $scripts ?>
</script>
<div id="kohana-debug-toolbar">
<!-- Toolbar -->
<div id="debug-toolbar" class="debug-toolbar-align-<?php echo $align ?>">
<!-- Kohana link -->
<?php echo html::image(
Kohana::config('debug_toolbar.icon_path').'/kohana.png',
array('onclick' => 'debugToolbar.collapse()')
) ?>
<!-- Kohana icon -->
<?php if (Kohana::config('debug_toolbar.minimized') === TRUE): ?>
<ul id="debug-toolbar-menu" class="menu" style="display: none">
<?php else: ?>
<ul id="debug-toolbar-menu" class="menu">
<?php endif ?>
<!-- Kohana version -->
<li>
<?php echo html::anchor("http://kohanaphp.com/home", KOHANA_VERSION, array('target' => '_blank')) ?>
</li>
<!-- Benchmarks -->
<?php if (Kohana::config('debug_toolbar.panels.benchmarks')): ?>
<!-- Time -->
<li id="time" onclick="debugToolbar.show('debug-benchmarks'); return false;">
<?php echo html::image(Kohana::config('debug_toolbar.icon_path').'/time.png', array('alt' => 'time')) ?>
<?php echo round(($benchmarks['system_benchmark_total_execution']['time'])*1000, 2) ?> ms
</li>
<!-- Memory -->
<li id="memory" onclick="debugToolbar.show('debug-benchmarks'); return false;">
<?php echo html::image(Kohana::config('debug_toolbar.icon_path').'/memory.png', array('alt' => 'memory')) ?>
<?php echo text::bytes($benchmarks['system_benchmark_total_execution']['memory']) ?>
</li>
<?php endif ?>
<!-- Queries -->
<?php if (Kohana::config('debug_toolbar.panels.database')): ?>
<li id="toggle-database" onclick="debugToolbar.show('debug-database'); return false;">
<?php echo html::image(Kohana::config('debug_toolbar.icon_path').'/database.png', array('alt' => 'queries')) ?>
<?php echo isset($queries) ? count($queries) : 0 ?>
</li>
<?php endif ?>
<!-- Vars and Config -->
<?php if (Kohana::config('debug_toolbar.panels.vars_and_config')): ?>
<li id="toggle-vars" onclick="debugToolbar.show('debug-vars'); return false;">
<?php echo html::image(Kohana::config('debug_toolbar.icon_path').'/config.png', array('alt' => 'vars &amp; config')) ?>
vars &amp; config
</li>
<?php endif ?>
<!-- Logs -->
<?php if (Kohana::config('debug_toolbar.panels.logs')): ?>
<li id="toggle-log" onclick="debugToolbar.show('debug-log'); return false;">
<?php echo html::image(Kohana::config('debug_toolbar.icon_path').'/logs.png', array('alt' => 'logs')) ?>
logs
</li>
<?php endif ?>
<!-- Ajax -->
<?php if (Kohana::config('debug_toolbar.panels.ajax')): ?>
<li id="toggle-ajax" onclick="debugToolbar.show('debug-ajax'); return false;" style="display: none">
<?php echo html::image(Kohana::config('debug_toolbar.icon_path').'/ajax.png', array('alt' => 'ajax')) ?>
ajax (<span>0</span>)
</li>
<?php endif ?>
<!-- Files -->
<?php if (Kohana::config('debug_toolbar.panels.files')): ?>
<li id="toggle-files" onclick="debugToolbar.show('debug-files'); return false;">
<?php echo html::image(Kohana::config('debug_toolbar.icon_path').'/page_copy.png', array('alt' => 'files')) ?>
files
</li>
<?php endif ?>
<!-- Swap sides -->
<li onclick="debugToolbar.swap(); return false;">
<?php echo html::image(Kohana::config('debug_toolbar.icon_path').'/text_align_left.png', array('alt' => 'align')) ?>
</li>
<!-- Close -->
<li class="last" onclick="debugToolbar.close(); return false;">
<?php echo html::image(Kohana::config('debug_toolbar.icon_path').'/close.png', array('alt' => 'close')) ?>
</li>
</ul>
</div>
<!-- Benchmarks -->
<?php if (Kohana::config('debug_toolbar.panels.benchmarks')): ?>
<div id="debug-benchmarks" class="top" style="display: none;">
<h1>Benchmarks</h1>
<table cellspacing="0" cellpadding="0">
<tr>
<th align="left">benchmark</th>
<th align="right">time</th>
<th align="right">memory</th>
</tr>
<?php if (count($benchmarks)): ?>
<?php foreach ((array)$benchmarks as $benchmark): ?>
<tr class="<?php echo text::alternate('odd','even')?>">
<td align="left"><?php echo $benchmark['name'] ?></td>
<td align="right"><?php echo sprintf('%.2f', $benchmark['time'] * 1000) ?> ms</td>
<td align="right"><?php echo text::bytes($benchmark['memory']) ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr class="<?php echo text::alternate('odd','even') ?>">
<td colspan="3">no benchmarks to display</td>
</tr>
<?php endif ?>
</table>
</div>
<?php endif ?>
<!-- Database -->
<?php if (Kohana::config('debug_toolbar.panels.database')): ?>
<div id="debug-database" class="top" style="display: none;">
<h1>SQL Queries</h1>
<table cellspacing="0" cellpadding="0">
<tr align="left">
<th>#</th>
<th>query</th>
<th>time</th>
<th>rows</th>
</tr>
<?php $total_time = $total_rows = 0; ?>
<?php foreach ((array)$queries as $id => $query): ?>
<tr class="<?php echo text::alternate('odd','even')?>">
<td><?php echo $id + 1 ?></td>
<td><?php echo $query['query']?></td>
<td><?php echo sprintf('%.3f', $query['time'] * 1000)?> ms</td>
<td><?php echo $query['rows']?></td>
</tr>
<?php
$total_time += $query['time'];
$total_rows += $query['rows'];
?>
<?php endforeach; ?>
<tr align="left">
<th>&nbsp;</th>
<th><?php echo count($queries) ?> total</th>
<th><?php echo sprintf('%.3f', $total_time * 1000) ?> ms</th>
<th><?php echo $total_rows ?></th>
</tr>
</table>
</div>
<?php endif ?>
<!-- Vars and Config -->
<?php if (Kohana::config('debug_toolbar.panels.vars_and_config')): ?>
<div id="debug-vars" class="top" style="display: none;">
<h1>Vars &amp; Config</h1>
<ul class="varmenu">
<li onclick="debugToolbar.showvar(this, 'vars-post'); return false;">POST</li>
<li onclick="debugToolbar.showvar(this, 'vars-get'); return false;">GET</li>
<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>
<li onclick="debugToolbar.showvar(this, 'vars-config'); return false;">CONFIG</li>
</ul>
<div style="display: none;" id="vars-post">
<?php echo isset($_POST) ? Kohana::debug($_POST) : Kohana::debug(array()) ?>
</div>
<div style="display: none;" id="vars-get">
<?php echo isset($_GET) ? Kohana::debug($_GET) : Kohana::debug(array()) ?>
</div>
<div style="display: none;" id="vars-server">
<?php echo isset($_SERVER) ? Kohana::debug($_SERVER) : Kohana::debug(array()) ?>
</div>
<div style="display: none;" id="vars-cookie">
<?php echo isset($_COOKIE) ? Kohana::debug($_COOKIE) : Kohana::debug(array()) ?>
</div>
<div style="display: none;" id="vars-session">
<?php echo isset($_SESSION) ? Kohana::debug($_SESSION) : Kohana::debug(array()) ?>
</div>
<div style="display: none;" id="vars-config">
<ul class="configmenu">
<?php foreach ($configs as $section => $vars): ?>
<li class="<?php echo text::alternate('odd', 'even') ?>" onclick="debugToolbar.toggle('vars-config-<?php echo $section ?>'); return false;">
<div><?php echo $section ?></div>
<div style="display: none;" id="vars-config-<?php echo $section ?>">
<?php echo Kohana::debug($vars) ?>
</div>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<?php endif ?>
<!-- Logs and Messages -->
<?php if (Kohana::config('debug_toolbar.panels.logs')): ?>
<div id="debug-log" class="top" style="display: none;">
<h1>Logs</h1>
<table cellspacing="0" cellpadding="0">
<tr align="left">
<th width="1%">#</th>
<th width="200">time</th>
<th width="100">level</th>
<th>message</th>
</tr>
<?php foreach ((array)$logs as $id => $log): ?>
<tr class="<?php echo text::alternate('odd','even')?>">
<td><?php echo $id + 1 ?></td>
<td><?php echo $log[0] ?></td>
<td><?php echo $log[1] ?></td>
<td><?php echo $log[2] ?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
<?php endif ?>
<!-- Ajax Requests -->
<?php if (Kohana::config('debug_toolbar.panels.ajax')): ?>
<div id="debug-ajax" class="top" style="display:none;">
<h1>Ajax</h1>
<table cellspacing="0" cellpadding="0">
<tr align="left">
<th width="1%">#</th>
<th width="150">source</th>
<th width="150">status</th>
<th>request</th>
</tr>
</table>
</div>
<?php endif ?>
<!-- Included Files -->
<?php if (Kohana::config('debug_toolbar.panels.files')): ?>
<div id="debug-files" class="top" style="display: none;">
<h1>Files</h1>
<table cellspacing="0" cellpadding="0">
<tr align="left">
<th>#</th>
<th>file</th>
<th>size</th>
<th>lines</th>
</tr>
<?php $total_size = $total_lines = 0 ?>
<?php foreach ((array)$files as $id => $file): ?>
<?php
$size = filesize($file);
$lines = count(file($file));
?>
<tr class="<?php echo text::alternate('odd','even')?>">
<td><?php echo $id + 1 ?></td>
<td><?php echo $file ?></td>
<td><?php echo $size ?></td>
<td><?php echo $lines ?></td>
</tr>
<?php
$total_size += $size;
$total_lines += $lines;
?>
<?php endforeach; ?>
<tr align="left">
<th colspan="2">total</th>
<th><?php echo text::bytes($total_size) ?></th>
<th><?php echo number_format($total_lines) ?></th>
</tr>
</table>
</div>
<?php endif ?>
</div>