WordPress.org

Make WordPress Core

Changeset 12790


Ignore:
Timestamp:
01/21/2010 10:13:20 PM (10 years ago)
Author:
westi
Message:

Allow for an alternative handler for wp_die to be used if required. See #11892.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r12789 r12790  
    24712471}
    24722472
     2473
    24732474/**
    24742475 * Kill WordPress execution and display HTML message with error message.
    24752476 *
    2476  * Call this function complements the die() PHP function. The difference is that
     2477 * This function complements the die() PHP function. The difference is that
    24772478 * HTML will be displayed to the user. It is recommended to use this function
    24782479 * only, when the execution should not continue any further. It is not
     
    24872488 */
    24882489function wp_die( $message, $title = '', $args = array() ) {
     2490    if ( function_exists( 'apply_filters' ) ) {
     2491        $function = apply_filters( 'wp_die_handler', '_default_wp_die_handler');
     2492    }else {
     2493        $function = '_default_wp_die_handler';
     2494    }
     2495
     2496    call_user_func( $function, $message, $title, $args );
     2497}
     2498
     2499/**
     2500 * Kill WordPress execution and display HTML message with error message.
     2501 *
     2502 * This is the default handler for wp_die if you want a custom one for your
     2503 * site then you can overload using the wp_die_handler filter in wp_die
     2504 *
     2505 * @since 3.0.0
     2506 * @private
     2507 *
     2508 * @param string $message Error message.
     2509 * @param string $title Error title.
     2510 * @param string|array $args Optional arguements to control behaviour.
     2511 */
     2512function _default_wp_die_handler( $message, $title = '', $args = array() ) {
    24892513    global $wp_locale;
    24902514
Note: See TracChangeset for help on using the changeset viewer.