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
@ -2358,6 +2358,8 @@ function wp_die( $message, $title = '', $args = array() ) {
|
|||||||
$defaults = array( 'response' => 500 );
|
$defaults = array( 'response' => 500 );
|
||||||
$r = wp_parse_args($args, $defaults);
|
$r = wp_parse_args($args, $defaults);
|
||||||
|
|
||||||
|
$have_gettext = function_exists('__');
|
||||||
|
|
||||||
if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
|
if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
|
||||||
if ( empty( $title ) ) {
|
if ( empty( $title ) ) {
|
||||||
$error_data = $message->get_error_data();
|
$error_data = $message->get_error_data();
|
||||||
@ -2380,6 +2382,11 @@ function wp_die( $message, $title = '', $args = array() ) {
|
|||||||
$message = "<p>$message</p>";
|
$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 )
|
if ( defined( 'WP_SITEURL' ) && '' != WP_SITEURL )
|
||||||
$admin_dir = WP_SITEURL . '/wp-admin/';
|
$admin_dir = WP_SITEURL . '/wp-admin/';
|
||||||
elseif ( function_exists( 'get_bloginfo' ) && '' != get_bloginfo( 'wpurl' ) )
|
elseif ( function_exists( 'get_bloginfo' ) && '' != get_bloginfo( 'wpurl' ) )
|
||||||
@ -2397,10 +2404,7 @@ function wp_die( $message, $title = '', $args = array() ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( empty($title) ) {
|
if ( empty($title) ) {
|
||||||
if ( function_exists( '__' ) )
|
$title = $have_gettext? __('WordPress › Error') : 'WordPress › Error';
|
||||||
$title = __( 'WordPress › Error' );
|
|
||||||
else
|
|
||||||
$title = 'WordPress › Error';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user