Make WordPress Core

Ticket #32170: 32170.11.diff

File 32170.11.diff, 4.3 KB (added by joedolson, 21 months ago)

Follow up patch

  • src/wp-admin/includes/class-wp-comments-list-table.php

     
    583583                <?php
    584584                if ( ! isset( $_GET['orderby'] ) ) {
    585585                        // In the initial view, Comments are ordered by comment's date but there's no column for that.
    586                         echo '<caption class="screen-reader-text">' . __( 'Ordered by Comment Date, descending.' ) . '</p>';
     586                        echo '<caption class="screen-reader-text">' .
     587                        /* translators: Hidden accessibility text. */
     588                        __( 'Ordered by Comment Date, descending.' ) .
     589                        '</caption>';
    587590                } else {
    588591                        $this->print_table_description();
    589592                }
  • src/wp-admin/includes/class-wp-list-table.php

     
    13611361                        }
    13621362
    13631363                        if ( isset( $sortable[ $column_key ] ) ) {
    1364                                 list( $orderby, $desc_first, $abbr, $orderby_text, $initial_order ) = $sortable[ $column_key ];
     1364                                $orderby       = isset( $sortable[ $column_key ][0] ) ? $sortable[ $column_key ][0] : '';
     1365                                $desc_first    = isset( $sortable[ $column_key ][1] ) ? $sortable[ $column_key ][1] : false;
     1366                                $abbr          = isset( $sortable[ $column_key ][2] ) ? $sortable[ $column_key ][2] : '';
     1367                                $orderby_text  = isset( $sortable[ $column_key ][3] ) ? $sortable[ $column_key ][3] : '';
     1368                                $initial_order = isset( $sortable[ $column_key ][4] ) ? $sortable[ $column_key ][4] : '';
    13651369
    13661370                                /*
    13671371                                 * We're in the initial view and there's no $_GET['orderby'] then check if the
     
    13971401                                                $order = $desc_first ? 'desc' : 'asc';
    13981402                                        }
    13991403
    1400                                         $class[]    = 'sortable';
    1401                                         $class[]    = 'desc' === $order ? 'asc' : 'desc';
    1402                                         $order_text = 'asc' === $order ? __( 'Sort ascending.' ) : __( 'Sort descending.' );
     1404                                        $class[] = 'sortable';
     1405                                        $class[] = 'desc' === $order ? 'asc' : 'desc';
     1406                                        /* translators: Hidden accessibility text. */
     1407                                        $asc_text = __( 'Sort ascending.' );
     1408                                        /* translators: Hidden accessibility text. */
     1409                                        $desc_text  = __( 'Sort descending.' );
     1410                                        $order_text = 'asc' === $order ? $asc_text : $desc_text;
    14031411                                }
    14041412                                if ( '' !== $order_text ) {
    14051413                                        $order_text = ' <span class="screen-reader-text">' . $order_text . '</span>';
     
    14281436         * For the table initial view, information about initial orderby and order
    14291437         * should be provided via get_sortable_columns().
    14301438         *
    1431          * @since 4.3.0
     1439         * @since 6.3.0
    14321440         * @access public
    14331441         */
    14341442        public function print_table_description() {
     
    14571465                foreach ( array_keys( $columns ) as $column_key ) {
    14581466
    14591467                        if ( isset( $sortable[ $column_key ] ) ) {
     1468                                $orderby       = isset( $sortable[ $column_key ][0] ) ? $sortable[ $column_key ][0] : '';
     1469                                $desc_first    = isset( $sortable[ $column_key ][1] ) ? $sortable[ $column_key ][1] : false;
     1470                                $abbr          = isset( $sortable[ $column_key ][2] ) ? $sortable[ $column_key ][2] : '';
     1471                                $orderby_text  = isset( $sortable[ $column_key ][3] ) ? $sortable[ $column_key ][3] : '';
     1472                                $initial_order = isset( $sortable[ $column_key ][4] ) ? $sortable[ $column_key ][4] : '';
    14601473
    1461                                 list( $orderby, $desc_first, $abbr, $orderby_text, $initial_order ) = $sortable[ $column_key ];
    1462 
    14631474                                if ( ! is_string( $orderby_text ) || '' === $orderby_text ) {
    14641475                                        return;
    14651476                                }
     
    14791490                                 * and true in the sorted views when the actual $_GET['orderby'] is equal to $orderby.
    14801491                                 */
    14811492                                if ( $current_orderby == $orderby ) {
    1482                                         $order_text = 'asc' === $current_order ? __( 'Ascending.' ) : __( 'Descending.' );
    1483                                         echo '<caption  class="screen-reader-text">' . $orderby_text . ' ' . $order_text . '</p>';
     1493                                        /* translators: Hidden accessibility text. */
     1494                                        $asc_text = __( 'Ascending.' );
     1495                                        /* translators: Hidden accessibility text. */
     1496                                        $desc_text  = __( 'Descending.' );
     1497                                        $order_text = 'asc' === $current_order ? $asc_text : $desc_text;
     1498                                        echo '<caption class="screen-reader-text">' . $orderby_text . ' ' . $order_text . '</caption>';
    14841499
    14851500                                        return;
    14861501                                }