wp/wp-includes/class-json.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
     1 <?php
     1 <?php
     2 _deprecated_file( basename( __FILE__ ), '5.3.0', null, 'The PHP native JSON extension is now a requirement.' );
     2 _deprecated_file( basename( __FILE__ ), '5.3.0', '', 'The PHP native JSON extension is now a requirement.' );
     3 
     3 
     4 if ( ! class_exists( 'Services_JSON' ) ) :
     4 if ( ! class_exists( 'Services_JSON' ) ) :
     5 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
     5 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
     6 /**
     6 /**
     7  * Converts to and from JSON format.
     7  * Converts to and from JSON format.
   577 
   577 
   578         if(Services_JSON::isError($encoded_value)) {
   578         if(Services_JSON::isError($encoded_value)) {
   579             return $encoded_value;
   579             return $encoded_value;
   580         }
   580         }
   581 
   581 
   582         return $this->_encode(strval($name)) . ':' . $encoded_value;
   582         return $this->_encode((string) $name) . ':' . $encoded_value;
   583     }
   583     }
   584 
   584 
   585    /**
   585    /**
   586     * reduce a string by removing leading and trailing comments and whitespace
   586     * reduce a string by removing leading and trailing comments and whitespace
   587     *
   587     *
   916     {
   916     {
   917         _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' );
   917         _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' );
   918 
   918 
   919         if (class_exists('pear')) {
   919         if (class_exists('pear')) {
   920             return PEAR::isError($data, $code);
   920             return PEAR::isError($data, $code);
   921         } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
   921         } elseif (is_object($data) && ($data instanceof services_json_error ||
   922                                  is_subclass_of($data, 'services_json_error'))) {
   922                                  is_subclass_of($data, 'services_json_error'))) {
   923             return true;
   923             return true;
   924         }
   924         }
   925 
   925 
   926         return false;
   926         return false;