public static function developer_warn($message, $show_backtrace = true) { if (!WP_DEBUG) { return; } it_classes_load('it-debug.php'); $backtrace = ITDebug::get_backtrace(array('offset' => 2, 'remove_abspath' => false)); echo "<pre style='color:black;background:white;padding:15px;font-family:\"Courier New\",Courier,monospace;font-size:12px;text-align:left;max-width:100%;'>"; echo "<strong>Developer Notice</strong>\n"; echo " {$message}\n\n"; echo "<strong>Stack Backtrace</strong>\n"; foreach ($backtrace as $trace) { echo ' ' . ITDebug::get_backtrace_description($trace) . "\n"; } echo "</pre>\n"; }
public static function backtrace($args = array()) { if (is_string($args)) { $args = array('description' => $args); } else { if (is_bool($args)) { $args = array('expand_objects' => $args); } else { if (is_numeric($args)) { $args = array('max_depth' => $args); } else { if (!is_array($args)) { $args = array(); } } } } $default_args = array('description' => '', 'expand_objects' => false, 'max_depth' => 3, 'type' => ''); $args = array_merge($default_args, $args); if (isset($args['offset'])) { $args['offset']++; } else { $args['offset'] = 1; } $backtrace = ITDebug::get_backtrace($args); if ('string' == $args['type']) { echo $backtrace; } else { $args['max_depth']++; ITDebug::print_r($backtrace, $args); } }