Make WordPress Core

Ticket #14981: 14981.4.patch

File 14981.4.patch, 14.9 KB (added by rockwell15, 8 years ago)

Refreshed patch & added the logic to 'post-state'

  • src/wp-admin/includes/ajax-actions.php

     
    17761776                $title = trim( $post->post_title ) ? $post->post_title : __( '(no title)' );
    17771777                $alt = ( 'alternate' == $alt ) ? '' : 'alternate';
    17781778
    1779                 switch ( $post->post_status ) {
    1780                         case 'publish' :
    1781                         case 'private' :
    1782                                 $stat = __('Published');
    1783                                 break;
    1784                         case 'future' :
    1785                                 $stat = __('Scheduled');
    1786                                 break;
    1787                         case 'pending' :
    1788                                 $stat = __('Pending Review');
    1789                                 break;
    1790                         case 'draft' :
    1791                                 $stat = __('Draft');
    1792                                 break;
    1793                 }
     1779                $post_type_labels = get_post_type_labels( get_post_type_object( $post->post_type ) );
     1780               
     1781                if ( 'private' === $post->post_status ) {
     1782                        $stat = $post_type_labels->publish['singular'];
     1783                } else {
     1784                        $stat = $post_type_labels->{$post->post_status}['singular'];
     1785                }
    17941786
    17951787                if ( '0000-00-00 00:00:00' == $post->post_date ) {
    17961788                        $time = '';
  • src/wp-admin/includes/class-wp-posts-list-table.php

     
    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;
     
    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
     
    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
     
    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
     
    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
     
    991978                        }
    992979                }
    993980
     981                $post_type_labels = get_post_type_labels( get_post_type_object( $post->post_type ) );
    994982                if ( 'publish' === $post->post_status ) {
    995                         _e( 'Published' );
     983                        echo $post_type_labels->publish['singular'];
    996984                } elseif ( 'future' === $post->post_status ) {
    997985                        if ( $time_diff > 0 ) {
    998986                                echo '<strong class="error-message">' . __( 'Missed schedule' ) . '</strong>';
    999987                        } else {
    1000                                 _e( 'Scheduled' );
     988                                echo $post_type_labels->future['singular'];
    1001989                        }
    1002990                } else {
    1003991                        _e( 'Last Modified' );
     
    16181606                        <?php endif; ?>
    16191607                        </div>
    16201608
    1621         <?php endif; // $bulk
    1622         endif; // post_type_supports comments or pings ?>
     1609        <?php
     1610                        endif; // $bulk
     1611                endif; // post_type_supports comments or pings
     1612                $post_type_labels = get_post_type_labels( get_post_type_object( $post->post_type ) );
     1613        ?>
    16231614
    16241615                        <div class="inline-edit-group wp-clearfix">
    16251616                                <label class="inline-edit-status alignleft">
     
    16291620                                                <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
    16301621        <?php endif; // $bulk ?>
    16311622                                        <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
    1632                                                 <option value="publish"><?php _e( 'Published' ); ?></option>
    1633                                                 <option value="future"><?php _e( 'Scheduled' ); ?></option>
     1623                                                <option value="publish"><?php echo $post_type_labels->publish['singular']; ?></option>
     1624                                                <option value="future"><?php echo $post_type_labels->future['singular']; ?></option>
    16341625        <?php if ( $bulk ) : ?>
    1635                                                 <option value="private"><?php _e( 'Private' ) ?></option>
     1626                                                <option value="private"><?php echo $post_type_labels->private['singular']; ?></option>
    16361627        <?php endif; // $bulk ?>
    16371628                                        <?php endif; ?>
    1638                                                 <option value="pending"><?php _e( 'Pending Review' ); ?></option>
    1639                                                 <option value="draft"><?php _e( 'Draft' ); ?></option>
     1629                                                <option value="pending"><?php echo $post_type_labels->pending['singular']; ?></option>
     1630                                                <option value="draft"><?php echo $post_type_labels->draft['singular']; ?></option>
    16401631                                        </select>
    16411632                                </label>
    16421633
  • src/wp-admin/includes/meta-boxes.php

     
    7575<div id="misc-publishing-actions">
    7676
    7777<div class="misc-pub-section misc-pub-post-status">
    78 <?php _e( 'Status:' ) ?> <span id="post-status-display"><?php
    79 
    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;
    97 }
     78<?php _e( 'Status:' ) ?> <span id="post-status-display">
     79<?php
     80        $post_type_labels = get_post_type_labels( get_post_type_object( $post->post_type ) );
     81        if ( 'auto-draft' === $post->post_status ) {
     82                echo $post_type_labels->draft['singular'];
     83        } else {
     84                echo $post_type_labels->{$post->post_status}['singular'];
     85        }
    9886?>
    9987</span>
    10088<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
     
    10593<label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ) ?></label>
    10694<select name="post_status" id="post_status">
    10795<?php if ( 'publish' == $post->post_status ) : ?>
    108 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
     96<option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php echo $post_type_labels->publish['singular']; ?></option>
    10997<?php elseif ( 'private' == $post->post_status ) : ?>
    110 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
     98<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php echo $post_type_labels->private['singular']; ?></option>
    11199<?php elseif ( 'future' == $post->post_status ) : ?>
    112 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
     100<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php echo $post_type_labels->future['singular']; ?></option>
    113101<?php endif; ?>
    114 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
     102<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php echo $post_type_labels->pending['singular']; ?></option>
    115103<?php if ( 'auto-draft' == $post->post_status ) : ?>
    116 <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option>
     104<option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php echo $post_type_labels->draft['singular']; ?></option>
    117105<?php else : ?>
    118 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
     106<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php echo $post_type_labels->draft['singular']; ?></option>
    119107<?php endif; ?>
    120108</select>
    121109 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
  • src/wp-admin/includes/nav-menu.php

     
    390390                '_wpnonce',
    391391        );
    392392
     393        $post_type_labels = get_post_type_labels( get_post_type_object( $post_type_name ) );
     394
    393395        ?>
    394396        <div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">
    395397                <ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs">
    396398                        <li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>>
    397399                                <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">
    398                                         <?php _e( 'Most Recent' ); ?>
     400                                        <?php echo $post_type_labels->most_recent; ?>
    399401                                </a>
    400402                        </li>
    401403                        <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>
    402404                                <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">
    403                                         <?php _e( 'View All' ); ?>
     405                                        <?php echo $post_type_labels->view_all; ?>
    404406                                </a>
    405407                        </li>
    406408                        <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>
    407409                                <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">
    408                                         <?php _e( 'Search'); ?>
     410                                        <?php echo $post_type_labels->search; ?>
    409411                                </a>
    410412                        </li>
    411413                </ul><!-- .posttype-tabs -->
  • src/wp-admin/includes/template.php

     
    16971697        else
    16981698                $post_status = '';
    16991699
     1700        $post_type_labels = get_post_type_labels( get_post_type_object( $post->post_type ) );
     1701
    17001702        if ( !empty($post->post_password) )
    17011703                $post_states['protected'] = __('Password protected');
    17021704        if ( 'private' == $post->post_status && 'private' != $post_status )
    1703                 $post_states['private'] = __('Private');
     1705                $post_states['private'] = $post_type_labels->private['singular'];
    17041706        if ( 'draft' == $post->post_status && 'draft' != $post_status )
    1705                 $post_states['draft'] = __('Draft');
     1707                $post_states['draft'] = $post_type_labels->draft['singular'];
    17061708        if ( 'pending' == $post->post_status && 'pending' != $post_status )
    1707                 $post_states['pending'] = _x('Pending', 'post status');
     1709                $post_states['pending'] = $post_type_labels->pending['singular'];
    17081710        if ( is_sticky($post->ID) )
    1709                 $post_states['sticky'] = __('Sticky');
     1711                $post_states['sticky'] = $post_type_labels->sticky['singular'];
    17101712
    17111713        if ( 'future' === $post->post_status ) {
    1712                 $post_states['scheduled'] = __( 'Scheduled' );
     1714                $post_states['future'] = $post_type_labels->future['singular'];
    17131715        }
    17141716
    17151717        if ( 'page' === get_option( 'show_on_front' ) ) {
  • src/wp-includes/post.php

     
    13461346 * - `items_list_navigation` - Label for the table pagination hidden heading. Default is 'Posts list navigation' /
    13471347 *                           'Pages list navigation'.
    13481348 * - `items_list` - Label for the table hidden heading. Default is 'Posts list' / 'Pages list'.
     1349 * -
     1350 * - `most_recent` - Label for for "most recent" menu filter. Default is 'Most Recent' / 'Most Recent'
     1351 * - `view_all` - Label for for "view all" menu filter. Default is 'View All' / 'View All'
     1352 * - `search` - Label for for "search" menu filter. Default is 'Search' / 'Search'
     1353 * - `publish` - Label for Post Status string. Default is 'Published' / 'Published'
     1354 * - `future` - Label for Post Status string. Default is 'Scheduled' / 'Scheduled'
     1355 * - `draft` - Label for Post Status string. Default is 'Draft' / 'Draft'
     1356 * - `pending` - Label for Post Status string. Default is 'Pending Review' / 'Pending Review'
     1357 * - `private` - Label for Post Status string. Default is 'Privately Published' / 'Privately Published'
     1358 * - `trash` - Label for Post Status string. Default is 'Trash' / 'Trash'
     1359 * - `mine` - Label for for use in getting post table views string. Default is 'Mine' / 'Mine'
     1360 * - `all` - Label for for use in getting post table views string. Default is 'All <span class="count">(%s)</span>' / 'All <span class="count">(%s)</span>'
     1361 * - `sticky` - Label for for use in getting post table views string. Default is 'Sticky' / 'Sticky'
    13491362 *
    13501363 * Above, the first default value is for non-hierarchical post types (like posts)
    13511364 * and the second one is for hierarchical post types (like pages).
     
    13911404                'filter_items_list' => array( __( 'Filter posts list' ), __( 'Filter pages list' ) ),
    13921405                'items_list_navigation' => array( __( 'Posts list navigation' ), __( 'Pages list navigation' ) ),
    13931406                'items_list' => array( __( 'Posts list' ), __( 'Pages list' ) ),
     1407                'most_recent' => array( _x( 'Most Recent', 'post' ), _x( 'Most Recent', 'page' ) ),
     1408                'view_all' => array( _x( 'View All', 'post' ), _x( 'View All', 'page' ) ),
     1409                'search' => array( _x( 'Search', 'post' ), _x( 'Search', 'page' ) ),
     1410                'publish' => array( _nx_noop( 'Published', 'Published', 'post' ), _nx_noop( 'Published', 'Published', 'page' ) ),
     1411                'future' => array( _nx_noop( 'Scheduled', 'Scheduled', 'post' ), _nx_noop( 'Scheduled', 'Scheduled', 'page' ) ),
     1412                'draft' => array( _nx_noop( 'Draft', 'Draft', 'post' ), _nx_noop( 'Draft', 'Draft', 'page' ) ),
     1413                'pending' => array( _nx_noop( 'Pending Review', 'Pending Review', 'post' ), _nx_noop( 'Pending Review', 'Pending Review', 'page' ) ),
     1414                'private' => array( _nx_noop( 'Privately Published', 'Privately Published', 'post' ), _nx_noop( 'Privately Published', 'Privately Published', 'page' ) ),
     1415                'trash' => array( _nx_noop( 'Trash', 'Trash', 'post' ), _nx_noop( 'Trash', 'Trash', 'page' ) ),
     1416                'mine' => array( _nx_noop( 'Mine', 'Mine', 'post' ), _nx_noop( 'Mine', 'Mine', 'page' ) ),
     1417                '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' ) ),
     1418                'sticky' => array( _nx_noop( 'Sticky', 'Sticky', 'post' ), null ),
    13941419        );
    13951420        $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
    13961421