X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjson%2FFormatJson.php;h=75da5c7e729680244162b56b0062c12187c50e1c;hb=88066420004931111290ed42ce9ee8f6e3a76c90;hp=f67700c94ffd0d751abbb43b9e0c64377a6780d5;hpb=bceb90ceedc4f8256bad231311bd59a0bb4f2a4e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/json/FormatJson.php b/includes/json/FormatJson.php index f67700c94f..75da5c7e72 100644 --- a/includes/json/FormatJson.php +++ b/includes/json/FormatJson.php @@ -31,21 +31,16 @@ class FormatJson { * Returns the JSON representation of a value. * * @param $value Mixed: the value being encoded. Can be any type except a resource. - * @param $isHtml Boolean - * - * @todo FIXME: "$isHtml" parameter's purpose is not documented. It appears to - * map to a parameter labeled "pretty-print output with indents and - * newlines" in Services_JSON::encode(), which has no string relation - * to HTML output. + * @param $pretty Boolean: If true, adds non-significant whitespace to improve readability. * * @return string */ - public static function encode( $value, $isHtml = false ) { - if ( !function_exists( 'json_encode' ) || ( $isHtml && version_compare( PHP_VERSION, '5.4.0', '<' ) ) ) { + public static function encode( $value, $pretty = false ) { + if ( !function_exists( 'json_encode' ) || ( $pretty && version_compare( PHP_VERSION, '5.4.0', '<' ) ) ) { $json = new Services_JSON(); - return $json->encode( $value, $isHtml ); + return $json->encode( $value, $pretty ); } else { - return json_encode( $value, $isHtml ? JSON_PRETTY_PRINT : 0 ); + return json_encode( $value, $pretty ? JSON_PRETTY_PRINT : 0 ); } }