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.
Built from https://develop.svn.wordpress.org/trunk@58129


git-svn-id: http://core.svn.wordpress.org/trunk@57594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2024-05-10 18:09:15 +00:00
parent 1e8d651f23
commit 8839c33306
5 changed files with 23 additions and 19 deletions

View File

@ -238,8 +238,8 @@ function export_date_options( $post_type = 'post' ) {
<select name="post_status" id="post-status">
<option value="0"><?php _e( 'All' ); ?></option>
<?php
$post_stati = get_post_stati( array( 'internal' => false ), 'objects' );
foreach ( $post_stati as $status ) :
$post_statuses = get_post_stati( array( 'internal' => false ), 'objects' );
foreach ( $post_statuses as $status ) :
?>
<option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option>
<?php endforeach; ?>
@ -289,7 +289,7 @@ function export_date_options( $post_type = 'post' ) {
<label for="page-status" class="label-responsive"><?php _e( 'Status:' ); ?></label>
<select name="page_status" id="page-status">
<option value="0"><?php _e( 'All' ); ?></option>
<?php foreach ( $post_stati as $status ) : ?>
<?php foreach ( $post_statuses as $status ) : ?>
<option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option>
<?php endforeach; ?>
</select>

View File

@ -237,7 +237,7 @@ class WP_Comments_List_Table extends WP_List_Table {
$status_links = array();
$num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
$stati = array(
$statuses = array(
/* translators: %s: Number of comments. */
'all' => _nx_noop(
'All <span class="count">(%s)</span>',
@ -282,7 +282,7 @@ class WP_Comments_List_Table extends WP_List_Table {
);
if ( ! EMPTY_TRASH_DAYS ) {
unset( $stati['trash'] );
unset( $statuses['trash'] );
}
$link = admin_url( 'edit-comments.php' );
@ -291,7 +291,7 @@ class WP_Comments_List_Table extends WP_List_Table {
$link = add_query_arg( 'comment_type', $comment_type, $link );
}
foreach ( $stati as $status => $label ) {
foreach ( $statuses as $status => $label ) {
if ( 'mine' === $status ) {
$current_user_id = get_current_user_id();
$num_comments->mine = get_comments(

View File

@ -1679,13 +1679,15 @@ function register_and_do_post_meta_boxes( $post ) {
add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
}
$stati = get_post_stati( array( 'public' => true ) );
if ( empty( $stati ) ) {
$stati = array( 'publish' );
}
$stati[] = 'private';
$statuses = get_post_stati( array( 'public' => true ) );
if ( in_array( get_post_status( $post ), $stati, true ) ) {
if ( empty( $statuses ) ) {
$statuses = array( 'publish' );
}
$statuses[] = 'private';
if ( in_array( get_post_status( $post ), $statuses, true ) ) {
/*
* If the post type support comments, or the post has comments,
* allow the Comments meta box.

View File

@ -1199,9 +1199,9 @@ function _fix_attachment_links( $post ) {
* @return string[] An array of all the statuses for the supplied post type.
*/
function get_available_post_statuses( $type = 'post' ) {
$stati = wp_count_posts( $type );
$statuses = wp_count_posts( $type );
return array_keys( get_object_vars( $stati ) );
return array_keys( get_object_vars( $statuses ) );
}
/**
@ -1217,9 +1217,11 @@ function wp_edit_posts_query( $q = false ) {
if ( false === $q ) {
$q = $_GET;
}
$q['m'] = isset( $q['m'] ) ? (int) $q['m'] : 0;
$q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
$post_stati = get_post_stati();
$q['m'] = isset( $q['m'] ) ? (int) $q['m'] : 0;
$q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
$post_statuses = get_post_stati();
if ( isset( $q['post_type'] ) && in_array( $q['post_type'], get_post_types(), true ) ) {
$post_type = $q['post_type'];
@ -1231,7 +1233,7 @@ function wp_edit_posts_query( $q = false ) {
$post_status = '';
$perm = '';
if ( isset( $q['post_status'] ) && in_array( $q['post_status'], $post_stati, true ) ) {
if ( isset( $q['post_status'] ) && in_array( $q['post_status'], $post_statuses, true ) ) {
$post_status = $q['post_status'];
$perm = 'readable';
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.6-alpha-58128';
$wp_version = '6.6-alpha-58129';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.