IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 2984 | 2984 | * @param callable $function Callback function name. |
| 2985 | 2985 | */ |
| 2986 | 2986 | $function = apply_filters( 'wp_die_json_handler', '_json_wp_die_handler' ); |
| | 2987 | } elseif ( wp_is_jsonp_request() ) { |
| | 2988 | /** |
| | 2989 | * Filters the callback for killing WordPress execution for JSONP requests. |
| | 2990 | * |
| | 2991 | * @since 5.1.0 |
| | 2992 | * |
| | 2993 | * @param callable $function Callback function name. |
| | 2994 | */ |
| | 2995 | $function = apply_filters( 'wp_die_jsonp_handler', '_jsonp_wp_die_handler' ); |
| 2987 | 2996 | } elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { |
| 2988 | 2997 | /** |
| 2989 | 2998 | * Filters the callback for killing WordPress execution for XML-RPC requests. |
| … |
… |
|
| 3257 | 3266 | echo wp_json_encode( $data ); |
| 3258 | 3267 | die(); |
| 3259 | 3268 | } |
| | 3269 | |
| | 3270 | /** |
| | 3271 | * Kill WordPress execution and display JSONP message with error message. |
| | 3272 | * |
| | 3273 | * This is the handler for wp_die when processing JSONP requests. |
| | 3274 | * |
| | 3275 | * @since 5.1.0 |
| | 3276 | * @access private |
| | 3277 | * |
| | 3278 | * @param string $message Error message. |
| | 3279 | * @param string $title Optional. Error title. Default empty. |
| | 3280 | * @param string|array $args Optional. Arguments to control behavior. Default empty array. |
| | 3281 | */ |
| | 3282 | function _jsonp_wp_die_handler( $message, $title = '', $args = array() ) { |
| | 3283 | list( $message, $title, $r ) = _wp_die_process_input( $message, $title, $args ); |
| | 3284 | |
| | 3285 | $data = array( |
| | 3286 | 'code' => $r['code'], |
| | 3287 | 'message' => $message, |
| | 3288 | 'data' => array( |
| | 3289 | 'status' => $r['response'], |
| | 3290 | ), |
| | 3291 | 'additional_errors' => $r['additional_errors'], |
| | 3292 | ); |
| | 3293 | |
| | 3294 | if ( ! headers_sent() ) { |
| | 3295 | header( 'Content-Type: application/javascript; charset=utf-8' ); |
| | 3296 | if ( null !== $r['response'] ) { |
| | 3297 | status_header( $r['response'] ); |
| | 3298 | } |
| | 3299 | nocache_headers(); |
| | 3300 | } |
| | 3301 | |
| | 3302 | $result = wp_json_encode( $data ); |
| | 3303 | $jsonp_callback = $_GET['_jsonp']; |
| | 3304 | echo '/**/' . $jsonp_callback . '(' . $result . ')'; |
| | 3305 | die(); |
| | 3306 | } |
| 3260 | 3307 | |
| 3261 | 3308 | /** |
| 3262 | 3309 | * Kill WordPress execution and display XML message with error message. |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 1488 | 1488 | return false; |
| 1489 | 1489 | |
| 1490 | 1490 | } |
| | 1491 | |
| | 1492 | |
| | 1493 | /** |
| | 1494 | * Checks whether current request is a JSONP request, or is expecting a JSONP response. |
| | 1495 | * |
| | 1496 | * @since 5.1.0 |
| | 1497 | * |
| | 1498 | * @return bool True if JSONP Request |
| | 1499 | */ |
| | 1500 | function wp_is_jsonp_request() { |
| | 1501 | if ( ! isset( $_GET['_jsonp'] ) ) { |
| | 1502 | return false; |
| | 1503 | } |
| | 1504 | |
| | 1505 | if ( ! function_exists( 'wp_check_jsonp_callback' ) ) { |
| | 1506 | require_once ABSPATH . WPINC . '/functions.php'; |
| | 1507 | } |
| | 1508 | |
| | 1509 | $jsonp_callback = $_GET['_jsonp']; |
| | 1510 | if ( ! wp_check_jsonp_callback( $jsonp_callback ) ) { |
| | 1511 | return false; |
| | 1512 | } |
| | 1513 | |
| | 1514 | $jsonp_enabled = true; |
| | 1515 | /** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */ |
| | 1516 | $jsonp_enabled = apply_filters( 'rest_jsonp_enabled', $jsonp_enabled ); |
| | 1517 | |
| | 1518 | return $jsonp_enabled; |
| | 1519 | |
| | 1520 | } |
| | 1521 | No newline at end of file |