47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
class WsDebug_Controller_Plugin_Debug_Plugin
|
|
{
|
|
public function getLinebreak()
|
|
{
|
|
return "\n";
|
|
}
|
|
|
|
/**
|
|
* Transforms data into readable format
|
|
*
|
|
* @param array $values
|
|
* @return string
|
|
*/
|
|
protected function _cleanData($values)
|
|
{
|
|
$linebreak = $this->getLinebreak();
|
|
|
|
if (is_array($values)) {
|
|
ksort($values);
|
|
}
|
|
$retVal = $linebreak;
|
|
foreach ($values as $key => $value)
|
|
{
|
|
$key = htmlspecialchars($key);
|
|
if (is_numeric($value)) {
|
|
$retVal .= $key.' => '.$value.$linebreak;
|
|
}
|
|
else if (is_string($value)) {
|
|
$retVal .= $key.' => \''.htmlspecialchars($value).'\''.$linebreak;
|
|
}
|
|
else if (is_array($value))
|
|
{
|
|
$retVal .= $key.' => '.self::_cleanData($value);
|
|
}
|
|
else if (is_object($value))
|
|
{
|
|
$retVal .= $key.' => '.get_class($value).' Object()'.$linebreak;
|
|
}
|
|
else if (is_null($value))
|
|
{
|
|
$retVal .= $key.' => NULL'.$linebreak;
|
|
}
|
|
}
|
|
return $retVal.$linebreak;
|
|
}
|
|
} |