|
@@ 3300-3311 (lines=12) @@
|
| 3297 |
|
* <i>json</i> cannot be decoded or if the encoded |
| 3298 |
|
* data is deeper than the recursion limit. |
| 3299 |
|
*/ |
| 3300 |
|
public static function json_decode($json, $assoc = false, $depth = 512, $options = 0) |
| 3301 |
|
{ |
| 3302 |
|
$json = (string)self::filter($json); |
| 3303 |
|
|
| 3304 |
|
if (Bootup::is_php('5.4') === true) { |
| 3305 |
|
$json = json_decode($json, $assoc, $depth, $options); |
| 3306 |
|
} else { |
| 3307 |
|
$json = json_decode($json, $assoc, $depth); |
| 3308 |
|
} |
| 3309 |
|
|
| 3310 |
|
return $json; |
| 3311 |
|
} |
| 3312 |
|
|
| 3313 |
|
/** |
| 3314 |
|
* (PHP 5 >= 5.2.0, PECL json >= 1.2.0)<br/> |
|
@@ 3349-3360 (lines=12) @@
|
| 3346 |
|
* |
| 3347 |
|
* @return string a JSON encoded string on success or <b>FALSE</b> on failure. |
| 3348 |
|
*/ |
| 3349 |
|
public static function json_encode($value, $options = 0, $depth = 512) |
| 3350 |
|
{ |
| 3351 |
|
$value = self::filter($value); |
| 3352 |
|
|
| 3353 |
|
if (Bootup::is_php('5.5') === true) { |
| 3354 |
|
$json = json_encode($value, $options, $depth); |
| 3355 |
|
} else { |
| 3356 |
|
$json = json_encode($value, $options); |
| 3357 |
|
} |
| 3358 |
|
|
| 3359 |
|
return $json; |
| 3360 |
|
} |
| 3361 |
|
|
| 3362 |
|
/** |
| 3363 |
|
* Makes string's first char lowercase. |