ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilJsonUtil Class Reference

JSON (Javascript Object Notation) functions with backward compatibility for PHP version < 5.2. More...

+ Collaboration diagram for ilJsonUtil:

Static Public Member Functions

static encode ($mixed, $suppress_native=false)
static decode ($json_notated_string, $suppress_native=false)
static checkNativeSupport ()

Detailed Description

JSON (Javascript Object Notation) functions with backward compatibility for PHP version < 5.2.

Author
Jan Posselt jposs.nosp@m.elt@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
$Id$

Definition at line 12 of file class.ilJsonUtil.php.

Member Function Documentation

static ilJsonUtil::checkNativeSupport ( )
static

Definition at line 42 of file class.ilJsonUtil.php.

{
return function_exists('json_encode') && function_exists('json_decode');
}
static ilJsonUtil::decode (   $json_notated_string,
  $suppress_native = false 
)
static

Definition at line 28 of file class.ilJsonUtil.php.

References SERVICES_JSON_SUPPRESS_ERRORS.

Referenced by ilPageQuestionProcessor\saveQuestionAnswer().

{
if (!$suppress_native && self::checkNativeSupport())
{
return json_decode($json_notated_string);
}
else
{
include_once './Services/JSON/include/json.php';
return $json->decode($json_notated_string);
}
}

+ Here is the caller graph for this function:

static ilJsonUtil::encode (   $mixed,
  $suppress_native = false 
)
static

Definition at line 14 of file class.ilJsonUtil.php.

References SERVICES_JSON_SUPPRESS_ERRORS.

Referenced by ilAdvancedSelectionListGUI\getHTML(), ilDataSet\getJsonRepresentation(), ilRoleAutoComplete\getList(), ilUserAutoComplete\getList(), ilSearchAutoComplete\getList(), ilRoleAutoComplete\getListByObject(), ilOverlayGUI\getOnLoadCode(), ilMailAddressbookGUI\lookupAddressbookAsync(), ilMailFormGUI\lookupRecipientAsync(), and ilTextInputGUI\render().

{
if (!$suppress_native && self::checkNativeSupport())
{
return json_encode($mixed);
}
else
{
include_once './Services/JSON/include/json.php';
return $json->encode($mixed);
}
}

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: