wp/wp-includes/class-wp-error.php
author ymh <ymh.work@gmail.com>
Mon, 14 Oct 2019 17:39:30 +0200
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
permissions -rw-r--r--
resynchronize code repo with production
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * WordPress Error API.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * Contains the WP_Error class and the is_wp_error() function.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
 * WordPress Error class.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
 * Container for checking for WordPress errors and error messages. Return
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    14
 * WP_Error and use is_wp_error() to check if this class is returned. Many
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    15
 * core WordPress functions pass this class in the event of an error and
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
 * if not handled properly will result in code errors.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
class WP_Error {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
	 * Stores the list of errors.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
	 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
	 * @var array
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
	 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    27
	public $errors = array();
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
	 * Stores the list of data for error codes.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
	 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
	 * @var array
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
	 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    35
	public $error_data = array();
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
	/**
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    38
	 * Initialize the error.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
	 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    40
	 * If `$code` is empty, the other parameters will be ignored.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    41
	 * When `$code` is not empty, `$message` will be used even if
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    42
	 * it is empty. The `$data` parameter will be used only if it
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    43
	 * is not empty.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
	 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    45
	 * Though the class is constructed with a single error code and
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    46
	 * message, multiple codes can be added using the `add()` method.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
	 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
	 * @param string|int $code Error code
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
	 * @param string $message Error message
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
	 * @param mixed $data Optional. Error data.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
	 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    54
	public function __construct( $code = '', $message = '', $data = '' ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
		if ( empty($code) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
			return;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
		$this->errors[$code][] = $message;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
		if ( ! empty($data) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
			$this->error_data[$code] = $data;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
	 * Retrieve all error codes.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
	 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
	 * @return array List of error codes, if available.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
	 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    71
	public function get_error_codes() {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
		if ( empty($this->errors) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
			return array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
		return array_keys($this->errors);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
	 * Retrieve first error code available.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
	 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
	 * @return string|int Empty string, if no error codes.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
	 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    85
	public function get_error_code() {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
		$codes = $this->get_error_codes();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
		if ( empty($codes) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
			return '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
		return $codes[0];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
	 * Retrieve all error messages or error messages matching code.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
	 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
	 * @param string|int $code Optional. Retrieve messages matching code, if exists.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
	 * @return array Error strings on success, or empty array on failure (if using code parameter).
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
	 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   102
	public function get_error_messages($code = '') {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
		// Return all messages if no code specified.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
		if ( empty($code) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
			$all_messages = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
			foreach ( (array) $this->errors as $code => $messages )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
				$all_messages = array_merge($all_messages, $messages);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
			return $all_messages;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
		if ( isset($this->errors[$code]) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
			return $this->errors[$code];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
		else
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
			return array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
	 * Get single error message.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
	 * This will get the first message available for the code. If no code is
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
	 * given then the first code available will be used.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
	 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
	 * @param string|int $code Optional. Error code to retrieve message.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
	 * @return string
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
	 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   129
	public function get_error_message($code = '') {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   130
		if ( empty($code) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
			$code = $this->get_error_code();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
		$messages = $this->get_error_messages($code);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
		if ( empty($messages) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
			return '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   135
		return $messages[0];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
	 * Retrieve error data for error code.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
	 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
	 * @param string|int $code Optional. Error code.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   144
	 * @return mixed Error data, if it exists.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   145
	 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   146
	public function get_error_data($code = '') {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   147
		if ( empty($code) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
			$code = $this->get_error_code();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   149
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   150
		if ( isset($this->error_data[$code]) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
			return $this->error_data[$code];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   152
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
	/**
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   155
	 * Add an error or append additional message to an existing error.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
	 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
	 * @param string|int $code Error code.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
	 * @param string $message Error message.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
	 * @param mixed $data Optional. Error data.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
	 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   163
	public function add($code, $message, $data = '') {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
		$this->errors[$code][] = $message;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
		if ( ! empty($data) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
			$this->error_data[$code] = $data;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
	 * Add data for error code.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
	 * The error code can only contain one error data.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
	 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   175
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
	 * @param mixed $data Error data.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
	 * @param string|int $code Error code.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
	 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   179
	public function add_data($data, $code = '') {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
		if ( empty($code) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
			$code = $this->get_error_code();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   183
		$this->error_data[$code] = $data;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   184
	}
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   185
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   186
	/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   187
	 * Removes the specified error.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   188
	 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   189
	 * This function removes all error messages associated with the specified
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   190
	 * error code, along with any error data for that code.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   191
	 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   192
	 * @since 4.1.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   193
	 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   194
	 * @param string|int $code Error code.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   195
	 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   196
	public function remove( $code ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   197
		unset( $this->errors[ $code ] );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   198
		unset( $this->error_data[ $code ] );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   199
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
}