WordPress.org

Make WordPress Core

Ticket #17609: 17609.5.diff

File 17609.5.diff, 4.8 KB (added by johnbillion, 5 years ago)
  • src/wp-admin/edit-form-advanced.php

     
    8282
    8383$messages = array();
    8484$post_preview_url = get_preview_post_link( $post );
    85 
    86 $preview_link_html = $scheduled_link_html = $view_post_html = '';
    87 
    8885$viewable = is_post_type_viewable( $post_type_object );
    8986
    90 if ( $viewable ) {
    91         // Preview link.
    92         $preview_link_html = sprintf( ' <a target="_blank" href="%s">%s</a>',
    93                 esc_url( $post_preview_url ),
    94                 __( 'Preview post' )
    95         );
     87/* translators: Scheduled post date format, see http://php.net/date */
     88$scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) );
    9689
    97         // Scheduled preview link.
    98         $scheduled_link_html = sprintf( ' <a target="_blank" href="%s">%s</a>',
    99                 esc_url( $permalink ),
    100                 __( 'Preview post' )
     90if ( $viewable ) {
     91        $messages['post'] = array(
     92                 1 => sprintf( __( 'Post updated. <a href="%s">View post</a>' ), esc_url( $permalink ) ),
     93                 2 => __( 'Custom field updated.' ),
     94                 3 => __( 'Custom field deleted.' ),
     95                 4 => __( 'Post updated.' ),
     96                /* translators: %s: date and time of the revision */
     97                 5 => isset($_GET['revision']) ? sprintf( __( 'Post restored to revision from %s' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
     98                 6 => sprintf( __( 'Post published. <a href="%s">View post</a>' ), esc_url( $permalink ) ),
     99                 7 => __( 'Post saved.' ),
     100                 8 => sprintf( __( 'Post submitted. <a target="_blank" href="%s">Preview post</a>' ), esc_url( $post_preview_url ) ),
     101                 9 => sprintf( __( 'Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>' ), $scheduled_date, esc_url( $permalink ) ),
     102                10 => sprintf( __( 'Post draft updated. <a target="_blank" href="%s">Preview post</a>' ), esc_url( $post_preview_url ) ),
    101103        );
    102 
    103         // View post link.
    104         $view_post_html = sprintf( ' <a href="%s">%s</a>',
    105                 esc_url( $permalink ),
    106                 __( 'View post' )
     104} else {
     105        $messages['post'] = array(
     106                 1 => __( 'Post updated.' ),
     107                 2 => __( 'Custom field updated.' ),
     108                 3 => __( 'Custom field deleted.' ),
     109                 4 => __( 'Post updated.' ),
     110                /* translators: %s: date and time of the revision */
     111                 5 => isset($_GET['revision']) ? sprintf( __( 'Post restored to revision from %s' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
     112                 6 => __( 'Post published.' ),
     113                 7 => __( 'Post saved.' ),
     114                 8 => __( 'Post submitted.' ),
     115                 9 => sprintf( __( 'Post scheduled for: <strong>%1$s</strong>.' ), $scheduled_date ),
     116                10 => __( 'Post draft updated.' ),
    107117        );
    108118}
    109119
    110 /* translators: Publish box date format, see http://php.net/date */
    111 $scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) );
    112 $messages['post'] = array(
    113          0 => '', // Unused. Messages start at index 1.
    114          1 => __( 'Post updated.' ) . $view_post_html,
    115          2 => __('Custom field updated.'),
    116          3 => __('Custom field deleted.'),
    117          4 => __('Post updated.'),
    118         /* translators: %s: date and time of the revision */
    119          5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    120          6 => __( 'Post published.' ) . $view_post_html,
    121          7 => __('Post saved.'),
    122          8 => __( 'Post submitted.' ) . $preview_link_html,
    123          9 => sprintf( __( 'Post scheduled for: <strong>%1$s</strong>' ), $scheduled_date ) . $scheduled_link_html,
    124         10 => __( 'Post draft updated.' ) . $preview_link_html,
    125 );
    126 
    127120$page_preview_url = get_preview_post_link( $post );
    128121
    129122$messages['page'] = array(
    130          0 => '', // Unused. Messages start at index 1.
    131123         1 => sprintf( __('Page updated. <a href="%s">View page</a>'), esc_url( $permalink ) ),
    132124         2 => __('Custom field updated.'),
    133125         3 => __('Custom field deleted.'),
    134126         4 => __('Page updated.'),
     127        /* translators: %s: date and time of the revision */
    135128         5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    136129         6 => sprintf( __('Page published. <a href="%s">View page</a>'), esc_url( $permalink ) ),
    137130         7 => __('Page saved.'),
    138131         8 => sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), esc_url( $page_preview_url ) ),
    139          9 => sprintf( __('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) ), esc_url( $permalink ) ),
     132         9 => sprintf( __('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), $scheduled_date, esc_url( $permalink ) ),
    140133        10 => sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), esc_url( $page_preview_url ) ),
    141134);
    142135$messages['attachment'] = array_fill( 1, 10, __( 'Media attachment updated.' ) ); // Hack, for now.