Make WordPress Core


Ignore:
Timestamp:
10/11/2009 12:37:26 AM (17 years ago)
Author:
azaozz
Message:

Open View/Preview post in a new window from the link in the Saved/Updated message, cleanup messages code, add Draft updated for Pages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-advanced.php

    r12017 r12020  
    1919
    2020$action = isset($action) ? $action : '';
    21 if ( isset($_GET['message']) )
     21
     22$message = false;
     23if ( isset($_GET['message']) ) {
    2224    $_GET['message'] = absint( $_GET['message'] );
    23 $messages[1] = sprintf(__('Post updated. <a href="%s">View post</a>'), get_permalink($post_ID));
    24 $messages[2] = __('Custom field updated.');
    25 $messages[3] = __('Custom field deleted.');
    26 $messages[4] = __('Post updated.');
    27 $messages[6] = sprintf(__('Post published. <a href="%s">View post</a>'), get_permalink($post_ID));
    28 $messages[7] = __('Post saved.');
    29 $messages[8] = sprintf(__('Post submitted. <a href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );
    30 // translators: Publish box date formt, see http://php.net/date - Same as in meta-boxes.php
    31 $messages[9] = sprintf(__('Post scheduled for: <b>%1$s</b>. <a href="%2$s">Preview post</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), get_permalink($post_ID));
    32 $messages[10] = sprintf(__('Draft updated. <a href="%s">Preview</a>'), get_permalink($post_ID));
    33 
    34 if ( isset($_GET['revision']) )
    35     $messages[5] = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
     25
     26    switch ( $_GET['message'] ) {
     27        case 1:
     28            $message = sprintf( __('Post updated. <a target="_blank" href="%s">View post</a>'), get_permalink($post_ID) );
     29            break;
     30        case 2:
     31            $message = __('Custom field updated.');
     32            break;
     33        case 3:
     34            $message = __('Custom field deleted.');
     35            break;
     36        case 4:
     37            $message = __('Post updated.');
     38            break;
     39        case 5:
     40            if ( isset($_GET['revision']) )
     41                $message = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
     42            break;
     43        case 6:
     44            $message = sprintf( __('Post published. <a target="_blank" href="%s">View post</a>'), get_permalink($post_ID) );
     45            break;
     46        case 7:
     47            $message = __('Post saved.');
     48            break;
     49        case 8:
     50            $message = sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );
     51            break;
     52        case 9:
     53            // translators: Publish box date formt, see http://php.net/date - Same as in meta-boxes.php
     54            $message = sprintf( __('Post scheduled for: <b>%1$s</b>. <a target="_blank" href="%2$s">Preview post</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), get_permalink($post_ID) );
     55            break;
     56        case 10:
     57            $message = sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );
     58            break;
     59    }
     60}
    3661
    3762$notice = false;
    38 $notices[1] = __( 'There is an autosave of this post that is more recent than the version below.  <a href="%s">View the autosave</a>.' );
    39 
    4063if ( 0 == $post_ID ) {
    4164    $form_action = 'post';
     
    5275        foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
    5376            if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
    54                 $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
     77                $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below.  <a href="%s">View the autosave</a>.' ), get_edit_post_link( $autosave->ID ) );
    5578                break;
    5679            }
     
    117140<div id="notice" class="error"><p><?php echo $notice ?></p></div>
    118141<?php endif; ?>
    119 <?php if (isset($_GET['message'])) : ?>
    120 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
     142<?php if ( $message ) : ?>
     143<div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
    121144<?php endif; ?>
    122145<form name="post" action="post.php" method="post" id="post">
Note: See TracChangeset for help on using the changeset viewer.