Archived
Updates
This commit is contained in:
1 parent
70d2335bba
commit
7428b67da5
1086 files changed
+94145
-59082
No files matched your search
@@ -24,18 +24,16 @@ class WP_Error {
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
private $errors = array();
|
||||
public $errors = array();
|
||||
|
||||
/**
|
||||
* Stores the list of data for error codes.
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
private $error_data = array();
|
||||
public $error_data = array();
|
||||
|
||||
/**
|
||||
* Initialize the error.
|
||||
@@ -53,7 +51,6 @@ class WP_Error {
|
||||
* @param string|int $code Error code
|
||||
* @param string $message Error message
|
||||
* @param mixed $data Optional. Error data.
|
||||
* @return WP_Error
|
||||
*/
|
||||
public function __construct( $code = '', $message = '', $data = '' ) {
|
||||
if ( empty($code) )
|
||||
@@ -65,58 +62,6 @@ class WP_Error {
|
||||
$this->error_data[$code] = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make private properties readable for backwards compatibility.
|
||||
*
|
||||
* @since 4.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param string $name Property to get.
|
||||
* @return mixed Property.
|
||||
*/
|
||||
public function __get( $name ) {
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make private properties settable for backwards compatibility.
|
||||
*
|
||||
* @since 4.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param string $name Property to set.
|
||||
* @param mixed $value Property value.
|
||||
* @return mixed Newly-set property.
|
||||
*/
|
||||
public function __set( $name, $value ) {
|
||||
return $this->$name = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make private properties checkable for backwards compatibility.
|
||||
*
|
||||
* @since 4.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param string $name Property to check if set.
|
||||
* @return bool Whether the property is set.
|
||||
*/
|
||||
public function __isset( $name ) {
|
||||
return isset( $this->$name );
|
||||
}
|
||||
|
||||
/**
|
||||
* Make private properties un-settable for backwards compatibility.
|
||||
*
|
||||
* @since 4.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param string $name Property to unset.
|
||||
*/
|
||||
public function __unset( $name ) {
|
||||
unset( $this->$name );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all error codes.
|
||||
*
|
||||
@@ -242,6 +187,21 @@ class WP_Error {
|
||||
|
||||
$this->error_data[$code] = $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 ] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,8 +214,6 @@ class WP_Error {
|
||||
* @param mixed $thing Check if unknown variable is a WP_Error object.
|
||||
* @return bool True, if WP_Error. False, if not WP_Error.
|
||||
*/
|
||||
function is_wp_error($thing) {
|
||||
if ( is_object($thing) && is_a($thing, 'WP_Error') )
|
||||
return true;
|
||||
return false;
|
||||
function is_wp_error( $thing ) {
|
||||
return ( $thing instanceof WP_Error );
|
||||
}
|
||||
Reference in new issue
Block a user