ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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.

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

References SERVICES_JSON_SUPPRESS_ERRORS.

Referenced by ilPageQuestionProcessor\saveQuestionAnswer().

+ 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.

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 }

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(), ilAccountRegistrationGUI\doProfileAutoComplete(), ilPublicUserProfileGUI\doProfileAutoComplete(), ilRepositorySearchGUI\doUserAutoComplete(), ilObjForumGUI\fetchTreeChildrenAsyncObject(), ilStudyProgrammeExpandableProgressListGUI\fillTemplate(), ilForumExplorer\fillTreeTemplate(), ilChatroomBlockGUI\getChatroomSelectionList(), ilAdvancedSelectionListGUI\getHTML(), ilAccordionGUI\getHTML(), ilFileUploadGUI\getHTML(), ilDataSet\getJsonRepresentation(), ilRoleAutoComplete\getList(), ilSearchAutoComplete\getList(), ilRoleAutoComplete\getListByObject(), ilSearchAutoComplete\getLuceneList(), ilOverlayGUI\getOnLoadCode(), ilPreviewGUI\getPreviewHTML(), ilMailFormGUI\getTemplateDataById(), ilObjWikiGUI\getUserHTMLExportProgressObject(), ilPreviewGUI\initPreview(), ilWikiPageGUI\insertWikiLinkAC(), ilBlogPostingGUI\keywordAutocomplete(), ilMDEditorGUI\keywordAutocomplete(), ilMailSearchGUI\lookupRecipientAsync(), ilMailFormGUI\lookupRecipientAsync(), ilMailTemplateSelectInputGUI\render(), ilLanguage\toJSMap(), ilCloudPluginUploadGUI\uploadFiles(), and ilObjFileGUI\uploadFiles().

+ Here is the caller graph for this function:

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