diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index e3f2560..c6a8b39 100644
|
|
|
function _ajax_wp_die_handler( $message, $title = '', $args = array() ) { |
| 2875 | 2875 | ); |
| 2876 | 2876 | $r = wp_parse_args( $args, $defaults ); |
| 2877 | 2877 | |
| 2878 | | if ( ! headers_sent() ) { |
| | 2878 | if ( ! headers_sent() && ( 0 === ob_get_level() || 0 === ob_get_length() ) ) { |
| 2879 | 2879 | status_header( $r['response'] ); |
| 2880 | 2880 | } |
| 2881 | 2881 | if ( is_scalar( $message ) ) |
| … |
… |
function _wp_json_prepare_data( $data ) { |
| 3100 | 3100 | * then print and die. |
| 3101 | 3101 | * @param int $status_code The HTTP status code to output. |
| 3102 | 3102 | */ |
| 3103 | | function wp_send_json( $response, $status_code = 200 ) { |
| | 3103 | function wp_send_json( $response, $status_code = null ) { |
| 3104 | 3104 | @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); |
| 3105 | | status_header( $status_code ); |
| | 3105 | if ( null !== $status_code ) { |
| | 3106 | status_header( $status_code ); |
| | 3107 | } |
| 3106 | 3108 | echo wp_json_encode( $response ); |
| 3107 | 3109 | if ( wp_doing_ajax() ) |
| 3108 | 3110 | wp_die(); |
| … |
… |
function wp_send_json( $response, $status_code = 200 ) { |
| 3119 | 3121 | * @param mixed $data Data to encode as JSON, then print and die. |
| 3120 | 3122 | * @param int $status_code The HTTP status code to output. |
| 3121 | 3123 | */ |
| 3122 | | function wp_send_json_success( $data = null, $status_code = 200 ) { |
| | 3124 | function wp_send_json_success( $data = null, $status_code = null ) { |
| 3123 | 3125 | $response = array( 'success' => true ); |
| 3124 | 3126 | |
| 3125 | 3127 | if ( isset( $data ) ) |
| … |
… |
function wp_send_json_success( $data = null, $status_code = 200 ) { |
| 3143 | 3145 | * @param mixed $data Data to encode as JSON, then print and die. |
| 3144 | 3146 | * @param int $status_code The HTTP status code to output. |
| 3145 | 3147 | */ |
| 3146 | | function wp_send_json_error( $data = null, $status_code = 200 ) { |
| | 3148 | function wp_send_json_error( $data = null, $status_code = null ) { |
| 3147 | 3149 | $response = array( 'success' => false ); |
| 3148 | 3150 | |
| 3149 | 3151 | if ( isset( $data ) ) { |