|
@@ 3254-3265 (lines=12) @@
|
| 3251 |
|
* <i>json</i> cannot be decoded or if the encoded |
| 3252 |
|
* data is deeper than the recursion limit. |
| 3253 |
|
*/ |
| 3254 |
|
public static function json_decode($json, $assoc = false, $depth = 512, $options = 0) |
| 3255 |
|
{ |
| 3256 |
|
$json = (string)self::filter($json); |
| 3257 |
|
|
| 3258 |
|
if (Bootup::is_php('5.4') === true) { |
| 3259 |
|
$json = json_decode($json, $assoc, $depth, $options); |
| 3260 |
|
} else { |
| 3261 |
|
$json = json_decode($json, $assoc, $depth); |
| 3262 |
|
} |
| 3263 |
|
|
| 3264 |
|
return $json; |
| 3265 |
|
} |
| 3266 |
|
|
| 3267 |
|
/** |
| 3268 |
|
* (PHP 5 >= 5.2.0, PECL json >= 1.2.0)<br/> |
|
@@ 3303-3314 (lines=12) @@
|
| 3300 |
|
* |
| 3301 |
|
* @return string a JSON encoded string on success or <b>FALSE</b> on failure. |
| 3302 |
|
*/ |
| 3303 |
|
public static function json_encode($value, $options = 0, $depth = 512) |
| 3304 |
|
{ |
| 3305 |
|
$value = self::filter($value); |
| 3306 |
|
|
| 3307 |
|
if (Bootup::is_php('5.5') === true) { |
| 3308 |
|
$json = json_encode($value, $options, $depth); |
| 3309 |
|
} else { |
| 3310 |
|
$json = json_encode($value, $options); |
| 3311 |
|
} |
| 3312 |
|
|
| 3313 |
|
return $json; |
| 3314 |
|
} |
| 3315 |
|
|
| 3316 |
|
/** |
| 3317 |
|
* Makes string's first char lowercase. |