| @@ -2,14 +2,12 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Renders a JSON of records. |
| 4 | 4 | * |
| 5 | 5 | * @package WP_Stream |
| 6 | - * | |
| 7 | - * @var $records | |
| 8 | 6 | */ |
| 9 | 7 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 11 | - exit; | |
| 8 | +header( 'Content-type: application/json; charset=' . get_option( 'blog_charset' ), true ); | |
| 9 | +if ( version_compare( PHP_VERSION, '5.4', '<' ) ) { | |
| 10 | + echo wp_stream_json_encode( $records ); // xss ok. | |
| 11 | +} else { | |
| 12 | + echo wp_stream_json_encode( $records, JSON_PRETTY_PRINT ); // xss ok. | |
| 12 | 13 | } |
| 13 | - | |
| 14 | -header( 'Content-type: application/json; charset=' . get_option( 'blog_charset' ), true ); | |
| 15 | -echo wp_json_encode( $records, JSON_PRETTY_PRINT ); | |