I’ll need some time to test now, cause I disabled business directory, it was also conflicting with other plugins.
It comes all of a sudden, just says there is an error on debugging.php, on line 69. when I go check it out, I can’t understand a thing.
Here is what’s from line 39 to 172:
public static function _php_error_handler($errno, $errstr, $file, $line, $context) {
static $errno_to_string = array(
E_ERROR => 'error',
E_WARNING => 'warning',
E_NOTICE => 'notice',
E_USER_ERROR => 'user-error',
E_USER_WARNING => 'user-warning',
E_USER_NOTICE => 'user-notice',
E_DEPRECATED => 'deprecated'
);
self::add_debug_msg( $errstr,
isset( $errno_to_string[ $errno ] ) ? 'php-' . $errno_to_string[ $errno ] : 'php',
array( 'file' => $file,
'line' => $line) );
}
public static function debug_off() {
self::$debug = false;
remove_action('admin_footer', array('WPBDP_Debugging', '_debug_bar_footer'), 99999);
remove_action('wp_footer', array('WPBDP_Debugging', '_debug_bar_footer'), 99999);
}
public static function _debug_bar_footer() {
if (!self::$debug)
return;
global $wpdb;
$queries = $wpdb->queries;
if (!self::$messages && !$queries)
return;
echo '<div id="wpbdp-debugging">';
echo '<ul class="tab-selector">';
echo '<li class="active"><a href="#logging">Logging</a></li>';
echo '<li><a href="#wpdbqueries">$wpdb queries</a></li>';
echo '</ul>';
echo '<div class="tab" id="wpbdp-debugging-tab-logging">';
echo '<table>';
foreach (self::$messages as $item) {
$time = explode( ' ', $item['timestamp'] );
echo '<tr class="' . $item['type'] . '">';
echo '<td class="handle">?</td>';
echo '<td class="timestamp">' . date('H:i:s', $time[1]) . '</td>';
echo '<td class="type">' . $item['type'] . '</td>';
echo '<td class="message">' . $item['message'] . '</td>';
if ($item['context']) {
echo '<td class="context">' . $item['context']['function'] . '</td>';
echo '<td class="file">' . basename($item['context']['file']) . ':' . $item['context']['line'] . '</td>';
} else {
echo '<td class="context"></td><td class="file"></td>';
}
echo '</tr>';
}
echo '</table>';
echo '</div>';
echo '<div class="tab" id="wpbdp-debugging-tab-wpdbqueries">';
if ( !$queries ) {
echo 'No SQL queries were logged.';
} else {
echo '<table>';
foreach ( $queries as $q ) {
echo '<tr class="wpdbquery">';
echo '<td class="handle">?</td>';
echo '<td class="query">';
echo $q[0];
echo '<div class="extradata">';
echo '<dl>';
echo '<dt>Time Spent:</dt><dd>' . $q[1] . '</dd>';
echo '<dt>Backtrace:</dt><dd>' . $q[2] . '</dd>';
echo '</dl>';
echo '</div>';
echo '</td>';
echo '</tr>';
}
echo '</table>';
}
echo '</div>';
echo '</div>';
}
private static function _extract_context($stack) {
if ( !is_array( $stack ) || empty( $stack ) )
return array();
$context = array( 'class' => '', 'file' => '', 'function' => '', 'line' => '' );
foreach ( $stack as $i => &$item ) {
if ( ( isset( $item['class'] ) && $item['class'] == 'WPBDP_Debugging' ) || ( isset( $item['file'] ) && $item['file'] == __FILE__ ) )
continue;
if ( isset( $item['function'] ) && in_array( $item['function'], array( 'wpbdp_log', 'wpbdp_debug', 'wpbdp_log_deprecated' ) ) ) {
$context['file'] = $item['file'];
$context['line'] = $item['line'];
$context['function'] = $item['function'];
$i2 = current( $stack );
$context['function'] = $i2['function'];
break;
} else {
$context['file'] = $item['file'];
$context['line'] = $item['line'];
$context['stack'] = $stack;
}
}
return $context;
}
private static function add_debug_msg($msg, $type='debug', $context=null) {
self::$messages[] = array( 'timestamp' => microtime(),
'message' => $msg,
'type' => $type,
'context' => wpbdp_starts_with( $type, 'php', false ) ? $context : self::_extract_context($context),
);
}
private static function _var_dump($var) {
if ( is_bool( $var ) || is_int( $var ) || ( is_string( $var ) && empty( $var ) ) )
return var_export( $var, true );
return print_r($var, true);
}
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum’s parser.]