* @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License Version 2.1
*
* @package Krumo
*/
//////////////////////////////////////////////////////////////////////////////
/**
* backward compatibility: the DIR_SEP constant isn't used anymore
*/
if(!defined('DIR_SEP')) {
define('DIR_SEP', DIRECTORY_SEPARATOR);
}
/**
* backward compatibility: the PATH_SEPARATOR constant is availble since 4.3.0RC2
*/
if (!defined('PATH_SEPARATOR')) {
define('PATH_SEPARATOR', OS_WINDOWS ? ';' : ':');
}
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
/**
* Set the KRUMO_DIR constant up with the absolute path to Krumo files. If it is
* not defined, include_path will be used. Set KRUMO_DIR only if any other module
* or application has not already set it up.
*/
if (!defined('KRUMO_DIR')) {
define('KRUMO_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
}
/**
* This constant sets the maximum strings of strings that will be shown
* as they are. Longer strings will be truncated with this length, and
* their `full form` will be shown in a child node.
*/
if (!defined('KRUMO_TRUNCATE_LENGTH')) {
define('KRUMO_TRUNCATE_LENGTH', 50);
}
//////////////////////////////////////////////////////////////////////////////
/**
* Krumo API
*
* This class stores the Krumo API for rendering and
* displaying the structured information it is reporting
*
* @package Krumo
*/
Class krumo {
/**
* Return Krumo version
*
* @return string
* @access public
* @static
*/
Public Static Function version() {
return '0.2.1a';
}
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
/**
* Prints a debug backtrace
*
* @access public
* @static
*/
Public Static Function backtrace() {
// disabled ?
//
if (!krumo::_debug()) {
return false;
}
// render it
//
return krumo::dump(debug_backtrace());
}
/**
* Prints a list of all currently declared classes.
*
* @access public
* @static
*/
Public Static Function classes() {
// disabled ?
//
if (!krumo::_debug()) {
return false;
}
// render it
//
?>
This is a list of all currently declared classes.
This is a list of all currently declared interfaces.
This is a list of all currently included (or required) files.
This is a list of all currently declared functions.
This is a list of all currently declared constants (defines).
This is a list of all currently loaded PHP extensions.
This is a list of all HTTP request headers.
php.ini
*
* @access public
* @static
*/
Public Static Function phpini() {
// disabled ?
//
if (!krumo::_debug()) {
return false;
}
if (!readable(get_cfg_var('cfg_file_path'))) {
return false;
}
// render it
//
?>
This is a list of the configuration settings read from
.
This is a list of all your configuration settings.
include_path option.
*
* @access public
* @static
*/
Public Static Function path() {
// disabled ?
//
if (!krumo::_debug()) {
return false;
}
// render it
//
?>
This is a list of the specified directories under your include_path
option.
$_REQUEST array.
*
* @access public
* @static
*/
Public Static Function request() {
// disabled ?
//
if (!krumo::_debug()) {
return false;
}
// render it
//
?>
This is a list of all the values from the $_REQUEST
array.
$_GET array.
*
* @access public
* @static
*/
Public Static Function get() {
// disabled ?
//
if (!krumo::_debug()) {
return false;
}
// render it
//
?>
This is a list of all the values from the $_GET
array.
$_POST array.
*
* @access public
* @static
*/
Public Static Function post() {
// disabled ?
//
if (!krumo::_debug()) {
return false;
}
// render it
//
?>
This is a list of all the values from the $_POST
array.
$_SERVER array.
*
* @access public
* @static
*/
Public Static Function server() {
// disabled ?
//
if (!krumo::_debug()) {
return false;
}
// render it
//
?>
This is a list of all the values from the $_SERVER
array.
$_COOKIE array.
*
* @access public
* @static
*/
Public Static Function cookie() {
// disabled ?
//
if (!krumo::_debug()) {
return false;
}
// render it
//
?>
This is a list of all the values from the $_COOKIE
array.
$_ENV array.
*
* @access public
* @static
*/
Public Static Function env() {
// disabled ?
//
if (!krumo::_debug()) {
return false;
}
// render it
//
?>
This is a list of all the values from the $_ENV
array.
$_SESSION array.
*
* @access public
* @static
*/
Public Static Function session() {
// disabled ?
//
if (!krumo::_debug()) {
return false;
}
// render it
//
?>
This is a list of all the values from the $_SESSION
array.
This is a list of all the values from the
INI file.
1) {
$_ = func_get_args();
foreach($_ as $d) {
krumo::dump($d);
}
return;
}
// the css ?
//
krumo::_css();
// find caller
// DEVEL: we added array_reverse() so the proper file+line number is found.
$_ = array_reverse(debug_backtrace());
while($d = array_pop($_)) {
// DEVEL: changed if() condition below
if ((strpos(@$d['file'], 'devel') === FALSE) && (strpos(@$d['file'], 'krumo') === FALSE) && @$d['class'] != 'krumo') {
break;
}
}
// the content
// DEVEL: we add an ltr here.
?>
$bee){
if (is_object($bee)) {
unset($hive[$i]->$_recursion_marker);
} else {
unset($hive[$i][$_recursion_marker]);
}
}
}
// PHP 4.x.x array reference bug...
//
if (is_array($data) && version_compare(PHP_VERSION, "5", "<")) {
unset($GLOBALS[krumo::_marker()]);
}
}
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
/**
* Returns values from Krumo's configuration
*
* @param string $group
* @param string $name
* @param mixed $fallback
* @return mixed
*
* @access private
* @static
*/
Private Static Function _config($group, $name, $fallback=null) {
static $_config = array();
// not loaded ?
//
if (empty($_config)) {
$_config = (array) @parse_ini_file(
KRUMO_DIR . 'krumo.ini',
true);
}
// exists ?
//
return (isset($_config[$group][$name]))
? $_config[$group][$name]
: $fallback;
}
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
/**
* Print the skin (CSS)
*
* @return boolean
* @access private
* @static
*/
Private Static Function _css() {
static $_css = false;
// already set ?
//
if ($_css) {
return true;
}
$css = '';
// DEVEL: changed for Drupal variables system
$skin = variable_get('devel_krumo_skin', 'orange');
// custom selected skin ?
//
$_ = KRUMO_DIR . "skins/{$skin}/skin.css";
if ($fp = @fopen($_, 'r', 1)) {
$css = fread($fp, filesize($_));
fclose($fp);
}
// defautl skin ?
//
if (!$css && ($skin != 'default')) {
$skin = 'default';
$_ = KRUMO_DIR . "skins/default/skin.css";
$css = join('', @file($_));
}
// print ?
//
if ($_css = $css != '') {
// fix the urls
//
// DEVEL: changed for Drupal path system.
$css_url = file_create_url(drupal_get_path('module', 'devel') . "/krumo/skins/{$skin}/");
$css = preg_replace('~%url%~Uis', $css_url, $css);
// the CSS
//
?>
$_recursion_marker++)
: @($bee[$_recursion_marker]++);
$_[0][] =& $bee;
}
// return all bees
//
return $_[0];
}
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
/**
* Render a dump for the properties of an array or objeect
*
* @param mixed &$data
* @access private
* @static
*/
Private Static Function _vars(&$data) {
$_is_object = is_object($data);
// test for references in order to
// prevent endless recursion loops
//
$_recursion_marker = krumo::_marker();
$_r = ($_is_object)
? @$data->$_recursion_marker
: @$data[$_recursion_marker] ;
$_r = (integer) $_r;
// recursion detected
//
if ($_r > 0) {
return krumo::_recursion();
}
// stain it
//
krumo::_hive($data);
// render it
//
?>
$k;
} else {
$v =& $data[$k];
}
krumo::_dump($v,$k);
} ?>
0) {?> onClick="krumo.toggle(this);"
onMouseOver="krumo.over(this);"
onMouseOut="krumo.out(this);">
(
Array, )
|
(Callback)
::();
0) {?> onClick="krumo.toggle(this);"
onMouseOver="krumo.over(this);"
onMouseOut="krumo.out(this);">
(
Object)
KRUMO_TRUNCATE_LENGTH) {
$_ = substr($data, 0, KRUMO_TRUNCATE_LENGTH - 3) . '...';
$_extra = true;
}
?>
onClick="krumo.toggle(this);"
onMouseOver="krumo.over(this);"
onMouseOut="krumo.out(this);">
(
String,
characters )
|
(Callback)
();