Warning: Invalid argument supplied for foreach() in /home/jihswbiz/public_html/t6.gwilt.org/refDox.php on line 212
Docs-callingPath

 

ReLoad

Keys


Functions

arraybrowsercolorcookiedatetimeDBdebugdeviceDSTequiverrorflagsfontformatgeo
holidayhtmlisjsonmathparsePHPprintsearchsortstringtabletexttracetype
VOTDweatherxml

Function  callingPath   Lines 129-190 (61 lines) file  utilsDebug.php   Last mod: Mon 2021-05-03 17:55:24

function callingPath $n=-)
        {
#-k     debug trace
#-      return calling info as a string
#-              default is to not display beyond the first utilDebug function
#-              $n      - how many functions back to list
#-              $n      - -1 says response to exclude functions after the first one
        
global $logfcb;

        
$out '';
        
$ch '~';      # '»' level separator
        
if (isset($logfcb['log']['f'])) $ch '>> ';

        
$raw debug_backtrace();
        for (
$i=0;$i<count($raw);$i++)
                {
                
$arr pathinfo $raw[$i]['file'] );
                
$raw[$i]['basename'] = $arr['basename'];
                }

        if (
$n == -1)
                {       
# just return the topmost info for log
                
$j count($raw)-1;
                
$ff $raw[$j]['basename'];             # get 1st filename
                
$uu $raw[$j]['function'] . '@';
                
$out .= $uu $ff '[' $raw[$j]['line'] . '] ' $ch;

                for (
$i=$j-1$i>=0$i--)
                        {
                        if (
$raw[$i]['file'] == $raw[0]['file']) break; # stop loop when we call something in this file
                        
if ($raw[$i]['basename'] != $ff)
                                {
                                
$uu $raw[$i]['function'] . '@';
                                
$ff $raw[$i]['basename'];
                                
$out .= $uu $ff '[' $raw[$i]['line'] . '] ' $ch;
                                }
                        elseif (
$raw[$j]['function'] != $uu)
                                {
                                
$uu $raw[$i]['function'] . '@';
                                
$out .= $uu '[' $raw[$i]['line'] . '] ' $ch;
                                }
                        else
                                {
                                
$out .= $raw[$i]['line'] . $ch;
                                }
                        }
                
$out substr($out,0,-strlen($ch));
                }
        else
                {       
# build breadcrumb path from top down to $n
                
for ($i count($raw)-1$i>=$n$i--)
                        {
                        
$arr explodes '\\/'$raw[$i]['file'], 30 );        # get filename
                        
$out .= $arr[count($arr)-1] . '[' .
                                
$raw[$i]['line'] . ']:' .
                                
$raw[$i]['function'] . $ch;
                        }
                }

        return 
$out;
        }

?>