display = apply_filters(
'Easy_Plugins/Table_Of_Contents/Debug/Display',
defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY
);
self::$instance->enabled = apply_filters(
'Easy_Plugins/Table_Of_Contents/Debug/Enabled',
( defined( 'WP_DEBUG' ) && WP_DEBUG ) && current_user_can( 'manage_options' )
);
} else {
if ( ! empty( $code ) && ! empty( $message ) ) {
self::$instance->add( $code, $message, $data );
}
}
return self::$instance;
}
/**
* Adds an error or appends an additional message to an existing error.
*
* NOTE: Overrides WP_Error::add() to allow support of passing `false` as `$data`.
*
* @since 2.0.14
*
* @param string|int $code Error code.
* @param string $message Error message.
* @param mixed $data Optional. Error data.
*/
public function add( $code, $message, $data = null ) {
$this->errors[ $code ][] = $message;
if ( ! is_null( $data ) ) {
$this->add_data( $data, $code );
}
/**
* Fires when an error is added to a WP_Error object.
*
* @since 5.6.0
*
* @param string|int $code Error code.
* @param string $message Error message.
* @param mixed $data Error data. Might be empty.
* @param WP_Error $wp_error The WP_Error object.
*/
do_action( 'wp_error_added', $code, $message, $data, $this );
}
/**
* @since 2.0.13
*
* @param string $content
*
* @return string
*/
public function appendTo( $content = '' ) {
return $content . $this;
}
/**
* @since 2.0.13
*
* @return string
*/
public function dump() {
$dump = array();
foreach ( (array) $this->errors as $code => $messages ) {
$data = $this->get_error_data( $code );
$data = is_string( $data ) ? $data : '' . var_export( $data, true ) . '
';
$data = "\t\t
WP_DEBUG
and WP_DEBUG_DISPLAY
are enabled on this site. Please disabled these to prevent the display of these developers\' debug messages.',
'https://codex.wordpress.org/WP_DEBUG'
);
$intro = PHP_EOL . "{$intro}
" .PHP_EOL; $dump = $this->dump(); return PHP_EOL . " " . PHP_EOL; } }