From fe72845c8284804f3df2546017a9426b94e537cd Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 11 Aug 2010 12:42:40 +0000 Subject: [PATCH] Boolean parameters suck, but we can make them suck less by adding constants you can use. Also doc, spacing, etc --- includes/json/FormatJson.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/includes/json/FormatJson.php b/includes/json/FormatJson.php index cacf6680fc..f33bc6235b 100644 --- a/includes/json/FormatJson.php +++ b/includes/json/FormatJson.php @@ -1,12 +1,24 @@ + */ public static function encode( $value, $isHtml = false ) { // Some versions of PHP have a broken json_encode, see PHP bug // 46944. Test encoding an affected character (U+20000) to @@ -19,6 +31,12 @@ class FormatJson { } } + /** + * Decode some JSON into an array or object + * @param $value String of Json + * @param $assoc bool One of AS_OBJECT or AS_ARRAY to specify return type + * @return Array or Object + */ public static function decode( $value, $assoc = false ) { if ( !function_exists( 'json_decode' ) ) { $json = new Services_JSON(); -- 2.20.1