|
@@ 3269-3280 (lines=12) @@
|
| 3266 |
|
* <i>json</i> cannot be decoded or if the encoded |
| 3267 |
|
* data is deeper than the recursion limit. |
| 3268 |
|
*/ |
| 3269 |
|
public static function json_decode($json, $assoc = false, $depth = 512, $options = 0) |
| 3270 |
|
{ |
| 3271 |
|
$json = (string)self::filter($json); |
| 3272 |
|
|
| 3273 |
|
if (Bootup::is_php('5.4') === true) { |
| 3274 |
|
$json = json_decode($json, $assoc, $depth, $options); |
| 3275 |
|
} else { |
| 3276 |
|
$json = json_decode($json, $assoc, $depth); |
| 3277 |
|
} |
| 3278 |
|
|
| 3279 |
|
return $json; |
| 3280 |
|
} |
| 3281 |
|
|
| 3282 |
|
/** |
| 3283 |
|
* (PHP 5 >= 5.2.0, PECL json >= 1.2.0)<br/> |
|
@@ 3318-3329 (lines=12) @@
|
| 3315 |
|
* |
| 3316 |
|
* @return string a JSON encoded string on success or <b>FALSE</b> on failure. |
| 3317 |
|
*/ |
| 3318 |
|
public static function json_encode($value, $options = 0, $depth = 512) |
| 3319 |
|
{ |
| 3320 |
|
$value = self::filter($value); |
| 3321 |
|
|
| 3322 |
|
if (Bootup::is_php('5.5') === true) { |
| 3323 |
|
$json = json_encode($value, $options, $depth); |
| 3324 |
|
} else { |
| 3325 |
|
$json = json_encode($value, $options); |
| 3326 |
|
} |
| 3327 |
|
|
| 3328 |
|
return $json; |
| 3329 |
|
} |
| 3330 |
|
|
| 3331 |
|
/** |
| 3332 |
|
* Makes string's first char lowercase. |