mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-09 07:00:01 +00:00
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:
parent
f47c8c729c
commit
a99a8b886f
@ -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? __('« Back') : '« 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 › Error' );
|
||||
else
|
||||
$title = 'WordPress › Error';
|
||||
$title = $have_gettext? __('WordPress › Error') : 'WordPress › Error';
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user