Commit ada06a3b by sn

D::fe rekursiv, D::s

1 parent 3a67d3dd
Showing with 187 additions and 69 deletions
......@@ -17,6 +17,12 @@
*/
class D {
public static function printSession($param_string="", $param_print=true, $param_force=false, $param_htmlentities=false) {
D::show($_SESSION, '$_SESSION '.$param_string, $param_print, $param_force, $param_htmlentities);
D::show($HTTP_SESSION_VARS, '$HTTP_SESSION_VARS '.$param_string, $param_print, $param_force, $param_htmlentities);
}
const ALL = 'ALL';
private static $echo_count = 0;
......@@ -95,7 +101,7 @@ class D {
$html_beginn = '
<html>
<header>
<title>D LOGGER</title>
<title>D:'.$_SERVER['REQUEST_URI'].'</title>
</header>
<body>
';
......@@ -154,77 +160,99 @@ class D {
return htmlentities($param_val);
}
/**
*
* @param type $param_val
* @param type $param_string
* @param type $param_loglevel 1, 2 (classname / array), 3 (pub vars), 4 (fnc), 5 (getData), 6 (Objekt ausgeben)
* @param type $param_print
* @param type $param_force
* @param type $param_htmlentities
*/
public static function s($param_val, $param_string="", $param_loglevel=4, $param_print=true, $param_force=false, $param_htmlentities=false) {
D::show($param_val, $param_string, $param_print, $param_force, $param_htmlentities, $param_loglevel);
}
/**
* Funktion zeigt ein Objekt/Array html strukturiert an
* anstelle von var_dump
*/
public static function show($param_val, $param_string="", $param_print=true, $param_force=false, $param_htmlentities=false) {
if(is_array($param_string)) {
$param_string = $param_string[0];
$print_fullobject = $param_val;
}
public static function show($param_val, $param_string="", $param_print=true, $param_force=false, $param_htmlentities=false, $param_loglevel=10) {
//$param_loglevel=2;
$result = '';
// self::new_echo("<br>______________________<br>", $param_print, $param_force);
self::printCurrentFunction($param_print,"<br>______________________<br>");
if($param_loglevel>0) {
self::printCurrentFunction($param_print,"<br>______________________<br>");
}
// self::new_echo("<b>show(".$param_string.")</b>", $param_print, $param_force);
$string_show = "<br /><b>show(".$param_string.")</b><br />";
if($param_loglevel>1) {
if(is_object($param_val) && get_class($param_val)=='DOMElement') {
D::showdomelement($param_val, $string_show.$param_string,$param_print, $param_force);
} else {
if(is_array($param_val)) {
$string_show .= "count(".$param_val.") = ".count($param_val)."";
$result =$param_val;
// self::new_echo("<br/>count(".$param_val.") = ".count($param_val)."", $param_print, $param_force);
} else if(is_object($param_val)) {
$result = array();
$parent = get_parent_class($param_val);
while($parent) {
$parents .= ' extends <b>'.$parent.'</b>';
$parent = get_parent_class($parent);
}
$result['classname'] = '<b>'.get_class($param_val).'</b>'.$parents;
if($param_loglevel>2) {
$objvars = get_object_vars($param_val);
sort($objvars);
$result['objvars'] = $objvars;
$objfncs = get_class_methods(get_class($param_val));
sort($objfncs);
if($param_loglevel>3) {
if($param_loglevel>4) {
if(array_search('getData', $objfncs)) {
try {
$result['getData'] = $param_val->getData();
} catch (Exception $exc) {
echo $exc->getTraceAsString();
}
}
}
}
$result['objfncs'] = $objfncs;
if($param_loglevel>5) {
$result['obj'] = $param_val;
}
}
if(is_object($param_val) && get_class($param_val)=='DOMElement') {
D::showdomelement($param_val, $string_show.$param_string,$param_print, $param_force);
} else {
if(is_array($param_val)) {
$string_show .= "count(".$param_val.") = ".count($param_val)."";
// self::new_echo("<br/>count(".$param_val.") = ".count($param_val)."", $param_print, $param_force);
} else if(is_object($param_val)) {
$objvars = get_object_vars($param_val);
sort($objvars);
$objfncs = get_class_methods(get_class($param_val));
sort($objfncs);
$parent = get_parent_class($param_val);
while($parent) {
$parents .= ' extends <b>'.$parent.'</b>';
$parent = get_parent_class($parent);
}
$param_val = array(
'classname' => '<b>'.get_class($param_val).'</b>'.$parents,
'objvars' => $objvars,
'objfncs' => $objfncs,
);
if($print_fullobject ) {
$param_val['obj'] = $print_fullobject;
}
}
// self::new_echo("<pre>", $param_print, $param_force);
$string_show .= "<pre>";
if($param_htmlentities){
$param_val=self::htmlencode_arrayvalues($param_val);
}
self::new_echo($string_show.print_r($param_val, true).'"</pre>"', $param_print, $param_force);
//echo '#############################'.print_r($param_val, true).'####################';
// if(is_object($param_val)) {
// self::new_echo("<b>show(Objekt/Klassen Variablen)</b><pre>", $param_print, $param_force);
// self::new_echo(print_r(get_class_vars(get_class($param_val)), true), $param_print, $param_force);
//
//
//
// self::new_echo("<b>show(Objekt/Klassen Funktionen)</b><pre>", $param_print, $param_force);
// self::new_echo(print_r(get_class_methods($param_val), true), $param_print, $param_force);
// }
// self::new_echo("</pre>", $param_print, $param_force);
// self::new_echo("______________________<br>", $param_print, $param_force);
}
$string_show .= "<pre>";
if($param_htmlentities){
$result=self::htmlencode_arrayvalues($result);
}
try {
self::new_echo($string_show.print_r($result, true).'"</pre>"', $param_print, $param_force);
} catch (Exception $exc) {
echo $exc->getTraceAsString();
}
}
public static function cf($param_string='', $param_print=true, $param_force=false) {
......@@ -308,13 +336,102 @@ class D {
self::new_echo("<p>".$param_string."</p>", $param_print, $param_force);
}
public static function fe($param_Array, $param_Print=null) {
$param_Print .= 'count('.count($param_Array).') || print '.$param_Array;
D::li($param_Print);
foreach($param_Array as $var_key => $var_value) {
D::ulli($var_key.' => '.$var_value);
/**
*
* @param type $param_Array
* @param string $param_Print
* @param type $param_logdepth
* @param type $param_ul
* @param type $param_keystring
*/
public static function fe($param_Array, $param_Print=null, $param_logdepth=10, $param_ul=array(), $param_keystring='') {
// D::ulli(':::::::::::::: '.$param_logdepth.' - '.$param_Array);
if($param_logdepth>=0) {
if(!is_null($param_Print)) {
$param_Print .= ' count('.count($param_Array).') loglevel('.$param_logdepth.') || print '.$param_Array;
D::li($param_Print);
}
$param_logdepth--;
$param_ul['start'] .= '<ul>';
$param_ul['stop'] .= '</ul>';
$info_toArray = '';
if(is_array($param_Array)) {
$var_value2Array = $param_Array;
} else if(is_object($param_Array)) {
$objfncs = get_class_methods(get_class($param_Array));
if(array_search('getData', $objfncs)) {
$var_value2Array = $param_Array->getData();
$info_toArray = '(Obj->getData)';
} if(array_search('toArray', $objfncs)) {
$var_value2Array = $param_Array->toArray();
$info_toArray = '(Obj->toArray)';
} else {
$var_value2Array = $param_Array;
}
} else if($unserialize = unserialize($param_Array)) {
$var_value2Array = $unserialize;
$info_toArray = '(str2unserialize)';
} else {
$var_value2Array = $param_Array;
}
self::new_echo($param_ul['start'].'<li>'.$param_keystring.' => '.$param_Array.' '.$info_toArray.' </li>'.$param_ul['stop']);
if(is_array($var_value2Array)) {
foreach($var_value2Array as $var_key => $var_value) {
D::fe($var_value, null, $param_logdepth, $param_ul,$var_key);
}
}
}
}
}
// public static function fe($param_Array, $param_Print=null, $param_logdepth=10, $param_ul=array()) {
//// D::ulli(':::::::::::::: '.$param_logdepth.' - '.$param_Array);
// if($param_logdepth>=0) {
// if(!is_null($param_Print)) {
// $param_Print .= ' count('.count($param_Array).') loglevel('.$param_logdepth.') || print '.$param_Array;
// D::li($param_Print);
// }
// $param_logdepth--;
// $param_ul['start'] .= '<ul>';
// $param_ul['stop'] .= '</ul>';
//
//
// foreach($param_Array as $var_key => $var_value) {
// $info_toArray = '';
//
// if(is_array($info_toArray)) {
// $var_value2Array = $var_value;
//
// } else if(is_object($var_value)) {
// $objfncs = get_class_methods(get_class($var_value));
// if(array_search('getData', $objfncs)) {
// $var_value2Array = $var_value->getData();
// $info_toArray = '(Obj->getData)';
// } if(array_search('toArray', $objfncs)) {
// $var_value2Array = $var_value->toArray();
// $info_toArray = '(Obj->toArray)';
// } else {
// $var_value2Array = $var_value;
// }
// } else if($unserialize = unserialize($var_value)) {
// $var_value2Array = $unserialize;
// $info_toArray = '(str2unserialize)';
// } else {
// $var_value2Array = $var_value;
// }
//
// self::new_echo($param_ul['start'].'<li>'.$var_key.' => '.$var_value.' '.$info_toArray.' loglevel('.$param_logdepth.')</li>'.$param_ul['stop']);
//
// if(is_array($var_value2Array)) {
// D::fe($var_value2Array, null, $param_logdepth, $param_ul);
// }
// // D::ulli($var_key.' => '.$var_value);
// }
// }
// }
/**
* Funktion gibt den Weg zur tatsächliche Funktion zurück
......@@ -346,7 +463,7 @@ class D {
// D::ulli($v.': '.$array[$v]['class'].$array[$v]['type'].$array[$v]['function']);
}
//echo $param_string;
self::new_echo($param_string." <i style=\"font-size:12;color:gray;\"><b>".$array[$i]["class"].$array[$i]["type"].$array[$i]["function"]."()</b> <span title='Rekursionstiefe'>(RT:$var_depth)</span> call in row ".$array[$i]["line"]." in <a href=\"".substr($array[$i]["file"],strpos($array[$i]["file"],"httpdocs")+8)."\">".basename($array[$i]["file"])."</a></i> => [<i style=\"font-size:10;color:gray;\">".$array[$i-1]['class'].$array[$i-1]['type'].$array[$i-1]['function']."() call in ".basename($array[$i-1]["file"])." Zeile: ".$array[$i-1]["line"]." </i>]", $param_print);
self::new_echo($param_string." <i style=\"font-size:12;color:gray;\"><b>".$array[$i]["class"].$array[$i]["type"].$array[$i]["function"]."()</b> <span title='Rekursionstiefe'>(RT:$var_depth)</span> call in row ".$array[$i]["line"]." in <a href=\"".substr($array[$i]["file"],strpos($array[$i]["file"],"httpdocs")+8)."\">".basename($array[$i]["file"])."</a></i> => [<i style=\"font-size:10;color:gray;\">".$array[$i-1]['class'].$array[$i-1]['type'].$array[$i-1]['function']."() call in ".basename($array[$i-1]["file"])." Zeile: ".$array[$i-1]["line"]." </i>] <a href=".$_SERVER['REQUEST_URI']."><i title=".$_SERVER['REQUEST_URI'].">URL</i></a>", $param_print);
//echo '___________<pre>';
//echo print_r($array[$i], true);
//echo '</pre>';
......@@ -362,7 +479,7 @@ class D {
* @param bool $param_onlyReturn
* @return array
*/
public static function printClassesforFunction($param_class, $param_fncname, $param_onlyReturn, $param_print=true, $param_force=false, $param_htmlentities=false) {
public static function printClassesforFunction($param_class, $param_fncname, $param_onlyReturn=false, $param_print=true, $param_force=false, $param_htmlentities=false) {
if(is_object($param_class)) {
$classname = get_class($param_class);
......
......@@ -12,8 +12,9 @@ if(!isset($_LOSP_DEV)) {
*/
$_LOSP_DEV = true;
}
$__THIS_SCRIPT_INFO = pathinfo($_SERVER['SCRIPT_FILENAME']);
if($_LOSP_DEV) {
$__THIS_SCRIPT_INFO = pathinfo($_SERVER['SCRIPT_FILENAME']);
// echo $__THIS_SCRIPT_INFO['filename'];
if(!isset($__mc_D_LOGFILE_HTML)) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!