Make WordPress Core

Changeset 54071


Ignore:
Timestamp:
09/05/2022 05:17:21 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use more meaningful variable names for output in the admin.

This renames some variables for clarity, per the Naming Conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

  • $out is renamed to $output in various list table methods and admin functions.
  • $sep is renamed to $separator in various list table methods and admin functions.

This affects:

  • WP_Comments_List_Table::handle_row_actions()
  • WP_List_Table::row_actions()
  • WP_Media_List_Table::column_default()
  • WP_MS_Sites_List_Table::site_states()
  • WP_MS_Users_List_Table::column_blogs()
  • WP_Terms_List_Table::column_name()
  • _wp_dashboard_recent_comments_row()
  • image_align_input_fields()
  • image_size_input_fields()
  • wp_doc_link_parse()
  • _post_states()
  • _media_states()

Follow-up to [8653], [8692], [8864], [8910], [8911], [8916], [9103], [9153], [10607], [15491], [17793], [32644], [54070].

Props mukesh27, costdev.
See #56448, #55647.

Location:
trunk/src/wp-admin/includes
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-comments-list-table.php

    r53641 r54071  
    678678        $the_comment_status = wp_get_comment_status( $comment );
    679679
    680         $out = '';
     680        $output = '';
    681681
    682682        $del_nonce     = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
     
    833833        }
    834834
    835         $out .= '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
     835        $output .= '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
    836836
    837837        $i = 0;
     
    843843                || 1 === $i
    844844            ) {
    845                 $sep = '';
     845                $separator = '';
    846846            } else {
    847                 $sep = ' | ';
     847                $separator = ' | ';
    848848            }
    849849
     
    861861            }
    862862
    863             $out .= "<span class='$action'>$sep$link</span>";
    864         }
    865 
    866         $out .= '</div>';
    867 
    868         $out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
    869 
    870         return $out;
     863            $output .= "<span class='$action'>{$separator}{$link}</span>";
     864        }
     865
     866        $output .= '</div>';
     867
     868        $output .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
     869
     870        return $output;
    871871    }
    872872
  • trunk/src/wp-admin/includes/class-wp-list-table.php

    r53868 r54071  
    556556        }
    557557
    558         $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
     558        $output = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
    559559
    560560        $i = 0;
     
    563563            ++$i;
    564564
    565             $sep = ( $i < $action_count ) ? ' | ' : '';
    566 
    567             $out .= "<span class='$action'>$link$sep</span>";
    568         }
    569 
    570         $out .= '</div>';
    571 
    572         $out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
    573 
    574         return $out;
     565            $separator = ( $i < $action_count ) ? ' | ' : '';
     566
     567            $output .= "<span class='$action'>{$link}{$separator}</span>";
     568        }
     569
     570        $output .= '</div>';
     571
     572        $output .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
     573
     574        return $output;
    575575    }
    576576
  • trunk/src/wp-admin/includes/class-wp-media-list-table.php

    r53414 r54071  
    636636
    637637            if ( is_array( $terms ) ) {
    638                 $out = array();
     638                $output = array();
     639
    639640                foreach ( $terms as $t ) {
    640641                    $posts_in_term_qv             = array();
     
    642643                    $posts_in_term_qv['term']     = $t->slug;
    643644
    644                     $out[] = sprintf(
     645                    $output[] = sprintf(
    645646                        '<a href="%s">%s</a>',
    646647                        esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ),
     
    648649                    );
    649650                }
    650                 echo implode( wp_get_list_item_separator(), $out );
     651
     652                echo implode( wp_get_list_item_separator(), $output );
    651653            } else {
    652654                echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . get_taxonomy( $taxonomy )->labels->no_terms . '</span>';
  • trunk/src/wp-admin/includes/class-wp-ms-sites-list-table.php

    r52332 r54071  
    652652                ++$i;
    653653
    654                 $sep = ( $i < $state_count ) ? ', ' : '';
    655 
    656                 echo "<span class='post-state'>{$state}{$sep}</span>";
     654                $separator = ( $i < $state_count ) ? ', ' : '';
     655
     656                echo "<span class='post-state'>{$state}{$separator}</span>";
    657657            }
    658658        }
  • trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php

    r54062 r54071  
    439439                ++$i;
    440440
    441                 $sep = ( $i < $action_count ) ? ' | ' : '';
    442 
    443                 echo "<span class='$action'>$link$sep</span>";
     441                $separator = ( $i < $action_count ) ? ' | ' : '';
     442
     443                echo "<span class='$action'>{$link}{$separator}</span>";
    444444            }
    445445
  • trunk/src/wp-admin/includes/class-wp-terms-list-table.php

    r53893 r54071  
    415415        }
    416416
    417         $out = sprintf(
     417        $output = sprintf(
    418418            '<strong>%s</strong><br />',
    419419            $name
    420420        );
    421421
    422         $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
    423         $out .= '<div class="name">' . $qe_data->name . '</div>';
     422        $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
     423        $output .= '<div class="name">' . $qe_data->name . '</div>';
    424424
    425425        /** This filter is documented in wp-admin/edit-tag-form.php */
    426         $out .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>';
    427         $out .= '<div class="parent">' . $qe_data->parent . '</div></div>';
    428 
    429         return $out;
     426        $output .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>';
     427        $output .= '<div class="parent">' . $qe_data->parent . '</div></div>';
     428
     429        return $output;
    430430    }
    431431
  • trunk/src/wp-admin/includes/dashboard.php

    r53876 r54071  
    800800                || 1 === $i
    801801            ) {
    802                 $sep = '';
     802                $separator = '';
    803803            } else {
    804                 $sep = ' | ';
     804                $separator = ' | ';
    805805            }
    806806
     
    814814            }
    815815
    816             $actions_string .= "<span class='$action'>$sep$link</span>";
     816            $actions_string .= "<span class='$action'>{$separator}{$link}</span>";
    817817        }
    818818    }
  • trunk/src/wp-admin/includes/media.php

    r53888 r54071  
    11561156    }
    11571157
    1158     $out = array();
     1158    $output = array();
    11591159
    11601160    foreach ( $alignments as $name => $label ) {
    1161         $name  = esc_attr( $name );
    1162         $out[] = "<input type='radio' name='attachments[{$post->ID}][align]' id='image-align-{$name}-{$post->ID}' value='$name'" .
     1161        $name     = esc_attr( $name );
     1162        $output[] = "<input type='radio' name='attachments[{$post->ID}][align]' id='image-align-{$name}-{$post->ID}' value='$name'" .
    11631163            ( $checked == $name ? " checked='checked'" : '' ) .
    11641164            " /><label for='image-align-{$name}-{$post->ID}' class='align image-align-{$name}-label'>$label</label>";
    11651165    }
    11661166
    1167     return implode( "\n", $out );
     1167    return implode( "\n", $output );
    11681168}
    11691169
     
    12001200    }
    12011201
    1202     $out = array();
     1202    $output = array();
    12031203
    12041204    foreach ( $size_names as $size => $label ) {
     
    12361236        $html .= '</div>';
    12371237
    1238         $out[] = $html;
     1238        $output[] = $html;
    12391239    }
    12401240
     
    12421242        'label' => __( 'Size' ),
    12431243        'input' => 'html',
    1244         'html'  => implode( "\n", $out ),
     1244        'html'  => implode( "\n", $output ),
    12451245    );
    12461246}
  • trunk/src/wp-admin/includes/misc.php

    r53692 r54071  
    664664    $ignore_functions = array_unique( $ignore_functions );
    665665
    666     $out = array();
     666    $output = array();
    667667
    668668    foreach ( $functions as $function ) {
     
    671671        }
    672672
    673         $out[] = $function;
    674     }
    675 
    676     return $out;
     673        $output[] = $function;
     674    }
     675
     676    return $output;
    677677}
    678678
  • trunk/src/wp-admin/includes/template.php

    r53877 r54071  
    21692169            ++$i;
    21702170
    2171             $sep = ( $i < $state_count ) ? ', ' : '';
    2172 
    2173             $post_states_string .= "<span class='post-state'>$state$sep</span>";
     2171            $separator = ( $i < $state_count ) ? ', ' : '';
     2172
     2173            $post_states_string .= "<span class='post-state'>{$state}{$separator}</span>";
    21742174        }
    21752175    }
     
    22832283            ++$i;
    22842284
    2285             $sep = ( $i < $state_count ) ? ', ' : '';
    2286 
    2287             $media_states_string .= "<span class='post-state'>$state$sep</span>";
     2285            $separator = ( $i < $state_count ) ? ', ' : '';
     2286
     2287            $media_states_string .= "<span class='post-state'>{$state}{$separator}</span>";
    22882288        }
    22892289    }
Note: See TracChangeset for help on using the changeset viewer.