Define `JSON_PRETTY_PRINT` so it can be used with `wp_json_encode()`

* `JSON_PRETTY_PRINT` was introduced in PHP 5.4
* Now you can use it with lower PHP versions, without a notice

fixes #30139
see #28786

git-svn-id: https://develop.svn.wordpress.org/trunk@30075 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2014-10-28 21:12:10 +00:00
parent efb9cd0cc5
commit 52151956ea
1 changed files with 7 additions and 1 deletions

View File

@ -122,4 +122,10 @@ function hash_equals( $a, $b ) {
return $result === 0;
}
endif;
endif;
// JSON_PRETTY_PRINT was introduced in PHP 5.4
// Defined here to prevent a notice when using it with wp_json_encode()
if ( ! defined( 'JSON_PRETTY_PRINT' ) ) {
define( 'JSON_PRETTY_PRINT', 128 );
}