Ticket #8420: wp.2.patch
File wp.2.patch, 1.8 KB (added by , 14 years ago) |
---|
-
functions.php
2664 2664 * @param string|array $args Optional arguements to control behaviour. 2665 2665 */ 2666 2666 function wp_die( $message, $title = '', $args = array() ) { 2667 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) 2668 die('-1'); 2669 2667 die; 2670 2668 if ( function_exists( 'apply_filters' ) ) { 2671 2669 $function = apply_filters( 'wp_die_handler', '_default_wp_die_handler'); 2672 2670 } else { … … 2676 2674 call_user_func( $function, $message, $title, $args ); 2677 2675 } 2678 2676 2677 function _ajax_die_handler_filter() { 2678 return '_ajax_wp_die_handler'; 2679 } 2680 2679 2681 /** 2680 2682 * Kill WordPress execution and display HTML message with error message. 2681 2683 * … … 2769 2771 } 2770 2772 2771 2773 /** 2774 * Kill WordPress execution and send AJAX response with error message. 2775 * 2776 * This is AJAX-version of the default handler for wp_die 2777 * 2778 * @since 3.0.0 2779 * @access private 2780 * 2781 * @param string $message Error message. 2782 * @param string $title Error title. 2783 * @param string|array $args Optional arguements to control behaviour. 2784 */ 2785 function _ajax_wp_die_handler( $message, $title = '', $args = array() ) { 2786 $defaults = array( 'response' => 500 ); 2787 $r = wp_parse_args($args, $defaults); 2788 $have_gettext = function_exists('__'); 2789 if ( !function_exists( 'did_action' ) || !did_action( 'admin_head' ) ) : 2790 if ( !headers_sent() ) { 2791 status_header( $r['response'] ); 2792 nocache_headers(); 2793 header( 'Content-Type: text/html; charset=utf-8' ); 2794 } 2795 $resp = new WP_Ajax_Response( array( 2796 'what' => 'autosave', 2797 'id' => $message, 2798 'data' => $message 2799 ) ); 2800 $resp->send(); 2801 die(); 2802 } 2803 2804 /** 2772 2805 * Retrieve the WordPress home page URL. 2773 2806 * 2774 2807 * If the constant named 'WP_HOME' exists, then it willl be used and returned by