Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/utility/debugger.php
Show First 20 Lines • Show All 692 Lines • ▼ Show 20 Line(s) | |||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
/** | /** | ||||
* Advanced version of print_r (for debugger only). Don't print objects recursively | * Advanced version of print_r (for debugger only). Don't print objects recursively. | ||||
* | |||||
* @param mixed $p_array Value to be printed. | |||||
* @param boolean $return_output Return output or print it out. | |||||
* @param integer $tab_count Offset in tabs. | |||||
* | * | ||||
* @param Array $array | |||||
* @param bool $return_output return output or print it out | |||||
* @param int $tab_count offset in tabs | |||||
* @return string | * @return string | ||||
* @access private | |||||
*/ | */ | ||||
private function print_r(&$array, $return_output = false, $tab_count = -1) | private function print_r(&$p_array, $return_output = false, $tab_count = -1) | ||||
{ | { | ||||
static $first_line = true; | static $first_line = true; | ||||
// not an array at all | // not an array at all | ||||
if ( !is_array($array) ) { | if ( !is_array($p_array) ) { | ||||
switch ( gettype($array) ) { | switch ( gettype($p_array) ) { | ||||
case 'NULL': | case 'NULL': | ||||
return 'NULL' . "\n"; | return 'NULL' . "\n"; | ||||
break; | break; | ||||
case 'object': | case 'object': | ||||
return $this->processObject($array, $tab_count); | return $this->processObject($p_array, $tab_count); | ||||
break; | break; | ||||
case 'resource': | case 'resource': | ||||
return (string)$array . "\n"; | return (string)$p_array . "\n"; | ||||
break; | break; | ||||
default: | default: | ||||
// number or string | // number or string | ||||
if ( strlen($array) > 200 ) { | if ( strlen($p_array) > 200 ) { | ||||
$array = substr($array, 0, 50) . ' ...'; | $p_array = substr($p_array, 0, 50) . ' ...'; | ||||
} | } | ||||
return $array . "\n"; | |||||
return $p_array . "\n"; | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
$output = ''; | $output = ''; | ||||
if ( count($p_array) > 50 ) { | |||||
$array = array_slice($p_array, 0, 50); | |||||
$array[] = '...'; | |||||
} | |||||
else { | |||||
$array = $p_array; | |||||
} | |||||
$tab_count++; | $tab_count++; | ||||
$output .= "Array\n" . str_repeat(' ', $tab_count) . "(\n"; | $output .= "Array\n" . str_repeat(' ', $tab_count) . "(\n"; | ||||
$tab_count++; | $tab_count++; | ||||
$tabsign = $tab_count ? str_repeat(' ', $tab_count) : ''; | $tabsign = $tab_count ? str_repeat(' ', $tab_count) : ''; | ||||
$array_keys = array_keys($array); | $array_keys = array_keys($array); | ||||
▲ Show 20 Lines • Show All 1280 Lines • Show Last 20 Lines |