47 $new_code = sprintf(
'%s-%s', $type, $code );
49 parent::__construct( $sanitize_code, $message, $data );
63 public function display( $echo =
true, $log = null )
65 $message =
'<div class="wpdk-watchdog-wp-error">';
67 foreach ( $this->errors as $code => $single ) {
68 $message .= sprintf(
'<code>Code: 0x%x, Description: %s</code>', $code, $single[0] );
69 $error_data = $this->get_error_data( $code );
70 if ( !empty( $error_data ) ) {
71 if ( is_array( $error_data ) ) {
72 foreach ( $error_data as $key => $data ) {
73 $message .= sprintf(
'<code>Key: %s, Data: %s</code>', $key, urldecode( $data ) );
77 $message .= sprintf(
'<code>Data: %s</code>', urldecode( $error_data ) );
83 if ( !is_null( $log ) ) {
84 $log->log( esc_attr( wp_strip_all_tags( $message ) ) );
109 <pre><?php var_dump( $content ) ?></pre><?php
110 $content = ob_get_contents();
130 $code = strtr( $code, $replace );
131 return strtolower( $code );
145 protected static function _is( $thing, $class =
'WPDKError' )
147 if ( is_object( $thing ) && is_a( $thing, $class ) ) {
166 return self::_is( $thing );
182 return self::_is( $thing,
'WPDKWarning' );
198 return self::_is( $thing,
'WPDKStatus' );