/usr/share/php/Horde/View/Helper/Debug.php is in php-horde-view 2.0.6-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | <?php
/**
* Copyright 2007-2008 Maintainable Software, LLC
* Copyright 2006-2016 Horde LLC (http://www.horde.org/)
*
* @author Mike Naberezny <mike@maintainable.com>
* @author Derek DeVries <derek@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
* @license http://www.horde.org/licenses/bsd
* @category Horde
* @package View
* @subpackage Helper
*/
/**
* Dumps a variable for inspection.
*
* Portions borrowed from Paul M. Jones' Solar_Debug
*
* @author Mike Naberezny <mike@maintainable.com>
* @author Derek DeVries <derek@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
* @license http://www.horde.org/licenses/bsd
* @category Horde
* @package View
* @subpackage Helper
*/
class Horde_View_Helper_Debug extends Horde_View_Helper_Base
{
/**
* Dumps a variable for inspection.
*
* @param mixed $var A variable.
*
* @return string Debug output of the variable.
*/
public function debug($var)
{
return '<pre class="debug_dump">'
. htmlspecialchars($this->_fetch($var))
. '</pre>';
}
/**
* Pretty exception dumper.
*
* Inspired by:
* http://www.sitepoint.com/blogs/2006/04/04/pretty-blue-screen/ and
* http://www.sitepoint.com/blogs/2006/08/12/pimpin-harrys-pretty-bluescreen/.
*
* Also see for future ideas:
* http://mikenaberezny.com/archives/55
*
* @param Exception $e An exception to dump.
*
* @return string Debug output of the exception.
*/
public function dump(Exception $e)
{
$input = array(
'type' => get_class($e),
'code' => $e->getCode(),
'message' => $e->getMessage(),
'line' => $e->getLine(),
'file' => $e->getFile(),
'trace' => $e->getTrace(),
);
// Store previous output.
$previous_output = ob_get_contents();
$desc = $input['type'] . ' making ' . $_SERVER['REQUEST_METHOD'] . ' request to ' . $_SERVER['REQUEST_URI'];
return $this->render('_dump.html.php');
}
/**
* Returns formatted output from var_dump().
*
* Buffers the var_dump() output for a variable and applies some simple
* formatting for readability.
*
* @param mixed $var Variable to dump.
*
* @return string Formatted results of var_dump().
*/
protected function _fetch($var)
{
ob_start();
var_dump($var);
return preg_replace('/\]\=\>\n(\s+)/m', '] => ', ob_get_clean());
}
protected function _sub($f)
{
$loc = '';
if (isset($f['class'])) {
$loc .= $f['class'] . $f['type'];
}
if (isset($f['function'])) {
$loc .= $f['function'];
}
if (!empty($loc)) {
$loc = htmlspecialchars($loc);
$loc = "<strong>$loc</strong>";
}
return $loc;
}
protected function _clean($line)
{
$l = trim(strip_tags($line));
return $l ? $l : ' ';
}
protected function _parms($f)
{
if (isset($f['function'])) {
try {
if (isset($f['class'])) {
$r = new ReflectionMethod($f['class'] . '::' . $f['function']);
} else {
$r = new ReflectionFunction($f['function']);
}
return $r->getParameters();
} catch(Exception $e) {
}
}
return array();
}
protected function _src2lines($file)
{
$src = nl2br(highlight_file($file, true));
return explode('<br />', $src);
}
}
|