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-page-form.php

    r11897 r12020  
    2121    $temp_ID = 0;
    2222
    23 if ( isset($_GET['message']) )
     23$message = false;
     24if ( isset($_GET['message']) ) {
    2425    $_GET['message'] = absint( $_GET['message'] );
    25 $messages[1] = sprintf(__('Page updated. <a href="%s">View page</a>'), get_permalink($post_ID));
    26 $messages[2] = __('Custom field updated.');
    27 $messages[3] = __('Custom field deleted.');
    28 $messages[5] = sprintf(__('Page published. <a href="%s">View page</a>'), get_permalink($post_ID));
    29 $messages[6] = sprintf(__('Page submitted. <a href="%s">Preview page</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[7] = sprintf(__('Page 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));
    3226
    33 if ( isset($_GET['revision']) )
    34     $messages[5] = sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
     27    switch ( $_GET['message'] ) {
     28        case 1:
     29            $message = sprintf( __('Page updated. <a target="_blank" href="%s">View page</a>'), get_permalink($post_ID) );
     30            break;
     31        case 2:
     32            $message = __('Custom field updated.');
     33            break;
     34        case 3:
     35            $message = __('Custom field deleted.');
     36            break;
     37        case 4:
     38            $message = sprintf( __('Page published. <a target="_blank" href="%s">View page</a>'), get_permalink($post_ID) );
     39            break;
     40        case 5:
     41            if ( isset($_GET['revision']) )
     42                $message = sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
     43            break;
     44        case 6:
     45            $message = sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );
     46            break;
     47        case 7:
     48            // translators: Publish box date formt, see http://php.net/date - Same as in meta-boxes.php
     49            $message = sprintf( __('Page scheduled for: <b>%1$s</b>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), get_permalink($post_ID) );
     50            break;
     51        case 8:
     52            $message = sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );
     53            break;
     54    }
     55}
    3556
    3657$notice = false;
    37 $notices[1] = __( 'There is an autosave of this page that is more recent than the version below.  <a href="%s">View the autosave</a>.' );
    38 
    3958if ( 0 == $post_ID) {
    4059    $form_action = 'post';
     
    4968    $autosave = wp_get_post_autosave( $post_ID );
    5069    if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) )
    51         $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
     70        $notice = sprintf( __( 'There is an autosave of this page that is more recent than the version below.  <a href="%s">View the autosave</a>.' ), get_edit_post_link( $autosave->ID ) );
    5271}
    5372
     
    88107<div id="notice" class="error"><p><?php echo $notice ?></p></div>
    89108<?php endif; ?>
    90 <?php if (isset($_GET['message'])) : ?>
    91 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
     109<?php if ( $message ) : ?>
     110<div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
    92111<?php endif; ?>
    93112
Note: See TracChangeset for help on using the changeset viewer.