CRM_Utils_JSON
in package
Class handles functions for JSON format
Table of Contents
Methods
- encodeDataTableSelector() : string
- Do not use this function. See CRM-16353.
- encodeScriptVar() : int|string
- Safely encodes a variable that will be printed inside a `<script>` tag.
- isValidJSON() : bool
- Test whether the input string is valid JSON.
- output() : mixed
- Output json to the client.
Methods
encodeDataTableSelector()
Do not use this function. See CRM-16353.
public
static encodeDataTableSelector(array<string|int, mixed> $params, int $sEcho, int $iTotal, int $iFilteredTotal, array<string|int, mixed> $selectorElements) : string
Parameters
- $params : array<string|int, mixed>
-
Associated array of row elements.
- $sEcho : int
-
Datatable needs this to make it more secure.
- $iTotal : int
-
Total records.
- $iFilteredTotal : int
-
Total records on a page.
- $selectorElements : array<string|int, mixed>
-
Selector elements.
Return values
stringencodeScriptVar()
Safely encodes a variable that will be printed inside a `<script>` tag.
public
static encodeScriptVar(mixed $input) : int|string
See https://lab.civicrm.org/dev/core/-/issues/6080
Parameters
- $input : mixed
Return values
int|stringisValidJSON()
Test whether the input string is valid JSON.
public
static isValidJSON(string $str) : bool
Parameters
- $str : string
Return values
booloutput()
Output json to the client.
public
static output(mixed $input) : mixed
- use CRM_Utils_System::sendJSONResponse
Parameters
- $input : mixed