|
@@ 3198-3209 (lines=12) @@
|
| 3195 |
|
* <i>json</i> cannot be decoded or if the encoded |
| 3196 |
|
* data is deeper than the recursion limit. |
| 3197 |
|
*/ |
| 3198 |
|
public static function json_decode($json, $assoc = false, $depth = 512, $options = 0) |
| 3199 |
|
{ |
| 3200 |
|
$json = (string)self::filter($json); |
| 3201 |
|
|
| 3202 |
|
if (Bootup::is_php('5.4') === true) { |
| 3203 |
|
$json = json_decode($json, $assoc, $depth, $options); |
| 3204 |
|
} else { |
| 3205 |
|
$json = json_decode($json, $assoc, $depth); |
| 3206 |
|
} |
| 3207 |
|
|
| 3208 |
|
return $json; |
| 3209 |
|
} |
| 3210 |
|
|
| 3211 |
|
/** |
| 3212 |
|
* (PHP 5 >= 5.2.0, PECL json >= 1.2.0)<br/> |
|
@@ 3247-3258 (lines=12) @@
|
| 3244 |
|
* |
| 3245 |
|
* @return string a JSON encoded string on success or <b>FALSE</b> on failure. |
| 3246 |
|
*/ |
| 3247 |
|
public static function json_encode($value, $options = 0, $depth = 512) |
| 3248 |
|
{ |
| 3249 |
|
$value = self::filter($value); |
| 3250 |
|
|
| 3251 |
|
if (Bootup::is_php('5.5') === true) { |
| 3252 |
|
$json = json_encode($value, $options, $depth); |
| 3253 |
|
} else { |
| 3254 |
|
$json = json_encode($value, $options); |
| 3255 |
|
} |
| 3256 |
|
|
| 3257 |
|
return $json; |
| 3258 |
|
} |
| 3259 |
|
|
| 3260 |
|
/** |
| 3261 |
|
* Makes string's first char lowercase. |