ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 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 @access public
Parameters
integer$backjumps

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

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

References getPhpSourceCodePositionInfo().

+ 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 @access public
Parameters
integer$backjumps

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

146{
147 $i = $backjumps;
148 $j = $backjumps + 1;
149
150 $e = new Exception();
151 $trace = $e->getTrace();
152
153 $file = basename($trace[$i]['file']) . ':' . $trace[$i]['line'];
154
155 $func = '';
156
157 if (isset($trace[$j]['class']) && strlen($trace[$j]['class'])) {
158 $func = $trace[$j]['class'];
159
160 if (isset($trace[$j]['class']) && strlen($trace[$j]['class'])) {
161 $func .= $trace[$j]['type'];
162 } else {
163 $func .= '::';
164 }
165 }
166
167 $func .= $trace[$j]['function'] . '()';
168
169 return array($file, $func);
170}
$i
Definition: disco.tpl.php:19
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, and $i.

Referenced by cf(), and vd().

+ 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 @access public
Parameters
mixedany number of parameters
stringname of variable (optional)

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

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

References $name, and ilAuthFactory\getContext().

+ 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 @access public
Parameters
mixedany number of parameters

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

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

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function: