* @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){ // skip closures set as properties if (is_object($bee) && !($bee instanceof Closure)) { unset($hive[$i]->$_recursion_marker); // DEVEL: changed 'else' to 'elseif' below } elseif (is_array($bee)) { 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; } // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- /** * Allows CSS and Javascript to be included without performing a krumo::dump(). */ Public Static Function addCssJs() { return krumo::_css(); } // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- /** * 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', 'default'); // 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 // drupal_add_css($css, 'inline'); drupal_add_js(join(file(KRUMO_DIR . "krumo.js")), 'inline'); } return $_css; } // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- /** * Enable Krumo * * @return boolean * @access public * @static */ Public Static Function enable() { return true === krumo::_debug(true); } /** * Disable Krumo * * @return boolean * @access public * @static */ Public Static Function disable() { return false === krumo::_debug(false); } /** * Get\Set Krumo state: whether it is enabled or disabled * * @param boolean $state * @return boolean * @access private * @static */ Private Static Function _debug($state=null) { static $_ = true; // set // if (isset($state)) { $_ = (boolean) $state; } // get // return $_; } // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- /** * Dump information about a variable * * @param mixed $data * @param string $name * @access private * @static */ Private Static Function _dump(&$data, $name='...') { // object ? // if (is_object($data)) { return krumo::_object($data, $name); } // array ? // if (is_array($data)) { // PHP 4.x.x array reference bug... // if (version_compare(PHP_VERSION, "5", "<")) { // prepare the GLOBAL reference list... // if (!isset($GLOBALS[krumo::_marker()])) { $GLOBALS[krumo::_marker()] = array(); } if (!is_array($GLOBALS[krumo::_marker()])) { $GLOBALS[krumo::_marker()] = (array) $GLOBALS[krumo::_marker()]; } // extract ? // if (!empty($GLOBALS[krumo::_marker()])) { $d = array_shift($GLOBALS[krumo::_marker()]); if (is_array($d)) { $data = $d; } } } return krumo::_array($data, $name); } // resource ? // if (is_resource($data)) { return krumo::_resource($data, $name); } // scalar ? // if (is_string($data)) { return krumo::_string($data, $name); } if (is_float($data)) { return krumo::_float($data, $name); } if (is_integer($data)) { return krumo::_integer($data, $name); } if (is_bool($data)) { return krumo::_boolean($data, $name); } // null ? // if (is_null($data)) { return krumo::_null($name); } } // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- /** * Render a dump for a NULL value * * @param string $name * @return string * @access private * @static */ Private Static Function _null($name) { ?>
  • (NULL)
  • $_recursion_marker) ? ($bee->$_recursion_marker = 1) : $bee->$_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 // ?>
  • (Array, ) | (Callback) ::();
  • (Object)
  • (Resource)
  • (Boolean)
  • (Integer)
  • (Float)
  • KRUMO_TRUNCATE_LENGTH) { $_ = drupal_substr($data, 0, KRUMO_TRUNCATE_LENGTH - 3) . '...'; $_extra = true; } ?>
  • (String, characters ) | (Callback) ();