Make WordPress Core

Ticket #14981: 14981.diff

File 14981.diff, 13.2 KB (added by swissspidy, 9 years ago)
  • src/wp-admin/includes/ajax-actions.php

    diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
    index 34d179c..7424fd5 100644
    function wp_ajax_find_posts() { 
    17701770                $title = trim( $post->post_title ) ? $post->post_title : __( '(no title)' );
    17711771                $alt = ( 'alternate' == $alt ) ? '' : 'alternate';
    17721772
    1773                 switch ( $post->post_status ) {
    1774                         case 'publish' :
    1775                         case 'private' :
    1776                                 $stat = __('Published');
    1777                                 break;
    1778                         case 'future' :
    1779                                 $stat = __('Scheduled');
    1780                                 break;
    1781                         case 'pending' :
    1782                                 $stat = __('Pending Review');
    1783                                 break;
    1784                         case 'draft' :
    1785                                 $stat = __('Draft');
    1786                                 break;
     1773                $post_type_labels = get_post_type_labels( get_post_type_object( $post->post_type ) );
     1774
     1775                if ( 'private' === $post->post_status ) {
     1776                        $stat = $post_type_labels->publish['singular'];
     1777                } else {
     1778                        $stat = $post_type_labels->{$post->post_status}['singular'];
    17871779                }
    17881780
    17891781                if ( '0000-00-00 00:00:00' == $post->post_date ) {
  • src/wp-admin/includes/class-wp-posts-list-table.php

    diff --git src/wp-admin/includes/class-wp-posts-list-table.php src/wp-admin/includes/class-wp-posts-list-table.php
    index ce68efc..c6f9e47 100644
    class WP_Posts_List_Table extends WP_List_Table { 
    278278                $all_args = array( 'post_type' => $post_type );
    279279                $mine = '';
    280280
     281                $post_type_labels = get_post_type_labels( get_post_type_object( $post_type ) );
     282
    281283                // Subtract post types that are not included in the admin all list.
    282284                foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) {
    283285                        $total_posts -= $num_posts->$state;
    class WP_Posts_List_Table extends WP_List_Table { 
    294296                        );
    295297
    296298                        $mine_inner_html = sprintf(
    297                                 _nx(
    298                                         'Mine <span class="count">(%s)</span>',
    299                                         'Mine <span class="count">(%s)</span>',
    300                                         $this->user_posts_count,
    301                                         'posts'
    302                                 ),
     299                                translate_nooped_plural( $post_type_labels->mine, $this->user_posts_count ) . ' <span class="count">(%s)</span>',
    303300                                number_format_i18n( $this->user_posts_count )
    304301                        );
    305302
    class WP_Posts_List_Table extends WP_List_Table { 
    314311                }
    315312
    316313                $all_inner_html = sprintf(
    317                         _nx(
    318                                 'All <span class="count">(%s)</span>',
    319                                 'All <span class="count">(%s)</span>',
    320                                 $total_posts,
    321                                 'posts'
    322                         ),
     314                        translate_nooped_plural( $post_type_labels->all, $total_posts ),
    323315                        number_format_i18n( $total_posts )
    324316                );
    325317
    class WP_Posts_List_Table extends WP_List_Table { 
    347339                        );
    348340
    349341                        $status_label = sprintf(
    350                                 translate_nooped_plural( $status->label_count, $num_posts->$status_name ),
     342                                translate_nooped_plural( $post_type_labels->{$status_name}, $num_posts->$status_name ) . ' <span class="count">(%s)</span>',
    351343                                number_format_i18n( $num_posts->$status_name )
    352344                        );
    353345
    class WP_Posts_List_Table extends WP_List_Table { 
    363355                        );
    364356
    365357                        $sticky_inner_html = sprintf(
    366                                 _nx(
    367                                         'Sticky <span class="count">(%s)</span>',
    368                                         'Sticky <span class="count">(%s)</span>',
    369                                         $this->sticky_posts_count,
    370                                         'posts'
    371                                 ),
     358                                translate_nooped_plural( $post_type_labels->sticky, $this->sticky_posts_count ) . ' <span class="count">(%s)</span>',
    372359                                number_format_i18n( $this->sticky_posts_count )
    373360                        );
    374361
    class WP_Posts_List_Table extends WP_List_Table { 
    947934                        }
    948935                }
    949936
     937                $post_type_labels = get_post_type_labels( get_post_type_object( $post->post_type ) );
    950938                if ( 'publish' === $post->post_status ) {
    951                         _e( 'Published' );
     939                        echo $post_type_labels->publish['singular'];
    952940                } elseif ( 'future' === $post->post_status ) {
    953941                        if ( $time_diff > 0 ) {
    954942                                echo '<strong class="error-message">' . __( 'Missed schedule' ) . '</strong>';
    955943                        } else {
    956                                 _e( 'Scheduled' );
     944                                echo $post_type_labels->future['singular'];
    957945                        }
    958946                } else {
    959947                        _e( 'Last Modified' );
    class WP_Posts_List_Table extends WP_List_Table { 
    15751563                        <?php endif; ?>
    15761564                        </div>
    15771565
    1578         <?php endif; // $bulk
    1579         endif; // post_type_supports comments or pings ?>
     1566        <?php
     1567                endif; // $bulk
     1568        endif; // post_type_supports comments or pings
     1569        $post_type_labels = get_post_type_labels( get_post_type_object( $post->post_type ) );
     1570        ?>
    15801571
    15811572                        <div class="inline-edit-group wp-clearfix">
    15821573                                <label class="inline-edit-status alignleft">
    class WP_Posts_List_Table extends WP_List_Table { 
    15861577                                                <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
    15871578        <?php endif; // $bulk ?>
    15881579                                        <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
    1589                                                 <option value="publish"><?php _e( 'Published' ); ?></option>
    1590                                                 <option value="future"><?php _e( 'Scheduled' ); ?></option>
     1580                                                <option value="publish"><?php echo $post_type_labels->publish['singular']; ?></option>
     1581                                                <option value="future"><?php echo $post_type_labels->future['singular']; ?></option>
    15911582        <?php if ( $bulk ) : ?>
    1592                                                 <option value="private"><?php _e( 'Private' ) ?></option>
     1583                                                <option value="private"><?php echo $post_type_labels->private['singular']; ?></option>
    15931584        <?php endif; // $bulk ?>
    15941585                                        <?php endif; ?>
    1595                                                 <option value="pending"><?php _e( 'Pending Review' ); ?></option>
    1596                                                 <option value="draft"><?php _e( 'Draft' ); ?></option>
     1586                                                <option value="pending"><?php echo $post_type_labels->pending['singular']; ?></option>
     1587                                                <option value="draft"><?php echo $post_type_labels->draft['singular']; ?></option>
    15971588                                        </select>
    15981589                                </label>
    15991590
  • src/wp-admin/includes/meta-boxes.php

    diff --git src/wp-admin/includes/meta-boxes.php src/wp-admin/includes/meta-boxes.php
    index 1dce46f..4e88df1 100644
    do_action( 'post_submitbox_minor_actions', $post ); 
    7777<div class="misc-pub-section misc-pub-post-status"><label for="post_status"><?php _e('Status:') ?></label>
    7878<span id="post-status-display">
    7979<?php
    80 switch ( $post->post_status ) {
    81         case 'private':
    82                 _e('Privately Published');
    83                 break;
    84         case 'publish':
    85                 _e('Published');
    86                 break;
    87         case 'future':
    88                 _e('Scheduled');
    89                 break;
    90         case 'pending':
    91                 _e('Pending Review');
    92                 break;
    93         case 'draft':
    94         case 'auto-draft':
    95                 _e('Draft');
    96                 break;
     80$post_type_labels = get_post_type_labels( get_post_type_object( $post->post_type ) );
     81if ( 'auto-draft' === $post->post_status ) {
     82        echo $post_type_labels->draft['singular'];
     83} else {
     84        echo $post_type_labels->{$post->post_status}['singular'];
    9785}
    9886?>
    9987</span>
    switch ( $post->post_status ) { 
    10492<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ('auto-draft' == $post->post_status ) ? 'draft' : $post->post_status); ?>" />
    10593<select name='post_status' id='post_status'>
    10694<?php if ( 'publish' == $post->post_status ) : ?>
    107 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
     95<option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php echo $post_type_labels->publish['singular']; ?></option>
    10896<?php elseif ( 'private' == $post->post_status ) : ?>
    109 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
     97<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php echo $post_type_labels->private['singular']; ?></option>
    11098<?php elseif ( 'future' == $post->post_status ) : ?>
    111 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
     99<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php echo $post_type_labels->future['singular']; ?></option>
    112100<?php endif; ?>
    113 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
     101<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php echo $post_type_labels->pending['singular']; ?></option>
    114102<?php if ( 'auto-draft' == $post->post_status ) : ?>
    115 <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option>
     103<option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php echo $post_type_labels->draft['singular']; ?></option>
    116104<?php else : ?>
    117 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
     105<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php echo $post_type_labels->draft['singular']; ?></option>
    118106<?php endif; ?>
    119107</select>
    120108 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
  • src/wp-admin/includes/nav-menu.php

    diff --git src/wp-admin/includes/nav-menu.php src/wp-admin/includes/nav-menu.php
    index 53eaec0..3fc5d97 100644
    function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) { 
    370370                '_wpnonce',
    371371        );
    372372
     373        $post_type_labels = get_post_type_labels( get_post_type_object( $post_type_name ) );
     374
    373375        ?>
    374376        <div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">
    375377                <ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs">
    376378                        <li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>>
    377379                                <a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-most-recent" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent">
    378                                         <?php _e( 'Most Recent' ); ?>
     380                                        <?php echo $post_type_labels->most_recent; ?>
    379381                                </a>
    380382                        </li>
    381383                        <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>
    382384                                <a class="nav-tab-link" data-type="<?php echo esc_attr( $post_type_name ); ?>-all" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#<?php echo $post_type_name; ?>-all">
    383                                         <?php _e( 'View All' ); ?>
     385                                        <?php echo $post_type_labels->view_all; ?>
    384386                                </a>
    385387                        </li>
    386388                        <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>
    387389                                <a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-search" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
    388                                         <?php _e( 'Search'); ?>
     390                                        <?php echo $post_type_labels->search; ?>
    389391                                </a>
    390392                        </li>
    391393                </ul><!-- .posttype-tabs -->
  • src/wp-includes/post.php

    diff --git src/wp-includes/post.php src/wp-includes/post.php
    index be08ae3..a8ea121 100644
    function _post_type_meta_capabilities( $capabilities = null ) { 
    14271427 * - filter_items_list - String for the table views hidden heading.
    14281428 * - items_list_navigation - String for the table pagination hidden heading.
    14291429 * - items_list - String for the table hidden heading.
     1430 * - most_recent - String for menu filters.
     1431 * - view_all - String for menu filters.
     1432 * - search - String for menu filters.
     1433 * - publish - Post Status.
     1434 * - future - Post Status.
     1435 * - draft - Post Status.
     1436 * - pending - Post Status.
     1437 * - private - Post Status.
     1438 * - trash - Post Status.
     1439 * - mine - String for use in getting post table views.
     1440 * - all - String for use in getting post table views.
     1441 * - sticky - String for use in getting post table views.
    14301442 *
    14311443 * Above, the first default value is for non-hierarchical post types (like posts)
    14321444 * and the second one is for hierarchical post types (like pages).
    function get_post_type_labels( $post_type_object ) { 
    14661478                'filter_items_list' => array( __( 'Filter posts list' ), __( 'Filter pages list' ) ),
    14671479                'items_list_navigation' => array( __( 'Posts list navigation' ), __( 'Pages list navigation' ) ),
    14681480                'items_list' => array( __( 'Posts list' ), __( 'Pages list' ) ),
     1481                'most_recent' => array( _x( 'Most Recent', 'post' ), _x( 'Most Recent', 'page' ) ),
     1482                'view_all' => array( _x( 'View All', 'post' ), _x( 'View All', 'page' ) ),
     1483                'search' => array( _x( 'Search', 'post' ), _x( 'Search', 'page' ) ),
     1484                'publish' => array( _nx_noop( 'Published', 'Published', 'post' ), _nx_noop( 'Published', 'Published', 'page' ) ),
     1485                'future' => array( _nx_noop( 'Scheduled', 'Scheduled', 'post' ), _nx_noop( 'Scheduled', 'Scheduled', 'page' ) ),
     1486                'draft' => array( _nx_noop( 'Draft', 'Draft', 'post' ), _nx_noop( 'Draft', 'Draft', 'page' ) ),
     1487                'pending' => array( _nx_noop( 'Pending Review', 'Pending Review', 'post' ), _nx_noop( 'Pending Review', 'Pending Review', 'page' ) ),
     1488                'private' => array( _nx_noop( 'Privately Published', 'Privately Published', 'post' ), _nx_noop( 'Privately Published', 'Privately Published', 'page' ) ),
     1489                'trash' => array( _nx_noop( 'Trash', 'Trash', 'post' ), _nx_noop( 'Trash', 'Trash', 'page' ) ),
     1490                'mine' => array( _nx_noop( 'Mine', 'Mine', 'post' ), _nx_noop( 'Mine', 'Mine', 'page' ) ),
     1491                'all' => array( _nx_noop( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', 'post' ), _nx_noop( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', 'page' ) ),
     1492                'sticky' => array( _nx_noop( 'Sticky', 'Sticky', 'post' ), null ),
    14691493        );
    14701494        $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
    14711495