Make WordPress Core


Ignore:
Timestamp:
09/27/2021 12:35:38 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Remove duplicate assignment from a ternary operator in WP_MS_Sites_List_Table::site_states().

Adjust similar code in _post_states() and _media_states() for consistency.

Follow-up to:

Props joelcj91, audrasjb, desrosj.
Fixes #38296.

File:
1 edited

Legend:

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

    r51189 r51873  
    21462146        if ( ! empty( $post_states ) ) {
    21472147                $state_count = count( $post_states );
    2148                 $i           = 0;
     2148
     2149                $i = 0;
    21492150
    21502151                $post_states_string .= ' — ';
    21512152
    21522153                foreach ( $post_states as $state ) {
    2153                         $sep = ( ++$i === $state_count ) ? '' : ', ';
     2154                        ++$i;
     2155
     2156                        $sep = ( $i < $state_count ) ? ', ' : '';
    21542157
    21552158                        $post_states_string .= "<span class='post-state'>$state$sep</span>";
     
    22562259        if ( ! empty( $media_states ) ) {
    22572260                $state_count = count( $media_states );
    2258                 $i           = 0;
     2261
     2262                $i = 0;
    22592263
    22602264                $media_states_string .= ' &mdash; ';
    22612265
    22622266                foreach ( $media_states as $state ) {
    2263                         $sep = ( ++$i === $state_count ) ? '' : ', ';
     2267                        ++$i;
     2268
     2269                        $sep = ( $i < $state_count ) ? ', ' : '';
    22642270
    22652271                        $media_states_string .= "<span class='post-state'>$state$sep</span>";
Note: See TracChangeset for help on using the changeset viewer.