29 <table class="typo3-debug" border="0" cellpadding="0" cellspacing="0" bgcolor="white" style="border:0px; margin-top:3px; margin-bottom:3px;"> 31 <td style="background-color:#bbbbbb; font-family: verdana,arial; font-weight: bold; font-size: 10px;">%s</td> 49 static public function debug($var =
'', $header =
'', $group =
'Debug') {
51 if (ob_get_level() == 0) {
54 $debug = self::convertVariableToString($var);
56 $debug = sprintf(self::DEBUG_TABLE_TEMPLATE, htmlspecialchars((
string) $header), $debug);
58 if (
TYPO3_MODE ===
'BE' && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI)) {
59 $tabHeader = $header ?:
'Debug';
66 if (typeof Ext !== "object" && (top && typeof top.Ext !== "object")) { 67 document.write(debugMessage); 71 if (top && typeof Ext !== "object") { 75 Ext.onReady(function() { 76 var TYPO3ViewportInstance = null; 78 if (top && top.TYPO3 && typeof top.TYPO3.Backend === "object") { 79 TYPO3ViewportInstance = top.TYPO3.Backend; 80 } else if (typeof TYPO3 === "object" && typeof TYPO3.Backend === "object") { 81 TYPO3ViewportInstance = TYPO3.Backend; 84 if (TYPO3ViewportInstance !== null) { 85 TYPO3ViewportInstance.DebugConsole.addTab(debugMessage, header, group); 87 document.write(debugMessage); 92 echo \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($script);
105 if (is_array($variable)) {
106 $string = self::viewArray($variable);
107 } elseif (is_object($variable)) {
108 $string =
'<strong>|Object:<pre>';
109 $string .= print_r($variable, TRUE);
110 $string .=
'</pre>|</strong>';
111 } elseif ((
string) $variable !==
'') {
112 $string =
'<strong>|' . htmlspecialchars((
string) $variable) .
'|</strong>';
114 $string =
'<strong>| debug |</strong>';
127 $debugString = self::convertVariableToString($debugVariable);
134 browserWindow = function(debug, header, group) { 135 var newWindow = window.open("", "TYPO3DebugWindow_" + group, 136 "width=600,height=400,menubar=0,toolbar=1,status=0,scrollbars=1,resizable=1" 138 if (newWindow.document.body.innerHTML) { 139 newWindow.document.body.innerHTML = newWindow.document.body.innerHTML + 140 "<hr />" + debugMessage; 142 newWindow.document.writeln( 143 "<html><head><title>Debug: " + header + "(" + group + ")</title></head>" 144 + "<body onload=\\"self.focus()\\">" 152 browserWindow(debugMessage, header, group); 154 top.Ext.onReady(function() { 155 if (top && top.TYPO3 && top.TYPO3.Backend) { 156 top.TYPO3.Backend.DebugConsole.openBrowserWindow(header, debugMessage, group); 158 browserWindow(debugMessage, header, group); 164 echo \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($script);
173 $trail = debug_backtrace();
174 $trail = array_reverse($trail);
177 foreach ($trail as $dat) {
178 $pathFragment = $dat[
'class'] . $dat[
'type'] . $dat[
'function'];
180 if (in_array($dat[
'function'], array(
'require',
'include',
'require_once',
'include_once'))) {
183 $path[] = $pathFragment .
'#' . $dat[
'line'];
185 return implode(
' // ', $path);
196 static public function debugRows($rows, $header =
'', $returnHTML = FALSE) {
197 if (is_array($rows)) {
198 $firstEl = reset($rows);
199 if (is_array($firstEl)) {
200 $headerColumns = array_keys($firstEl);
203 $tRows[] =
'<tr><td colspan="' . count($headerColumns) .
'" style="background-color:#bbbbbb; font-family: verdana,arial; font-weight: bold; font-size: 10px;"><strong>' . htmlspecialchars($header) .
'</strong></td></tr>';
205 foreach ($headerColumns as $key) {
207 <td><font face="Verdana,Arial" size="1"><strong>' . htmlspecialchars($key) .
'</strong></font></td>';
210 <tr>' . implode(
'', $tCells) .
' 213 foreach ($rows as $singleRow) {
215 foreach ($headerColumns as $key) {
217 <td><font face="Verdana,Arial" size="1">' . (is_array($singleRow[$key]) ? self::debugRows($singleRow[$key],
'', TRUE) : htmlspecialchars($singleRow[$key])) .
'</font></td>';
220 <tr>' . implode(
'', $tCells) .
' 224 <table border="1" cellpadding="1" cellspacing="0" bgcolor="white">' . implode(
'', $tRows) .
' 232 debug(
'Empty array of rows', $header);
235 debug(
'No array of rows', $header);
247 if (strlen($string) < $characters) {
248 $characters = strlen($string);
251 for ($i = 0; $i < $characters; $i++) {
252 $valuestring .=
' ' . ord(substr($string, $i, 1));
254 return trim($valuestring);
266 if (is_array($array_in)) {
268 <table border="1" cellpadding="1" cellspacing="0" bgcolor="white">';
269 if (count($array_in) == 0) {
270 $result .=
'<tr><td><font face="Verdana,Arial" size="1"><strong>EMPTY!</strong></font></td></tr>';
272 foreach ($array_in as $key => $val) {
274 <td valign="top"><font face="Verdana,Arial" size="1">' . htmlspecialchars((
string) $key) .
'</font></td> 276 if (is_array($val)) {
277 $result .= self::viewArray($val);
278 } elseif (is_object($val)) {
280 if (method_exists($val,
'__toString')) {
281 $string .= get_class($val) .
': ' . (string) $val;
283 $string .= print_r($val, TRUE);
285 $result .=
'<font face="Verdana,Arial" size="1" color="red">' . nl2br(htmlspecialchars($string)) .
'<br /></font>';
287 if (gettype($val) ==
'object') {
288 $string =
'Unknown object';
290 $string = (string) $val;
292 $result .=
'<font face="Verdana,Arial" size="1" color="red">' . nl2br(htmlspecialchars($string)) .
'<br /></font>';
300 $result =
'<table border="1" cellpadding="1" cellspacing="0" bgcolor="white"> 302 <td><font face="Verdana,Arial" size="1" color="red">' . nl2br(htmlspecialchars((
string) $array_in)) .
'<br /></font></td> 318 echo self::viewArray($array_in);
static debug($var='', $header='', $group='Debug')
static quoteJSvalue($value)
static ordinalValue($string, $characters=100)
static convertVariableToString($variable)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
static debugRows($rows, $header='', $returnHTML=FALSE)
static viewArray($array_in)
static debugInPopUpWindow($debugVariable, $header='Debug', $group='Debug')
static stripPathSitePrefix($path)
static printArray($array_in)
const DEBUG_TABLE_TEMPLATE