Zend Framework
1.12
|
Static Public Member Functions | |
static | encode ($value, $cycleCheck=false, $options=array()) |
Use the JSON encoding scheme for the value specified. | |
static | encodeClass ($className, $package= '') |
Encodes the given $className into the class2 model of encoding PHP classes into JavaScript class2 classes. | |
static | encodeClasses (array $classNames, $package= '') |
Encode several classes at once. | |
static | encodeUnicodeString ($value) |
Encode Unicode Characters to ASCII syntax. | |
Protected Member Functions | |
__construct ($cycleCheck=false, $options=array()) | |
Constructor. | |
_encodeValue (&$value) | |
Recursive driver which determines the type of value to be encoded and then dispatches to the appropriate method. | |
_encodeObject (&$value) | |
Encode an object to JSON by encoding each of the public properties. | |
_wasVisited (&$value) | |
Determine if an object has been serialized already. | |
_encodeArray (&$array) | |
JSON encode an array value. | |
_encodeDatum (&$value) | |
JSON encode a basic data type (string, number, boolean, null) | |
_encodeString (&$string) | |
JSON encode a string value by escaping characters as necessary. | |
Static Protected Member Functions | |
static | _utf82utf16 ($utf8) |
Convert a string from one UTF-8 char to one UTF-16 char. | |
Protected Attributes | |
$_cycleCheck | |
$_options = array() | |
$_visited = array() | |
|
protected |
Constructor.
boolean | $cycleCheck | Whether or not to check for recursion when encoding |
array | $options | Additional options used during encoding |
|
protected |
JSON encode an array value.
Recursively encodes each value of an array and returns a JSON encoded array string.
Arrays are defined as integer-indexed arrays starting at index 0, where the last index is (count($array) -1); any deviation from that is considered an associative array, and will be encoded as such.
array& | $array |
|
protected |
JSON encode a basic data type (string, number, boolean, null)
If value type is not a string, number, boolean, or null, the string 'null' is returned.
mixed& | $value |
|
protected |
Encode an object to JSON by encoding each of the public properties.
A special property is added to the JSON object called '__className' that contains the name of the class of $value. This is used to decode the object on the client into a specific class.
object | $value |
Zend_Json_Exception | If recursive checks are enabled and the object has been serialized previously |
|
protected |
JSON encode a string value by escaping characters as necessary.
string& | $value |
|
protected |
Recursive driver which determines the type of value to be encoded and then dispatches to the appropriate method.
$values are either
mixed | $value | The value to be encoded |
|
staticprotected |
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.
This method is from the Solar Framework by Paul M. Jones
|
protected |
Determine if an object has been serialized already.
mixed | $value |
|
static |
Use the JSON encoding scheme for the value specified.
mixed | $value | The value to be encoded |
boolean | $cycleCheck | Whether or not to check for possible object recursion when encoding |
array | $options | Additional options used during encoding |
|
static |
Encodes the given $className into the class2 model of encoding PHP classes into JavaScript class2 classes.
NOTE: Currently only public methods and variables are proxied onto the client machine
string | $className | The name of the class, the class must be instantiable using a null constructor |
string | $package | Optional package name appended to JavaScript proxy class name |
Zend_Json_Exception |
|
static |
Encode several classes at once.
Returns JSON encoded classes, using encodeClass().
array | $classNames | |
string | $package |
|
static |
Encode Unicode Characters to ASCII syntax.
This algorithm was originally developed for the Solar Framework by Paul M. Jones
http://svn.solarphp.com/core/trunk/Solar/Json.php string $value string
Iterate over every character in the string, escaping with a slash or encoding to UTF-8 where necessary
|
protected |
|
protected |
|
protected |