WordPress.org

Make WordPress Core

Ticket #17609: 17609-combo.diff

File 17609-combo.diff, 4.6 KB (added by jmslbam, 5 years ago)
  • edit-form-advanced.php

     
    2929        wp_enqueue_media( array( 'post' => $post_ID ) );
    3030}
    3131
     32$post_type_object = get_post_type_object($post_type);
     33$singular_name = $post_type_object->labels->singular_name;
     34
    3235$messages = array();
    33 $messages['post'] = array(
    34          0 => '', // Unused. Messages start at index 1.
    35          1 => sprintf( __('Post updated. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ),
    36          2 => __('Custom field updated.'),
    37          3 => __('Custom field deleted.'),
    38          4 => __('Post updated.'),
    39         /* translators: %s: date and time of the revision */
    40          5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    41          6 => sprintf( __('Post published. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ),
    42          7 => __('Post saved.'),
    43          8 => sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
    44          9 => sprintf( __('Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>'),
    45                 // translators: Publish box date format, see http://php.net/date
    46                 date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
    47         10 => sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
     36$messages[$post_type] = array(
     37        0 => '', // Unused. Messages start at index 1.
     38        1 => sprintf( __('%1$s updated. <a href="%2$s">View %1$s</a>'), $singular_name, esc_url( get_permalink($post_ID) ) ),
     39        2 => __('Custom field updated.'),
     40        3 => __('Custom field deleted.'),
     41        4 => sprintf( __('%s updated.'), $singular_name),
     42        5 => isset($_GET['revision']) ? sprintf( __('%1$s restored to revision from %2$s'), $singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
     43        6 => sprintf( __('%1$s published. <a href="%2$s">View %1$s</a>'), $singular_name, esc_url( get_permalink($post_ID) ) ),
     44        7 => __('Page saved.'),
     45        8 => sprintf( __('%1$s submitted. <a target="_blank" href="%s">Preview %1$s</a>'), $singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
     46        9 => sprintf( __('%1$s scheduled for: <strong>%2$s</strong>. <a target="_blank" href="%3$s">Preview %1$s</a>'), $singular_name, date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
     47        10 => sprintf( __('%1$s draft updated. <a target="_blank" href="%2$s">Preview %1$s</a>'), $singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
    4848);
    49 $messages['page'] = array(
    50          0 => '', // Unused. Messages start at index 1.
    51          1 => sprintf( __('Page updated. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ),
    52          2 => __('Custom field updated.'),
    53          3 => __('Custom field deleted.'),
    54          4 => __('Page updated.'),
    55          5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    56          6 => sprintf( __('Page published. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ),
    57          7 => __('Page saved.'),
    58          8 => sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
    59          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) ) ),
    60         10 => sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
    61 );
    62 $messages['attachment'] = array_fill( 1, 10, __( 'Media attachment updated.' ) ); // Hack, for now.
     49// Overwrite when needed
     50if ( ! $post_type_object->publicly_queryable ) {
     51        $messages[$post_type] = array(
     52                1 => sprintf( __('%1$s updated.'), $singular_name ),
     53                6 => sprintf( __('%1$s published.'), $singular_name ),
     54                8 => sprintf( __('%1$s submitted.'), $singular_name  ),
     55                9 => sprintf( __('%1$s scheduled for: <strong>%2$s</strong>. '), $singular_name, date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ) ),
     56                10 => sprintf( __('%1$s draft updated.'), $singular_name ),
     57        );
     58}
    6359
     60$messages[$post_type] = array_map( 'trim', $messages[$post_type] );
    6461$messages = apply_filters( 'post_updated_messages', $messages );
    6562
    6663$message = false;