iTx Technologies offre gratuitement
cet espace pour SugarCRM !

title

Body

[fermer]

/include/ -> JSON.php (sommaire)

Converts to and from JSON format. JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. This feature can also be found in  Python. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, TCL, and many others. These properties make JSON an ideal data-interchange language.

Author: Michal Migurski <mike-json@teczno.com>
Author: Matt Knapp
Author: Brett Stimmerman
Copyright: 2005 Michal Migurski
License: http://www.opensource.org/licenses/bsd-license.php
Taille du fichier: 879 lignes (38 kb)
Inclus ou requis: 18 fois
Réferencé: 0 fois
Inclus ou requis: 0 fichiers

Définit la class 3 classes

JSON:: (10 methods):
  JSON()
  utf162utf8()
  utf82utf16()
  encode()
  encodeReal()
  name_value()
  reduce_string()
  decode()
  decodeReal()
  isError()

JSON_Error:: (2 methods):
  JSON_Error()
  JSON_Error()

JSON_Error:: (2 methods):
  JSON_Error()
  JSON_Error()


Classe: JSON  - X-Ref

Behavior switch for JSON::decode()

JSON($use = 0)   X-Ref
constructs a new JSON instance

param: int     $use    object behavior flags; combine with boolean-OR

utf162utf8($utf16)   X-Ref
convert a string from one UTF-16 char to one UTF-8 char

Normally should be handled by mb_convert_encoding, but
provides a slower PHP-only method for installations
that lack the multibye string extension.

param: string  $utf16  UTF-16 character
return: string  UTF-8 character

utf82utf16($utf8)   X-Ref
convert a string from one UTF-8 char to one UTF-16 char

Normally should be handled by mb_convert_encoding, but
provides a slower PHP-only method for installations
that lack the multibye string extension.

param: string  $utf8   UTF-8 character
return: string  UTF-16 character

encode($var, $addSecurityEnvelope=false)   X-Ref
Wrapper for original "encode()" method - allows the creation of a security envelope

param: mixed var Variable to be JSON encoded
param: bool addSecurityEnvelope Default false

encodeReal($var)   X-Ref
encodes an arbitrary variable into JSON format

param: mixed   $var    any number, boolean, string, array, or object to be encoded.
return: mixed   JSON string representation of input var or an error if a problem occurs

name_value($name, $value)   X-Ref
array-walking function for use in generating JSON-formatted name-value pairs

param: string  $name   name of key to use
param: mixed   $value  reference to an array element to be encoded
return: string  JSON-formatted name-value pair, like '"name":value'

reduce_string($str)   X-Ref
reduce a string by removing leading and trailing comments and whitespace

param: $str    string      string value to strip of comments and whitespace
return: string  string value stripped of comments and whitespace

decode($str, $examineEnvelope=false)   X-Ref
Wrapper for decodeReal() - examines security envelope and if good, continues with expected behavior

param: strings $str JSON encoded object from client
param: bool $examineEnvelope Default false, true to extract and verify envelope
return: mixed

decodeReal($str)   X-Ref
decodes a JSON string into appropriate variable

param: string  $str    JSON-formatted string
return: mixed   number, boolean, string, array, or object

isError($data, $code = null)   X-Ref


Classe: JSON_Error  - X-Ref

JSON_Error($message = 'unknown error', $code = null,$mode = null, $options = null, $userinfo = null)   X-Ref
Aucune description

JSON_Error($message = 'unknown error', $code = null,$mode = null, $options = null, $userinfo = null)   X-Ref
Aucune description

Classe: JSON_Error  - X-Ref


JSON_Error($message = 'unknown error', $code = null,$mode = null, $options = null, $userinfo = null)   X-Ref
Aucune description

JSON_Error($message = 'unknown error', $code = null,$mode = null, $options = null, $userinfo = null)   X-Ref
Aucune description



Generé en: Thu Mar 4 09:44:50 2010 | Cross-referenced par PHPXref 0.7