Clean up save mssage. see #8713

git-svn-id: http://svn.automattic.com/wordpress/trunk@11159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-05-02 21:44:09 +00:00
parent 161b628ba9
commit 87b704d710
4 changed files with 19 additions and 52 deletions

View File

@ -16,7 +16,7 @@ $post_ID = isset($post_ID) ? (int) $post_ID : 0;
$action = isset($action) ? $action : ''; $action = isset($action) ? $action : '';
if ( isset($_GET['message']) ) if ( isset($_GET['message']) )
$_GET['message'] = absint( $_GET['message'] ); $_GET['message'] = absint( $_GET['message'] );
$messages[1] = sprintf( __( 'Post updated. Continue editing below or <a href="%s">go back</a>.' ), attr( stripslashes( ( isset( $_GET['_wp_original_http_referer'] ) ? $_GET['_wp_original_http_referer'] : '') ) ) ); $messages[1] = sprintf(__('Post updated. <a href="%s">View post</a>'), get_permalink($post_ID));
$messages[2] = __('Custom field updated.'); $messages[2] = __('Custom field updated.');
$messages[3] = __('Custom field deleted.'); $messages[3] = __('Custom field deleted.');
$messages[4] = __('Post updated.'); $messages[4] = __('Post updated.');

View File

@ -18,10 +18,9 @@ if ( ! isset( $temp_ID ) )
if ( isset($_GET['message']) ) if ( isset($_GET['message']) )
$_GET['message'] = absint( $_GET['message'] ); $_GET['message'] = absint( $_GET['message'] );
$messages[1] = sprintf( __( 'Page updated. Continue editing below or <a href="%s">go back</a>.' ), attr( stripslashes( ( isset( $_GET['_wp_original_http_referer'] ) ? $_GET['_wp_original_http_referer'] : '') ) ) ); $messages[1] = sprintf(__('Page updated. <a href="%s">View page</a>'), get_permalink($post_ID));
$messages[2] = __('Custom field updated.'); $messages[2] = __('Custom field updated.');
$messages[3] = __('Custom field deleted.'); $messages[3] = __('Custom field deleted.');
$messages[4] = sprintf(__('Page updated. <a href="%s">View page</a>'), get_permalink($post_ID));
$messages[5] = sprintf(__('Page published. <a href="%s">View page</a>'), get_permalink($post_ID)); $messages[5] = sprintf(__('Page published. <a href="%s">View page</a>'), get_permalink($post_ID));
$messages[6] = sprintf(__('Page submitted. <a href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ); $messages[6] = sprintf(__('Page submitted. <a href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );

View File

@ -35,21 +35,14 @@ function redirect_page($page_ID) {
$location = $_POST['referredby']; $location = $_POST['referredby'];
} elseif ( 'post' == $_POST['originalaction'] && !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) { } elseif ( 'post' == $_POST['originalaction'] && !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) {
$location = 'sidebar.php?a=b'; $location = 'sidebar.php?a=b';
} elseif ( ( isset($_POST['save']) || isset($_POST['publish']) ) && ( empty($referredby) || $referredby == $referer || 'redo' != $referredby ) ) { } elseif ( ( isset($_POST['save']) || isset($_POST['publish']) ) ) {
if ( isset($_POST['_wp_original_http_referer']) && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/page.php') === false && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/page-new.php') === false ) if ( isset( $_POST['publish'] ) ) {
$location = add_query_arg( array( if ( 'pending' == get_post_status( $page_ID ) )
'_wp_original_http_referer' => urlencode( stripslashes( $_POST['_wp_original_http_referer'] ) ), $location = add_query_arg( 'message', 6, get_edit_post_link( $page_ID, 'url' ) );
'message' => 1 else
), get_edit_post_link( $page_ID, 'url' ) ); $location = add_query_arg( 'message', 5, get_edit_post_link( $page_ID, 'url' ) );
else { } else {
if ( isset( $_POST['publish'] ) ) { $location = add_query_arg( 'message', 1, get_edit_post_link( $page_ID, 'url' ) );
if ( 'pending' == get_post_status( $page_ID ) )
$location = add_query_arg( 'message', 6, get_edit_post_link( $page_ID, 'url' ) );
else
$location = add_query_arg( 'message', 5, get_edit_post_link( $page_ID, 'url' ) );
} else {
$location = add_query_arg( 'message', 4, get_edit_post_link( $page_ID, 'url' ) );
}
} }
} elseif ( isset($_POST['addmeta']) ) { } elseif ( isset($_POST['addmeta']) ) {
$location = add_query_arg( 'message', 2, wp_get_referer() ); $location = add_query_arg( 'message', 2, wp_get_referer() );
@ -59,19 +52,10 @@ function redirect_page($page_ID) {
$location = add_query_arg( 'message', 3, wp_get_referer() ); $location = add_query_arg( 'message', 3, wp_get_referer() );
$location = explode('#', $location); $location = explode('#', $location);
$location = $location[0] . '#postcustom'; $location = $location[0] . '#postcustom';
} elseif (!empty($referredby) && $referredby != $referer) {
$location = $_POST['referredby'];
$location = remove_query_arg('_wp_original_http_referer', $location);
if ( false !== strpos($location, 'edit-pages.php') )
$location = add_query_arg('posted', $page_ID, $location);
elseif ( false !== strpos($location, 'wp-admin') )
$location = "page-new.php?posted=$page_ID";
} elseif ( isset($_POST['publish']) ) {
$location = "page-new.php?posted=$page_ID";
} elseif ($action == 'editattachment') { } elseif ($action == 'editattachment') {
$location = 'attachments.php'; $location = 'attachments.php';
} else { } else {
$location = add_query_arg( 'message', 4, get_edit_post_link( $page_ID, 'url' ) ); $location = add_query_arg( 'message', 1, get_edit_post_link( $page_ID, 'url' ) );
} }
wp_redirect($location); wp_redirect($location);

