Make WordPress Core

Changeset 58129

Timestamp:
05/10/2024 06:07:17 PM (3 months ago)
Author:
SergeyBiryukov
Message:

Posts, Post Types: Use a consistent plural form of “status” in variable names.

Follow-up to [5575], [6796], [6993], [7638], [12162], [12719], [15578], [16652], [31046], [34515], [49472].

Props Presskopp, sabernhardt, manfcarlo, SergeyBiryukov.
Fixes #58134.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/export.php

    r56633 r58129  
    239239            <option value="0"><?php _e( 'All' ); ?></option>
    240240            <?php
    241             $post_stati = get_post_stati( array( 'internal' => false ), 'objects' );
    242             foreach ( $post_stati as $status ) :
     241            $post_stat = get_post_stati( array( 'internal' => false ), 'objects' );
     242            foreach ( $post_stat as $status ) :
    243243                ?>
    244244            <option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option>
     
    290290        <select name="page_status" id="page-status">
    291291            <option value="0"><?php _e( 'All' ); ?></option>
    292             <?php foreach ( $post_stati as $status ) : ?>
     292            <?php foreach ( $post_stat as $status ) : ?>
    293293            <option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option>
    294294            <?php endforeach; ?>
  • trunk/src/wp-admin/includes/class-wp-comments-list-table.php

    r57644 r58129  
    238238        $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
    239239
    240         $stati = array(
     240        $stat = array(
    241241            /* translators: %s: Number of comments. */
    242242            'all'       => _nx_noop(
     
    283283
    284284        if ( ! EMPTY_TRASH_DAYS ) {
    285             unset( $stati['trash'] );
     285            unset( $stat['trash'] );
    286286        }
    287287
     
    292292        }
    293293
    294         foreach ( $stati as $status => $label ) {
     294        foreach ( $stat as $status => $label ) {
    295295            if ( 'mine' === $status ) {
    296296                $current_user_id    = get_current_user_id();
  • trunk/src/wp-admin/includes/meta-boxes.php

    r57136 r58129  
    16801680    }
    16811681
    1682     $stati = get_post_stati( array( 'public' => true ) );
    1683     if ( empty( $stati ) ) {
    1684         $stati = array( 'publish' );
    1685     }
    1686     $stati[] = 'private';
    1687 
    1688     if ( in_array( get_post_status( $post ), $stati, true ) ) {
     1682    $statuses = get_post_stati( array( 'public' => true ) );
     1683
     1684    if ( empty( $statuses ) ) {
     1685        $statuses = array( 'publish' );
     1686    }
     1687
     1688    $statuses[] = 'private';
     1689
     1690    if ( in_array( get_post_status( $post ), $statuses, true ) ) {
    16891691        /*
    16901692         * If the post type support comments, or the post has comments,
  • trunk/src/wp-admin/includes/post.php

    r57860 r58129  
    12001200 */
    12011201function get_available_post_statuses( $type = 'post' ) {
    1202     $stati = wp_count_posts( $type );
    1203 
    1204     return array_keys( get_object_vars( $stati ) );
     1202    $stat = wp_count_posts( $type );
     1203
     1204    return array_keys( get_object_vars( $stat ) );
    12051205}
    12061206
     
    12181218        $q = $_GET;
    12191219    }
    1220     $q['m']     = isset( $q['m'] ) ? (int) $q['m'] : 0;
    1221     $q['cat']   = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
    1222     $post_stati = get_post_stati();
     1220
     1221    $q['m']   = isset( $q['m'] ) ? (int) $q['m'] : 0;
     1222    $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
     1223
     1224    $post_statuses = get_post_stati();
    12231225
    12241226    if ( isset( $q['post_type'] ) && in_array( $q['post_type'], get_post_types(), true ) ) {
     
    12321234    $perm             = '';
    12331235
    1234     if ( isset( $q['post_status'] ) && in_array( $q['post_status'], $post_stati, true ) ) {
     1236    if ( isset( $q['post_status'] ) && in_array( $q['post_status'], $post_stat, true ) ) {
    12351237        $post_status = $q['post_status'];
    12361238        $perm        = 'readable';
  • trunk/tests/phpunit/tests/includes/helpers.php

    r52010 r58129  
    226226        _unregister_post_status( 'foo' );
    227227
    228         $stati = get_post_stati();
    229 
    230         $this->assertArrayNotHasKey( 'foo', $stati );
     228        $stat = get_post_stati();
     229
     230        $this->assertArrayNotHasKey( 'foo', $stat );
    231231    }
    232232
Note: See TracChangeset for help on using the changeset viewer.