]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/class-wp-error.php
WordPress 4.7.2-scripts
[autoinstalls/wordpress.git] / wp-includes / class-wp-error.php
index cee2affb991696a2bd925b5238fe6fe0dc36c70f..22273f89b23fd649604d5166914187c49e37246b 100644 (file)
@@ -11,8 +11,8 @@
  * WordPress Error class.
  *
  * Container for checking for WordPress errors and error messages. Return
- * WP_Error and use {@link is_wp_error()} to check if this class is returned.
- * Many core WordPress functions pass this class in the event of an error and
+ * 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.
  *
  * @package WordPress
@@ -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.
         *
@@ -199,7 +144,7 @@ class WP_Error {
         * @since 2.1.0
         *
         * @param string|int $code Optional. Error code.
-        * @return mixed Null, if no errors.
+        * @return mixed Error data, if it exists.
         */
        public function get_error_data($code = '') {
                if ( empty($code) )
@@ -207,7 +152,6 @@ class WP_Error {
 
                if ( isset($this->error_data[$code]) )
                        return $this->error_data[$code];
-               return null;
        }
 
        /**
@@ -258,19 +202,3 @@ class WP_Error {
                unset( $this->error_data[ $code ] );
        }
 }
-
-/**
- * Check whether variable is a WordPress Error.
- *
- * Returns true if $thing is an object of the WP_Error class.
- *
- * @since 2.1.0
- *
- * @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;
-}