View File

@ -38,21 +38,14 @@ function redirect_post($post_ID = '') {
$location = 'sidebar.php?a=c'; $location = 'sidebar.php?a=c';
elseif ( isset($_POST['publish']) ) elseif ( isset($_POST['publish']) )
$location = 'sidebar.php?a=b'; $location = 'sidebar.php?a=b';
} elseif ( ( isset($_POST['save']) || isset($_POST['publish']) ) && ( empty($referredby) || $referredby == $referer || 'redo' != $referredby ) ) { } elseif ( ( isset($_POST['save']) || isset($_POST['publish']) ) ) {
if ( isset($_POST['_wp_original_http_referer']) && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/post.php') === false && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/post-new.php') === false ) if ( isset( $_POST['publish'] ) ) {
$location = add_query_arg( array( if ( 'pending' == get_post_status( $post_ID ) )
'_wp_original_http_referer' => urlencode( stripslashes( $_POST['_wp_original_http_referer'] ) ), $location = add_query_arg( 'message', 8, get_edit_post_link( $post_ID, 'url' ) );
'message' => 1 else
), get_edit_post_link( $post_ID, 'url' ) ); $location = add_query_arg( 'message', 6, get_edit_post_link( $post_ID, 'url' ) );
else { } else {
if ( isset( $_POST['publish'] ) ) { $location = add_query_arg( 'message', 1, get_edit_post_link( $post_ID, 'url' ) );
if ( 'pending' == get_post_status( $post_ID ) )
$location = add_query_arg( 'message', 8, get_edit_post_link( $post_ID, 'url' ) );
else
$location = add_query_arg( 'message', 6, get_edit_post_link( $post_ID, 'url' ) );
} else {
$location = add_query_arg( 'message', 7, get_edit_post_link( $post_ID, 'url' ) );
}
} }
} elseif (isset($_POST['addmeta']) && $_POST['addmeta']) { } elseif (isset($_POST['addmeta']) && $_POST['addmeta']) {
$location = add_query_arg( 'message', 2, wp_get_referer() ); $location = add_query_arg( 'message', 2, wp_get_referer() );
@ -62,15 +55,6 @@ function redirect_post($post_ID = '') {
$location = add_query_arg( 'message', 3, wp_get_referer() ); $location = add_query_arg( 'message', 3, wp_get_referer() );
$location = explode('#', $location); $location = explode('#', $location);
$location = $location[0] . '#postcustom'; $location = $location[0] . '#postcustom';
} elseif (!empty($referredby) && $referredby != $referer) {
$location = $_POST['referredby'];
$location = remove_query_arg('_wp_original_http_referer', $location);
if ( false !== strpos($location, 'edit.php') || false !== strpos($location, 'edit-post-drafts.php') )
$location = add_query_arg('posted', $post_ID, $location);
elseif ( false !== strpos($location, 'wp-admin') )
$location = "post-new.php?posted=$post_ID";
} elseif ( isset($_POST['publish']) ) {
$location = "post-new.php?posted=$post_ID";
} elseif ($action == 'editattachment') { } elseif ($action == 'editattachment') {
$location = 'attachments.php'; $location = 'attachments.php';
} elseif ( 'post-quickpress-save-cont' == $_POST['action'] ) { } elseif ( 'post-quickpress-save-cont' == $_POST['action'] ) {