Add option to wp_die to display a go back link. Props nbachiyski. fixes #5167

git-svn-id: http://svn.automattic.com/wordpress/trunk@11342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-05-15 17:49:35 +00:00
parent f47c8c729c
commit a99a8b886f
1 changed files with 10 additions and 6 deletions

View File

@ -2357,6 +2357,8 @@ function wp_die( $message, $title = '', $args = array() ) {
$defaults = array( 'response' => 500 );
$r = wp_parse_args($args, $defaults);
$have_gettext = function_exists('__');
if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
if ( empty( $title ) ) {
@ -2379,7 +2381,12 @@ function wp_die( $message, $title = '', $args = array() ) {
} elseif ( is_string( $message ) ) {
$message = "<p>$message</p>";
}
if ( isset( $r['back_link'] ) && $r['back_link'] ) {
$back_text = $have_gettext? __('&laquo; Back') : '&laquo; Back';
$message .= "\n<p><a href='javascript:history.back()'>$back_text</p>";
}
if ( defined( 'WP_SITEURL' ) && '' != WP_SITEURL )
$admin_dir = WP_SITEURL . '/wp-admin/';
elseif ( function_exists( 'get_bloginfo' ) && '' != get_bloginfo( 'wpurl' ) )
@ -2395,12 +2402,9 @@ function wp_die( $message, $title = '', $args = array() ) {
nocache_headers();
header( 'Content-Type: text/html; charset=utf-8' );
}
if ( empty($title) ) {
if ( function_exists( '__' ) )
$title = __( 'WordPress &rsaquo; Error' );
else
$title = 'WordPress &rsaquo; Error';
$title = $have_gettext? __('WordPress &rsaquo; Error') : 'WordPress &rsaquo; Error';
}
?>