ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules 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

◆ checkNativeSupport()

static ilJsonUtil::checkNativeSupport ( )
static

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

43  {
44  return function_exists('json_encode') && function_exists('json_decode');
45  }

◆ 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().

29  {
30  if (!$suppress_native && self::checkNativeSupport())
31  {
32  return json_decode($json_notated_string);
33  }
34  else
35  {
36  include_once './Services/JSON/include/json.php';
38  return $json->decode($json_notated_string);
39  }
40  }
const SERVICES_JSON_SUPPRESS_ERRORS
Behavior switch for Services_JSON::decode()
Definition: JSON.php:92
+ Here is the caller graph for this function:

◆ encode()

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

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

References SERVICES_JSON_SUPPRESS_ERRORS.

Referenced by ilTermsOfServiceJsonResponse\__toString(), ilCloudPluginFileTreeGUI\addDropZone(), ilCloudPluginCreateFolderGUI\asyncCreateFolder(), ilCloudPluginDeleteGUI\asyncDeleteItem(), ilObjCloudGUI\asyncGetBlock(), ilCloudPluginUploadGUI\asyncUploadFile(), ilCloudPluginDeleteGUI\cancel(), ilCloudPluginCreateFolderGUI\createFolder(), ilCloudPluginDeleteGUI\deleteItem(), ilPublicUserProfileGUI\doProfileAutoComplete(), ilAccountRegistrationGUI\doProfileAutoComplete(), ilRepositorySearchGUI\doUserAutoComplete(), ilObjForumGUI\fetchTreeChildrenAsyncObject(), ilForumExplorer\fillTreeTemplate(), ilChatroomBlockGUI\getChatroomSelectionList(), ilFileUploadGUI\getHTML(), ilAccordionGUI\getHTML(), ilAdvancedSelectionListGUI\getHTML(), ilDataSet\getJsonRepresentation(), ilRoleAutoComplete\getList(), ilSearchAutoComplete\getList(), ilRoleAutoComplete\getListByObject(), ilSearchAutoComplete\getLuceneList(), ilOverlayGUI\getOnLoadCode(), ilPreviewGUI\getPreviewHTML(), ilPreviewGUI\initPreview(), ilWikiPageGUI\insertWikiLinkAC(), ilMDEditorGUI\keywordAutocomplete(), ilBlogPostingGUI\keywordAutocomplete(), ilMailAddressbookGUI\lookupAddressbookAsync(), ilMailAddressbookGUI\lookupEmailsAsync(), ilMailSearchGUI\lookupRecipientAsync(), ilMailFormGUI\lookupRecipientAsync(), ilMailAddressbookGUI\lookupUsersAsync(), ilUserAutoComplete\setResultField(), ilCloudPluginUploadGUI\uploadFiles(), and ilObjFileGUI\uploadFiles().

15  {
16  if (!$suppress_native && self::checkNativeSupport())
17  {
18  return json_encode($mixed);
19  }
20  else
21  {
22  include_once './Services/JSON/include/json.php';
24  return $json->encode($mixed);
25  }
26  }
const SERVICES_JSON_SUPPRESS_ERRORS
Behavior switch for Services_JSON::decode()
Definition: JSON.php:92
+ Here is the caller graph for this function:

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