From eb52f08d4eb32c6f41bca5a283a0fee8f4a449fd Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 18 Jul 2023 14:03:57 +0000 Subject: [PATCH] Coding Standards: Use strict comparison for static strings in `wp-admin/includes/class-wp-list-table.php`. Follow-up to [55971], [56004]. See #32170, #57839. git-svn-id: https://develop.svn.wordpress.org/trunk@56260 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-list-table.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php index 5ebe507952..b2800d2f51 100644 --- a/src/wp-admin/includes/class-wp-list-table.php +++ b/src/wp-admin/includes/class-wp-list-table.php @@ -1115,7 +1115,7 @@ class WP_List_Table { * * In the second format, passing true as second parameter will make the initial * sorting order be descending. Following parameters add a short column name to - * be used as 'abbr' attribute, a translatable string for the current sorting + * be used as 'abbr' attribute, a translatable string for the current sorting, * and the initial order for the initial sorted column, 'asc' or 'desc' (default: false). * * @since 3.1.0 @@ -1325,10 +1325,10 @@ class WP_List_Table { } // Not in the initial view and descending order. - if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] ) { + if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) { $current_order = 'desc'; } else { - // The initial view is not always 'asc' we'll take care of this below. + // The initial view is not always 'asc', we'll take care of this below. $current_order = 'asc'; } @@ -1388,13 +1388,14 @@ class WP_List_Table { */ if ( $current_orderby === $orderby ) { // The sorted column. The `aria-sort` attribute must be set only on the sorted column. - if ( 'asc' == $current_order ) { + if ( 'asc' === $current_order ) { $order = 'desc'; $aria_sort_attr = ' aria-sort="ascending"'; } else { $order = 'asc'; $aria_sort_attr = ' aria-sort="descending"'; } + $class[] = 'sorted'; $class[] = $current_order; } else { @@ -1407,12 +1408,14 @@ class WP_List_Table { $class[] = 'sortable'; $class[] = 'desc' === $order ? 'asc' : 'desc'; + /* translators: Hidden accessibility text. */ $asc_text = __( 'Sort ascending.' ); /* translators: Hidden accessibility text. */ $desc_text = __( 'Sort descending.' ); $order_text = 'asc' === $order ? $asc_text : $desc_text; } + if ( '' !== $order_text ) { $order_text = ' ' . $order_text . ''; } @@ -1459,10 +1462,10 @@ class WP_List_Table { } // Not in the initial view and descending order. - if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] ) { + if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) { $current_order = 'desc'; } else { - // The initial view is not always 'asc' we'll take care of this below. + // The initial view is not always 'asc', we'll take care of this below. $current_order = 'asc'; } @@ -1493,7 +1496,7 @@ class WP_List_Table { * True in the initial view when an initial orderby is set via get_sortable_columns() * and true in the sorted views when the actual $_GET['orderby'] is equal to $orderby. */ - if ( $current_orderby == $orderby ) { + if ( $current_orderby === $orderby ) { /* translators: Hidden accessibility text. */ $asc_text = __( 'Ascending.' ); /* translators: Hidden accessibility text. */