]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/class-wp-error.php
WordPress 4.3-scripts
[autoinstalls/wordpress.git] / wp-includes / class-wp-error.php
index cee2affb991696a2bd925b5238fe6fe0dc36c70f..0969b12e33aa7a1f2f213982cd5f9eac514a66bb 100644 (file)
@@ -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;
        }
 
        /**
@@ -269,8 +213,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 );
 }