WordPress.org

Make WordPress Core

Ticket #17609: 17609.diff

File 17609.diff, 4.1 KB (added by mfields, 10 years ago)
  • wp-admin/edit-form-advanced.php

     
    2828$action = isset($action) ? $action : '';
    2929
    3030$messages = array();
    31 $messages['post'] = array(
     31$screen = get_current_screen();
     32$obj = get_post_type_object( $screen->post_type );
     33$label = $obj->labels->singular_name;
     34$links = array(
     35        'permalink' => '',
     36        'preview'   => ''
     37);
     38if ( $obj->publicly_queryable ) {
     39        $permalink = get_permalink( $post_ID );
     40        $links = array(
     41                'permalink' => '<a href="' . esc_url( $permalink ) . '">' . sprintf( esc_html__( 'View %1$s' ), $label ) . '</a>',
     42                'preview'   => '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', $permalink ) ) . '">' . sprintf( esc_html__( 'Preview %1$s' ), $label ) . '</a>'
     43        );
     44}
     45$messages[$screen->post_type] = array(
    3246         0 => '', // Unused. Messages start at index 1.
    33          1 => sprintf( __('Post updated. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ),
    34          2 => __('Custom field updated.'),
    35          3 => __('Custom field deleted.'),
    36          4 => __('Post updated.'),
     47         1 => sprintf( __( '%1$s updated. %2$s' ), $label, $links['permalink'] ),
     48         2 => __( 'Custom field updated.' ),
     49         3 => __( 'Custom field deleted.' ),
     50         4 => sprintf( __( '%1$s updated.' ), $label ),
    3751        /* translators: %s: date and time of the revision */
    38          5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    39          6 => sprintf( __('Post published. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ),
    40          7 => __('Post saved.'),
    41          8 => sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
    42          9 => sprintf( __('Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>'),
     52         5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s' ), $label, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
     53         6 => sprintf( __( '%1$s published. %2$s' ), $label, $links['permalink'] ),
     54         7 => sprintf( __( '%1$s saved.' ), $label ),
     55         8 => sprintf( __( '%1$s submitted. %2$s' ), $label, $links['preview'] ),
     56         9 => sprintf( __( '%1$s scheduled for: <strong>%2$s</strong>. %s' ),
     57                $label,
    4358                // translators: Publish box date format, see http://php.net/date
    4459                date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
    45         10 => sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
     60        10 => sprintf( __( '%1$s draft updated. %2$s'), $label, $links['preview'] ),
    4661);
    47 $messages['page'] = array(
    48          0 => '', // Unused. Messages start at index 1.
    49          1 => sprintf( __('Page updated. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ),
    50          2 => __('Custom field updated.'),
    51          3 => __('Custom field deleted.'),
    52          4 => __('Page updated.'),
    53          5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    54          6 => sprintf( __('Page published. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ),
    55          7 => __('Page saved.'),
    56          8 => sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
    57          9 => sprintf( __('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
    58         10 => sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
    59 );
    60 
     62$messages[$screen->post_type] = array_map( 'trim', $messages[$screen->post_type] );
    6163$messages = apply_filters( 'post_updated_messages', $messages );
    6264
    6365$message = false;