ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
inc.debug.php File Reference

Go to the source code of this file.

Namespaces

namespace  ilias
 redirection script todo: (a better solution should control the processing via a xml file)

Functions

 vd ()
 shortcut for var_dump with enhanced debug information
 pr ($var, $name= '')
 shortcut for print_r
 cf ($backjumps=1)
 prints an information about the function that called the function that invoked this function (the optional backjump param conrols the level in backtrace)
 getPhpSourceCodePositionInfo ($backjumps=0)
 returns an array containing function information from backtrace (the optional backjump param conrols the level in backtrace)

Function Documentation

cf (   $backjumps = 1)

prints an information about the function that called the function that invoked this function (the optional backjump param conrols the level in backtrace)

Author
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de public
Parameters
integer$backjumps

Definition at line 126 of file inc.debug.php.

References getPhpSourceCodePositionInfo().

{
list($fileC, $funcC) = getPhpSourceCodePositionInfo( ($backjumps - 1) + 1 );
list($fileF, $funcF) = getPhpSourceCodePositionInfo( ($backjumps) + 1 );
echo "<pre style=\"text-align:left;\">$fileC - $funcC\nIS CALLED FROM: $fileF - $funcF</pre>";
// BH: php 5.3 seems to not flushing the output consequently so following redirects are still performed
// and the output of vd() would be lost in nirvana if we not flush the output manualy
flush(); ob_flush();
}

+ Here is the call graph for this function:

getPhpSourceCodePositionInfo (   $backjumps = 0)

returns an array containing function information from backtrace (the optional backjump param conrols the level in backtrace)

Author
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de public
Parameters
integer$backjumps

Definition at line 146 of file inc.debug.php.

References $file.

Referenced by cf(), and vd().

{
$i = $backjumps;
$j = $backjumps + 1;
$e = new Exception();
$trace = $e->getTrace();
$file = basename($trace[$i]['file']).':'.$trace[$i]['line'];
$func = '';
if( isset($trace[$j]['class']) && strlen($trace[$j]['class']) )
{
$func = $trace[$j]['class'];
if( isset($trace[$j]['class']) && strlen($trace[$j]['class']) )
$func .= $trace[$j]['type'];
else $func .= '::';
}
$func .= $trace[$j]['function'].'()';
return array($file, $func);
}

+ Here is the caller graph for this function:

pr (   $var,
  $name = '' 
)

shortcut for print_r

Author
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de public
Parameters
mixedany number of parameters
stringname of variable (optional)

Definition at line 97 of file inc.debug.php.

References ilAuthFactory\CONTEXT_CRON, and ilAuthFactory\getContext().

{
if($name != '') $name .= ' = ';
$print = $name.print_r($var,true);
{
$hr = "\n---------------------------------------------------------------\n";
echo $hr.$print.$hr;
}
else
{
echo '<pre>'.$print.'</pre>';
}
// BH: php 5.3 seems to not flushing the output consequently so following redirects are still performed
// and the output of vd() would be lost in nirvana if we not flush the output manualy
flush(); ob_flush();
}

+ Here is the call graph for this function:

vd ( )

shortcut for var_dump with enhanced debug information

Author
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Sascha Hofmann shofm.nosp@m.ann@.nosp@m.datab.nosp@m.ay.d.nosp@m.e public
Parameters
mixedany number of parameters

Definition at line 42 of file inc.debug.php.

References $file, ilAuthFactory\CONTEXT_CRON, ilAuthFactory\getContext(), and getPhpSourceCodePositionInfo().

Referenced by ilTinyMCE\_getEditorLanguage(), ilTinyMCE\addCustomRTESupport(), ilTinyMCE\addRTESupport(), ilTinyMCE\addUserTextEditor(), ilTinyMCE\ilTinyMCE(), and ilTestPlayerDynamicQuestionSetGUI\showQuestionSelectionCmd().

{
$numargs = func_num_args();
if ($numargs == 0)
{
return false;
}
$arg_list = func_get_args();
$num = 1;
include_once 'Services/Authentication/classes/class.ilAuthFactory.php';
$cli = true;
else $cli = false;
foreach ($arg_list as $arg)
{
if(!$cli)
{
$printbefore = "<pre style=\"text-align:left;\">";
$printbefore .= "$file - $func - variable $num:<br/>";
$printafter = "</pre><br/>";
}
else
{
$printbefore = "\n\n_________________________________________________".
"_________________________________________________\n";
$printbefore .= "$file - $func - variable $num:\n\n";
$printafter = "_________________________________________________".
"_________________________________________________\n\n";
}
echo $printbefore;
var_dump($arg);
echo $printafter;
$num++;
}
// BH: php 5.3 seems to not flushing the output consequently so following redirects are still performed
// and the output of vd() would be lost in nirvana if we not flush the output manualy
flush(); ob_flush();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function: