X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FJSON.php;h=adb349fb900ecbe40bda112f5839d95a0a751fb7;hb=cda772aae0c600de9033d3360dfde772a2a78f64;hp=d25c77f588d5e8e39fefc04b1519bab6ba019db4;hpb=ef10e0b52408ba266239a859756d757a10348228;p=civicrm-core.git diff --git a/CRM/Utils/JSON.php b/CRM/Utils/JSON.php index d25c77f588..adb349fb90 100644 --- a/CRM/Utils/JSON.php +++ b/CRM/Utils/JSON.php @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ /** * @@ -39,7 +39,7 @@ class CRM_Utils_JSON { /** - * Output json to the client + * Output json to the client. * @param mixed $input */ public static function output($input) { @@ -49,15 +49,17 @@ class CRM_Utils_JSON { } /** - * Create JSON object + * Create JSON object. * @deprecated * - * @param array $params associated array, that needs to be + * @param array $params + * Associated array, that needs to be. * converted to JSON array - * @param string $identifier identifier for the JSON array + * @param string $identifier + * Identifier for the JSON array. * - * @return string $jsonObject JSON array - * @static + * @return string + * JSON array */ public static function encode($params, $identifier = 'id') { $buildObject = array(); @@ -74,12 +76,16 @@ class CRM_Utils_JSON { /** * Encode json format for flexigrid, NOTE: "id" should be present in $params for each row * - * @param array $params associated array of values rows - * @param int $page page no for selector + * @param array $params + * Associated array of values rows. + * @param int $page + * Page no for selector. * @param $total - * @param array $selectorElements selector rows + * @param array $selectorElements + * Selector rows. * - * @return json encode string + * @return string + * json encoded string */ public static function encodeSelector(&$params, $page, $total, $selectorElements) { $json = ""; @@ -115,15 +121,19 @@ class CRM_Utils_JSON { } /** - * This function is used to encode data for dataTable plugin + * encode data for dataTable plugin. * - * @param array $params associated array of row elements - * @param int $sEcho datatable needs this to make it more secure - * @param int $iTotal total records - * @param int $iFilteredTotal total records on a page - * @param array $selectorElements selector elements + * @param array $params + * Associated array of row elements. + * @param int $sEcho + * Datatable needs this to make it more secure. + * @param int $iTotal + * Total records. + * @param int $iFilteredTotal + * Total records on a page. + * @param array $selectorElements + * Selector elements. * @return string - * */ public static function encodeDataTableSelector($params, $sEcho, $iTotal, $iFilteredTotal, $selectorElements) { $sOutput = '{'; @@ -144,7 +154,7 @@ class CRM_Utils_JSON { $sOutput .= '"' . addcslashes(str_replace(array("\r\n", "\n", "\r"), '
', $value[$element]), '"\\') . '"'; //remove extra spaces and tab character that breaks dataTable CRM-12551 - $sOutput = preg_replace("/\s+/", " ", $sOutput); + $sOutput = preg_replace("/\s+/", " ", $sOutput); $addcomma = TRUE; } $sOutput .= "],"; @@ -154,4 +164,5 @@ class CRM_Utils_JSON { return $sOutput; } + }