Exception->getTrace() function DEBUG_S($DEBUG_LEVEL,$DESCRIPTION,$DEBUG_STRING = null,$FILE=null,$FUNCTION=null,$LINE=null) { static $debug_rand_color; if(isset($_SESSION['DEBUG'])) $SESSION['DEBUG']=$_SESSION['DEBUG']; // narzucamy zmienna session dla celowych wyzwolen DEBUG_S , bez ich koniecznego deklarowania jej jako SESSION , aby tylko raz uzyc else $SESSION['DEBUG']=null; if($DEBUG_LEVEL<0) $SESSION['DEBUG']=abs($DEBUG_LEVEL); //jezeli podamy w parametr $DEBUG_LEVEL=-3 , to funkcja dziala tak, jakby zmienna sesji byla na $_SESSION['DEBUG']=3 if (empty($SESSION['DEBUG'])) return; if ($FILE) $FILE = end(explode('/', $FILE)); if (!is_array($debug_rand_color)) { $debug_rand_color = array(); for($i=1;$i<2;$i++) { $debug_rand_color []= "#".dechex(rand(16, 64)).'00'.'00'; $debug_rand_color []= "#".dechex(rand(64, 128)).'00'.'00'; $debug_rand_color []= "#00".dechex(rand(16, 64)).dechex(rand(16, 128)); $debug_rand_color []= "#".dechex(rand(64, 128)).dechex(rand(16, 64)).dechex(rand(16, 128)); $debug_rand_color []= "#".dechex(rand(16, 64)).dechex(rand(64, 128)).dechex(rand(16, 128)); $debug_rand_color []= "#".dechex(rand(64, 128)).dechex(rand(16, 128)).dechex(rand(16, 128)); $debug_rand_color []= "#".dechex(rand(16, 64)).'00'.dechex(rand(64, 128)); $debug_rand_color []= "#".dechex(rand(64, 128)).'00'.dechex(rand(16, 128)); $debug_rand_color []= "#".dechex(rand(16, 64)).dechex(rand(64, 128)).dechex(rand(16, 128)); } } if (next($debug_rand_color)); else reset($debug_rand_color); $color = current($debug_rand_color); $dbg_trace = ''; /* if ($_SESSION['DEBUG'] > 0) { try { throw new Exception('DEBUG_S ...'); } catch (Exception $e) { $first = true; $dbg_trace_arr = $e->getTrace(); foreach ($dbg_trace_arr as $v) { $tmp_dbg_file = end(explode('/',$v['file'])); $dbg_trace .= $tmp_dbg_file.'('.$v['line'].')'.':'; if ($first) { $dbg_trace .= $DESCRIPTION; if (!$FILE) $FILE = $tmp_dbg_file; if (!$LINE) $LINE = $v['line']; $first = false; } else { $dbg_trace .= $v['function']; } $dbg_trace .= "\n"; }//end foreach } } */ if ($SESSION['DEBUG'] <= 1) { echo"\n".''."\n"; } else { if ($SESSION['DEBUG'] >= $DEBUG_LEVEL) { $_SESSION['DEBUG_BOX_ID'] = (isset($_SESSION['DEBUG_BOX_ID']))? $_SESSION['DEBUG_BOX_ID'] + 1 : 1; $js = "var a=this.nextSibling;if(a.style.display=='none'){a.style.display='';}else{a.style.display='none';}return false;"; echo'
'."\n"; }// if($_SESSION['DEBUG']>=$DEBUG_LEVEL) } }