Make WordPress Core

Changeset 50780


Ignore:
Timestamp:
04/21/2021 06:51:33 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in wp-admin/includes/class-wp-terms-list-table.php.

Includes minor code layout fixes for better readability.

See #52627.

File:
1 edited

Legend:

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

    r50505 r50780  
    293293                        }
    294294
    295                         if ( $term->parent != $parent && empty( $_REQUEST['s'] ) ) {
     295                        if ( $term->parent !== $parent && empty( $_REQUEST['s'] ) ) {
    296296                                continue;
    297297                        }
    298298
    299299                        // If the page starts in a subtree, print the parents.
    300                         if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) {
     300                        if ( $count === $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) {
    301301                                $my_parents = array();
    302302                                $parent_ids = array();
    303303                                $p          = $term->parent;
     304
    304305                                while ( $p ) {
    305306                                        $my_parent    = get_term( $p, $taxonomy );
    306307                                        $my_parents[] = $my_parent;
    307308                                        $p            = $my_parent->parent;
     309
    308310                                        if ( in_array( $p, $parent_ids, true ) ) { // Prevent parent loops.
    309311                                                break;
    310312                                        }
     313
    311314                                        $parent_ids[] = $p;
    312315                                }
     316
    313317                                unset( $parent_ids );
    314318
    315319                                $num_parents = count( $my_parents );
     320
    316321                                while ( $my_parent = array_pop( $my_parents ) ) {
    317322                                        echo "\t";
     
    475480
    476481                $actions = array();
     482
    477483                if ( current_user_can( 'edit_term', $tag->term_id ) ) {
    478484                        $actions['edit'] = sprintf(
     
    490496                        );
    491497                }
     498
    492499                if ( current_user_can( 'delete_term', $tag->term_id ) ) {
    493500                        $actions['delete'] = sprintf(
     
    499506                        );
    500507                }
     508
    501509                if ( is_taxonomy_viewable( $tax ) ) {
    502510                        $actions['view'] = sprintf(
     
    604612        public function column_links( $tag ) {
    605613                $count = number_format_i18n( $tag->count );
     614
    606615                if ( $count ) {
    607616                        $count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>";
    608617                }
     618
    609619                return $count;
    610620        }
Note: See TracChangeset for help on using the changeset viewer.