ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
inc.debug.php File Reference

Go to the source code of this file.

Namespaces

 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 More...
 
 pr ($var, $name='')
 shortcut for print_r More...
 
 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) More...
 
 getPhpSourceCodePositionInfo ($backjumps=0)
 returns an array containing function information from backtrace (the optional backjump param conrols the level in backtrace) More...
 

Function Documentation

◆ cf()

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().

127 {
128  list($fileC, $funcC) = getPhpSourceCodePositionInfo( ($backjumps - 1) + 1 );
129  list($fileF, $funcF) = getPhpSourceCodePositionInfo( ($backjumps) + 1 );
130 
131  echo "<pre style=\"text-align:left;\">$fileC - $funcC\nIS CALLED FROM: $fileF - $funcF</pre>";
132 
133  // BH: php 5.3 seems to not flushing the output consequently so following redirects are still performed
134  // and the output of vd() would be lost in nirvana if we not flush the output manualy
135  flush(); ob_flush();
136 }
getPhpSourceCodePositionInfo($backjumps=0)
returns an array containing function information from backtrace (the optional backjump param conrols ...
Definition: inc.debug.php:146
+ Here is the call graph for this function:

◆ getPhpSourceCodePositionInfo()

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, and array.

Referenced by cf(), and vd().

147 {
148  $i = $backjumps;
149  $j = $backjumps + 1;
150 
151  $e = new Exception();
152  $trace = $e->getTrace();
153 
154  $file = basename($trace[$i]['file']).':'.$trace[$i]['line'];
155 
156  $func = '';
157 
158  if( isset($trace[$j]['class']) && strlen($trace[$j]['class']) )
159  {
160  $func = $trace[$j]['class'];
161 
162  if( isset($trace[$j]['class']) && strlen($trace[$j]['class']) )
163  $func .= $trace[$j]['type'];
164  else $func .= '::';
165  }
166 
167  $func .= $trace[$j]['function'].'()';
168 
169  return array($file, $func);
170 }
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the caller graph for this function:

◆ pr()

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\getContext().

98 {
99  if($name != '') $name .= ' = ';
100  $print = $name.print_r($var,true);
101 
102  if( ilAuthFactory::getContext() == ilAuthFactory::CONTEXT_CRON )
103  {
104  $hr = "\n---------------------------------------------------------------\n";
105  echo $hr.$print.$hr;
106  }
107  else
108  {
109  echo '<pre>'.$print.'</pre>';
110  }
111 
112  // BH: php 5.3 seems to not flushing the output consequently so following redirects are still performed
113  // and the output of vd() would be lost in nirvana if we not flush the output manualy
114  flush(); ob_flush();
115 }
+ Here is the call graph for this function:

◆ vd()

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\getContext(), and getPhpSourceCodePositionInfo().

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

43 {
44  list($file, $func) = getPhpSourceCodePositionInfo(1);
45 
46  $numargs = func_num_args();
47 
48  if ($numargs == 0)
49  {
50  return false;
51  }
52 
53  $arg_list = func_get_args();
54  $num = 1;
55 
56  include_once 'Services/Authentication/classes/class.ilAuthFactory.php';
57  if( ilAuthFactory::getContext() == ilAuthFactory::CONTEXT_CRON )
58  $cli = true;
59  else $cli = false;
60 
61  foreach ($arg_list as $arg)
62  {
63  if(!$cli)
64  {
65  $printbefore = "<pre style=\"text-align:left;\">";
66  $printbefore .= "$file - $func - variable $num:<br/>";
67  $printafter = "</pre><br/>";
68  }
69  else
70  {
71  $printbefore = "\n\n_________________________________________________".
72  "_________________________________________________\n";
73  $printbefore .= "$file - $func - variable $num:\n\n";
74  $printafter = "_________________________________________________".
75  "_________________________________________________\n\n";
76  }
77 
78  echo $printbefore;
79  var_dump($arg);
80  echo $printafter;
81  $num++;
82  }
83 
84  // BH: php 5.3 seems to not flushing the output consequently so following redirects are still performed
85  // and the output of vd() would be lost in nirvana if we not flush the output manualy
86  flush(); ob_flush();
87 }
getPhpSourceCodePositionInfo($backjumps=0)
returns an array containing function information from backtrace (the optional backjump param conrols ...
Definition: inc.debug.php:146
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:
+ Here is the caller graph for this function: