From 7d0a24c29eea73501d43f312de2bba3cc7644b4a Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 19 Sep 2022 22:24:09 +0000 Subject: [PATCH] Coding Standards: Move `WP_List_Table::get_views_links()` to a more appropriate place. This moves the newly introduced `::get_views_links()` method to a more predictable location, next to the the `::get_views()` and `::views()` methods. Follow-up to [54215]. See #42066. Built from https://develop.svn.wordpress.org/trunk@54223 git-svn-id: http://core.svn.wordpress.org/trunk@53782 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-list-table.php | 145 +++++++++++----------- wp-includes/version.php | 2 +- 2 files changed, 74 insertions(+), 73 deletions(-) diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php index 87973139dd..0756601676 100644 --- a/wp-admin/includes/class-wp-list-table.php +++ b/wp-admin/includes/class-wp-list-table.php @@ -376,6 +376,79 @@ class WP_List_Table { $link_data' + ), + '6.1.0' + ); + + return array( '' ); + } + + $views_links = array(); + + foreach ( $link_data as $view => $link ) { + if ( empty( $link['url'] ) || ! is_string( $link['url'] ) || '' === trim( $link['url'] ) ) { + _doing_it_wrong( + __METHOD__, + sprintf( + /* translators: %1$s: The argument name. %2$s: The view name. */ + __( 'The %1$s argument must be a non-empty string for %2$s.' ), + 'url', + '' . esc_html( $view ) . '' + ), + '6.1.0' + ); + + continue; + } + + if ( empty( $link['label'] ) || ! is_string( $link['label'] ) || '' === trim( $link['label'] ) ) { + _doing_it_wrong( + __METHOD__, + sprintf( + /* translators: %1$s: The argument name. %2$s: The view name. */ + __( 'The %1$s argument must be a non-empty string for %2$s.' ), + 'label', + '' . esc_html( $view ) . '' + ), + '6.1.0' + ); + + continue; + } + + $views_links[ $view ] = sprintf( + '%s', + esc_url( $link['url'] ), + isset( $link['current'] ) && true === $link['current'] ? ' class="current" aria-current="page"' : '', + $link['label'] + ); + } + + return $views_links; + } + /** * Gets the list of views available on this table. * @@ -1513,78 +1586,6 @@ class WP_List_Table { die( wp_json_encode( $response ) ); } - /** - * Generates views links. - * - * @since 6.1.0 - * - * @param array $link_data { - * An array of link data. - * - * @type string $url The link URL. - * @type string $label The link label. - * @type bool $current Optional. Whether this is the currently selected view. - * } - * @return array An array of link markup. Keys match the $link_data input array. - */ - protected function get_views_links( $link_data = array() ) { - if ( ! is_array( $link_data ) ) { - _doing_it_wrong( - __METHOD__, - sprintf( - /* translators: %s: The $link_data argument. */ - __( 'The %s argument must be an array.' ), - '$link_data' - ), - '6.1.0' - ); - - return array( '' ); - } - - $views_links = array(); - foreach ( $link_data as $view => $link ) { - if ( empty( $link['url'] ) || ! is_string( $link['url'] ) || '' === trim( $link['url'] ) ) { - _doing_it_wrong( - __METHOD__, - sprintf( - /* translators: %1$s: The argument name. %2$s: The view name. */ - __( 'The %1$s argument must be a non-empty string for %2$s.' ), - 'url', - '' . esc_html( $view ) . '' - ), - '6.1.0' - ); - - continue; - } - - if ( empty( $link['label'] ) || ! is_string( $link['label'] ) || '' === trim( $link['label'] ) ) { - _doing_it_wrong( - __METHOD__, - sprintf( - /* translators: %1$s: The argument name. %2$s: The view name. */ - __( 'The %1$s argument must be a non-empty string for %2$s.' ), - 'label', - '' . esc_html( $view ) . '' - ), - '6.1.0' - ); - - continue; - } - - $views_links[ $view ] = sprintf( - '%s', - esc_url( $link['url'] ), - isset( $link['current'] ) && true === $link['current'] ? ' class="current" aria-current="page"' : '', - $link['label'] - ); - } - - return $views_links; - } - /** * Sends required variables to JavaScript land. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 3fbb7f11ef..745794d8c2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-alpha-54222'; +$wp_version = '6.1-alpha-54223'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.