Skip to content

Commit fe6ffc9

Browse files
committed
added backtrace function from parent theme emerald-wp
1 parent a4d694e commit fe6ffc9

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

functions.php

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,37 @@ function limitText(field, maxChar){
156156
<?php
157157
}
158158
}
159-
add_action( 'wp_footer', 'wpufe_javascript',20 );
159+
add_action( 'wp_footer', 'wpufe_javascript',20 );
160+
161+
// ==(begin)== backtrace function =========
162+
163+
function uthsc_call_stack($stacktrace = array()) {
164+
165+
!$stacktrace && ($stacktrace = debug_backtrace()) && array_shift($stacktrace);
166+
167+
print "<table class='stack small-text-center'>";
168+
print "<tr>";
169+
print "<th colspan='4' style='background: brown; color: #fff;'>Backtrace</th>";
170+
print "</tr>";
171+
print "<tr>";
172+
print "<th style='background: #555; color: #fff;'>Order</th>";
173+
print "<th style='background: #666; color: #fff;font-weight: 200;'>/path/<strong>filename.php</strong></th>";
174+
print "<th style='background: #555; color: #fff;width: 20%;'>Function</th>";
175+
print "<th style='background: #666; color: #fff;width: 5%;'>Line</th>";
176+
print "</tr>";
177+
178+
$i = 1;
179+
foreach($stacktrace as $node) {
180+
print "<tr>
181+
<td style='text-align: center;'>$i. </td>
182+
<td style='text-align: right;'>".dirname($node['file'])."/<strong>".basename($node['file']) ."</strong></td>
183+
<td style='text-align: center;'>" .$node['function'] . "</td>
184+
<td style='text-align: center;'>" .$node['line']. "</td></tr>";
185+
$i++;
186+
}
187+
print "</table>";
188+
189+
}
190+
// use uthsc_call_stack(); in header.php to execute
191+
192+
// ===(end)=== backtrace function =========

0 commit comments

Comments
 (0)