dolibarr  7.0.0-beta
Functions
json.lib.php File Reference

Functions to emulate json function when there were not activated. More...

Go to the source code of this file.

Functions

if(!function_exists('json_encode')) dol_json_encode ($elements)
 Implement json_encode for PHP that does not support it. More...
 
 _val ($val)
 Return text according to type. More...
 
if(!function_exists('json_decode')) dol_json_decode ($json, $assoc=false)
 Implement json_decode for PHP that does not support it. More...
 
 _unval ($val)
 Return text according to type. More...
 
 utf162utf8 ($utf16)
 Convert a string from one UTF-16 char to one UTF-8 char. More...
 
 utf82utf16 ($utf8)
 Convert a string from one UTF-8 char to one UTF-16 char. More...
 

Detailed Description

Functions to emulate json function when there were not activated.

Definition in file json.lib.php.

Function Documentation

_unval (   $val)

Return text according to type.

Parameters
string$valValue to decode
Returns
string Formated value

Definition at line 286 of file json.lib.php.

References utf162utf8().

Referenced by dol_json_decode().

_val (   $val)

Return text according to type.

Parameters
mixed$valValue to show
Returns
string Formated value

Implement json_decode for PHP that does not support it

Parameters
string$jsonJson encoded to PHP Object or Array
bool$assocFalse return an object, true return an array
Returns
mixed Object or Array

Definition at line 107 of file json.lib.php.

References utf82utf16().

Referenced by dol_json_encode().

if (!function_exists('json_decode')) dol_json_decode (   $json,
  $assoc = false 
)

Implement json_decode for PHP that does not support it.

Parameters
string$jsonJson encoded to PHP Object or Array
bool$assocFalse return an object, true return an array. Try to always use it with true !
Returns
mixed Object or Array or false on error
See also
json_decode()

Definition at line 230 of file json.lib.php.

References _unval(), and dol_syslog().

if (!function_exists('json_encode')) dol_json_encode (   $elements)

Implement json_encode for PHP that does not support it.

Parameters
mixed$elementsPHP Object to json encode
Returns
string Json encoded string
See also
json_encode()

Definition at line 47 of file json.lib.php.

References _val(), and dol_syslog().

utf162utf8 (   $utf16)

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.

Parameters
string$utf16UTF-16 character
Returns
string UTF-8 character

Definition at line 308 of file json.lib.php.

Referenced by _unval().

utf82utf16 (   $utf8)

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.

Parameters
string$utf8UTF-8 character
Returns
string UTF-16 character

Definition at line 351 of file json.lib.php.

Referenced by _val().