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


git-svn-id: http://core.svn.wordpress.org/trunk@50389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-04-21 18:53:00 +00:00
parent 5500f370fd
commit 784b1fb1b1
2 changed files with 13 additions and 3 deletions

View File

@ -292,27 +292,32 @@ class WP_Terms_List_Table extends WP_List_Table {
break; break;
} }
if ( $term->parent != $parent && empty( $_REQUEST['s'] ) ) { if ( $term->parent !== $parent && empty( $_REQUEST['s'] ) ) {
continue; continue;
} }
// If the page starts in a subtree, print the parents. // If the page starts in a subtree, print the parents.
if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) { if ( $count === $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) {
$my_parents = array(); $my_parents = array();
$parent_ids = array(); $parent_ids = array();
$p = $term->parent; $p = $term->parent;
while ( $p ) { while ( $p ) {
$my_parent = get_term( $p, $taxonomy ); $my_parent = get_term( $p, $taxonomy );
$my_parents[] = $my_parent; $my_parents[] = $my_parent;
$p = $my_parent->parent; $p = $my_parent->parent;
if ( in_array( $p, $parent_ids, true ) ) { // Prevent parent loops. if ( in_array( $p, $parent_ids, true ) ) { // Prevent parent loops.
break; break;
} }
$parent_ids[] = $p; $parent_ids[] = $p;
} }
unset( $parent_ids ); unset( $parent_ids );
$num_parents = count( $my_parents ); $num_parents = count( $my_parents );
while ( $my_parent = array_pop( $my_parents ) ) { while ( $my_parent = array_pop( $my_parents ) ) {
echo "\t"; echo "\t";
$this->single_row( $my_parent, $level - $num_parents ); $this->single_row( $my_parent, $level - $num_parents );
@ -474,6 +479,7 @@ class WP_Terms_List_Table extends WP_List_Table {
); );
$actions = array(); $actions = array();
if ( current_user_can( 'edit_term', $tag->term_id ) ) { if ( current_user_can( 'edit_term', $tag->term_id ) ) {
$actions['edit'] = sprintf( $actions['edit'] = sprintf(
'<a href="%s" aria-label="%s">%s</a>', '<a href="%s" aria-label="%s">%s</a>',
@ -489,6 +495,7 @@ class WP_Terms_List_Table extends WP_List_Table {
__( 'Quick&nbsp;Edit' ) __( 'Quick&nbsp;Edit' )
); );
} }
if ( current_user_can( 'delete_term', $tag->term_id ) ) { if ( current_user_can( 'delete_term', $tag->term_id ) ) {
$actions['delete'] = sprintf( $actions['delete'] = sprintf(
'<a href="%s" class="delete-tag aria-button-if-js" aria-label="%s">%s</a>', '<a href="%s" class="delete-tag aria-button-if-js" aria-label="%s">%s</a>',
@ -498,6 +505,7 @@ class WP_Terms_List_Table extends WP_List_Table {
__( 'Delete' ) __( 'Delete' )
); );
} }
if ( is_taxonomy_viewable( $tax ) ) { if ( is_taxonomy_viewable( $tax ) ) {
$actions['view'] = sprintf( $actions['view'] = sprintf(
'<a href="%s" aria-label="%s">%s</a>', '<a href="%s" aria-label="%s">%s</a>',
@ -603,9 +611,11 @@ class WP_Terms_List_Table extends WP_List_Table {
*/ */
public function column_links( $tag ) { public function column_links( $tag ) {
$count = number_format_i18n( $tag->count ); $count = number_format_i18n( $tag->count );
if ( $count ) { if ( $count ) {
$count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>"; $count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>";
} }
return $count; return $count;
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.8-alpha-50779'; $wp_version = '5.8-alpha-50780';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.