'html', 'forceEnable' => false);
/**
* Recursively goes through an array and makes neat HTML out of it.
*
* @param mixed $values Array to make pretty.
* @param int $openDepth Depth to add open class
* @param int $currentDepth current depth.
* @return string
**/
function makeNeatArray($values, $openDepth = 0, $currentDepth = 0) {
$className ="neat-array depth-$currentDepth";
if ($openDepth > $currentDepth) {
$className .= ' expanded';
}
$nextDepth = $currentDepth + 1;
$out = "
";
if (!is_array($values)) {
if (is_bool($values)) {
$values = array($values);
}
if (is_null($values)) {
$values = array(null);
}
}
if (empty($values)) {
$values[] = '(empty)';
}
foreach ($values as $key => $value) {
$out .= '- ' . $key . '';
if ($value === null) {
$value = '(null)';
}
if ($value === false) {
$value = '(false)';
}
if ($value === true) {
$value = '(true)';
}
if (empty($value) && $value != 0) {
$value = '(empty)';
}
if (is_object($value)) {
$value = Set::reverse($value, true);
}
if (is_array($value) && !empty($value)) {
$out .= $this->makeNeatArray($value, $openDepth, $nextDepth);
} else {
$out .= h($value);
}
$out .= '
';
}
$out .= '
';
return $out;
}
/**
* Create an HTML message
*
* @param string $label label content
* @param string $message message content
* @return string
*/
function message($label, $message) {
return sprintf('%s %s
', $label, $message);
}
/**
* Start a panel.
* make a link and anchor.
*
* @return void
**/
function panelStart($title, $anchor) {
$link = $this->Html->link($title, '#' . $anchor);
return $link;
}
/**
* Create a table.
*
* @param array $rows Rows to make.
* @param array $headers Optional header row.
* @return string
*/
function table($rows, $headers = array()) {
$out = '';
if (!empty($headers)) {
$out .= $this->Html->tableHeaders($headers);
}
$out .= $this->Html->tableCells($rows, array('class' => 'odd'), array('class' => 'even'), false, false);
$out .= '
';
return $out;
}
/**
* send method
*
* @return void
* @access public
*/
function send() {
if (!$this->settings['forceEnable'] && Configure::read('debug') == 0) {
return;
}
$view =& ClassRegistry::getObject('view');
$head = $this->Html->css('/debug_kit/css/debug_toolbar');
if (isset($view->viewVars['debugToolbarJavascript'])) {
foreach ($view->viewVars['debugToolbarJavascript'] as $script) {
if ($script) {
$head .= $this->Html->script($script);
}
}
}
if (preg_match('##', $view->output)) {
$view->output = preg_replace('##', $head . "\n", $view->output, 1);
}
$toolbar = $view->element('debug_toolbar', array('plugin' => 'debug_kit', 'disableTimer' => true));
if (preg_match('#