Ticket #8420: 8420.diff
File 8420.diff, 1.9 KB (added by , 14 years ago) |
---|
-
wp-includes/functions.php
2660 2660 if ( function_exists( 'apply_filters' ) ) { 2661 2661 $function = apply_filters( 'wp_die_handler', '_default_wp_die_handler'); 2662 2662 }else { 2663 if(defined('DOING_AJAX') && DOING_AJAX) 2664 $function = '_ajax_wp_die_handler'; 2665 else 2663 2666 $function = '_default_wp_die_handler'; 2664 2667 } 2665 2668 … … 2758 2761 die(); 2759 2762 } 2760 2763 2764 function _ajax_die_handler_filter() { 2765 return '_ajax_wp_die_handler'; 2766 } 2767 2761 2768 /** 2769 * Kill WordPress execution and send AJAX response with error message. 2770 * 2771 * This is AJAX-version of the default handler for wp_die 2772 * 2773 * @since 3.0.0 2774 * @access private 2775 * 2776 * @param string $message Error message. 2777 * @param string $title Error title. 2778 * @param string|array $args Optional arguements to control behaviour. 2779 */ 2780 function _ajax_wp_die_handler( $message, $title = '', $args = array() ) { 2781 $defaults = array( 'response' => 500 ); 2782 $r = wp_parse_args($args, $defaults); 2783 if ( !headers_sent() ) { 2784 status_header( $r['response'] ); 2785 } 2786 $resp = new WP_Ajax_Response( array( 2787 'what' => 'autosave', 2788 'id' => $message 2789 ) ); 2790 $resp->send(); 2791 die(); 2792 } 2793 /** 2762 2794 * Retrieve the WordPress home page URL. 2763 2795 * 2764 2796 * If the constant named 'WP_HOME' exists, then it willl be used and returned by -
wp-admin/admin-ajax.php
21 21 22 22 require_once('./includes/admin.php'); 23 23 @header('Content-Type: text/html; charset=' . get_option('blog_charset')); 24 25 add_filter('wp_die_handler','_ajax_die_handler_filter'); 26 24 27 send_nosniff_header(); 25 28 26 29 do_action('admin_init');