Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

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

    r42151 r42343  
    9292     * @var array
    9393     */
    94     protected $compat_methods = array( 'set_pagination_args', 'get_views', 'get_bulk_actions', 'bulk_actions',
    95         'row_actions', 'months_dropdown', 'view_switcher', 'comments_bubble', 'get_items_per_page', 'pagination',
    96         'get_sortable_columns', 'get_column_info', 'get_table_classes', 'display_tablenav', 'extra_tablenav',
    97         'single_row_columns' );
     94    protected $compat_methods = array(
     95        'set_pagination_args',
     96        'get_views',
     97        'get_bulk_actions',
     98        'bulk_actions',
     99        'row_actions',
     100        'months_dropdown',
     101        'view_switcher',
     102        'comments_bubble',
     103        'get_items_per_page',
     104        'pagination',
     105        'get_sortable_columns',
     106        'get_column_info',
     107        'get_table_classes',
     108        'display_tablenav',
     109        'extra_tablenav',
     110        'single_row_columns',
     111    );
    98112
    99113    /**
     
    123137     */
    124138    public function __construct( $args = array() ) {
    125         $args = wp_parse_args( $args, array(
    126             'plural' => '',
    127             'singular' => '',
    128             'ajax' => false,
    129             'screen' => null,
    130         ) );
     139        $args = wp_parse_args(
     140            $args, array(
     141                'plural'   => '',
     142                'singular' => '',
     143                'ajax'     => false,
     144                'screen'   => null,
     145            )
     146        );
    131147
    132148        $this->screen = convert_to_screen( $args['screen'] );
     
    134150        add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
    135151
    136         if ( !$args['plural'] )
     152        if ( ! $args['plural'] ) {
    137153            $args['plural'] = $this->screen->base;
    138 
    139         $args['plural'] = sanitize_key( $args['plural'] );
     154        }
     155
     156        $args['plural']   = sanitize_key( $args['plural'] );
    140157        $args['singular'] = sanitize_key( $args['singular'] );
    141158
     
    150167            $this->modes = array(
    151168                'list'    => __( 'List View' ),
    152                 'excerpt' => __( 'Excerpt View' )
     169                'excerpt' => __( 'Excerpt View' ),
    153170            );
    154171        }
     
    239256    /**
    240257     * Prepares the list of items for displaying.
     258     *
    241259     * @uses WP_List_Table::set_pagination_args()
    242260     *
     
    256274     */
    257275    protected function set_pagination_args( $args ) {
    258         $args = wp_parse_args( $args, array(
    259             'total_items' => 0,
    260             'total_pages' => 0,
    261             'per_page' => 0,
    262         ) );
    263 
    264         if ( !$args['total_pages'] && $args['per_page'] > 0 )
     276        $args = wp_parse_args(
     277            $args, array(
     278                'total_items' => 0,
     279                'total_pages' => 0,
     280                'per_page'    => 0,
     281            )
     282        );
     283
     284        if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
    265285            $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
     286        }
    266287
    267288        // Redirect if page number is invalid and headers are not already sent.
     
    288309        }
    289310
    290         if ( isset( $this->_pagination_args[$key] ) ) {
    291             return $this->_pagination_args[$key];
     311        if ( isset( $this->_pagination_args[ $key ] ) ) {
     312            return $this->_pagination_args[ $key ];
    292313        }
    293314    }
     
    301322     */
    302323    public function has_items() {
    303         return !empty( $this->items );
     324        return ! empty( $this->items );
    304325    }
    305326
     
    322343     */
    323344    public function search_box( $text, $input_id ) {
    324         if ( empty( $_REQUEST['s'] ) && !$this->has_items() )
     345        if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
    325346            return;
     347        }
    326348
    327349        $input_id = $input_id . '-search-input';
    328350
    329         if ( ! empty( $_REQUEST['orderby'] ) )
     351        if ( ! empty( $_REQUEST['orderby'] ) ) {
    330352            echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
    331         if ( ! empty( $_REQUEST['order'] ) )
     353        }
     354        if ( ! empty( $_REQUEST['order'] ) ) {
    332355            echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
    333         if ( ! empty( $_REQUEST['post_mime_type'] ) )
     356        }
     357        if ( ! empty( $_REQUEST['post_mime_type'] ) ) {
    334358            echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '" />';
    335         if ( ! empty( $_REQUEST['detached'] ) )
     359        }
     360        if ( ! empty( $_REQUEST['detached'] ) ) {
    336361            echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />';
     362        }
    337363?>
    338364<p class="search-box">
     
    375401        $views = apply_filters( "views_{$this->screen->id}", $views );
    376402
    377         if ( empty( $views ) )
     403        if ( empty( $views ) ) {
    378404            return;
     405        }
    379406
    380407        $this->screen->render_screen_reader_content( 'heading_views' );
     
    385412        }
    386413        echo implode( " |</li>\n", $views ) . "</li>\n";
    387         echo "</ul>";
     414        echo '</ul>';
    388415    }
    389416
     
    424451             */
    425452            $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions );
    426             $two = '';
     453            $two            = '';
    427454        } else {
    428455            $two = '2';
    429456        }
    430457
    431         if ( empty( $this->_actions ) )
     458        if ( empty( $this->_actions ) ) {
    432459            return;
     460        }
    433461
    434462        echo '<label for="bulk-action-selector-' . esc_attr( $which ) . '" class="screen-reader-text">' . __( 'Select bulk action' ) . '</label>';
     
    456484     */
    457485    public function current_action() {
    458         if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) )
     486        if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) {
    459487            return false;
    460 
    461         if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] )
     488        }
     489
     490        if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) {
    462491            return $_REQUEST['action'];
    463 
    464         if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] )
     492        }
     493
     494        if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] ) {
    465495            return $_REQUEST['action2'];
     496        }
    466497
    467498        return false;
     
    479510    protected function row_actions( $actions, $always_visible = false ) {
    480511        $action_count = count( $actions );
    481         $i = 0;
    482 
    483         if ( !$action_count )
     512        $i            = 0;
     513
     514        if ( ! $action_count ) {
    484515            return '';
     516        }
    485517
    486518        $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
     
    488520            ++$i;
    489521            ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
    490             $out .= "<span class='$action'>$link$sep</span>";
     522            $out                          .= "<span class='$action'>$link$sep</span>";
    491523        }
    492524        $out .= '</div>';
     
    529561        }
    530562
    531         $months = $wpdb->get_results( $wpdb->prepare( "
     563        $months = $wpdb->get_results(
     564            $wpdb->prepare(
     565                "
    532566            SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
    533567            FROM $wpdb->posts
     
    535569            $extra_checks
    536570            ORDER BY post_date DESC
    537         ", $post_type ) );
     571        ", $post_type
     572            )
     573        );
    538574
    539575        /**
     
    549585        $month_count = count( $months );
    550586
    551         if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
     587        if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
    552588            return;
     589        }
    553590
    554591        $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
     
    558595            <option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
    559596<?php
    560         foreach ( $months as $arc_row ) {
    561             if ( 0 == $arc_row->year )
    562                 continue;
    563 
    564             $month = zeroise( $arc_row->month, 2 );
    565             $year = $arc_row->year;
    566 
    567             printf( "<option %s value='%s'>%s</option>\n",
    568                 selected( $m, $year . $month, false ),
    569                 esc_attr( $arc_row->year . $month ),
    570                 /* translators: 1: month name, 2: 4-digit year */
    571                 sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
    572             );
    573         }
     597foreach ( $months as $arc_row ) {
     598    if ( 0 == $arc_row->year ) {
     599        continue;
     600    }
     601
     602    $month = zeroise( $arc_row->month, 2 );
     603    $year  = $arc_row->year;
     604
     605    printf(
     606        "<option %s value='%s'>%s</option>\n",
     607        selected( $m, $year . $month, false ),
     608        esc_attr( $arc_row->year . $month ),
     609        /* translators: 1: month name, 2: 4-digit year */
     610        sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
     611    );
     612}
    574613?>
    575614        </select>
     
    589628        <div class="view-switch">
    590629<?php
    591             foreach ( $this->modes as $mode => $title ) {
    592                 $classes = array( 'view-' . $mode );
    593                 if ( $current_mode === $mode )
    594                     $classes[] = 'current';
    595                 printf(
    596                     "<a href='%s' class='%s' id='view-switch-$mode'><span class='screen-reader-text'>%s</span></a>\n",
    597                     esc_url( add_query_arg( 'mode', $mode ) ),
    598                     implode( ' ', $classes ),
    599                     $title
    600                 );
    601             }
     630foreach ( $this->modes as $mode => $title ) {
     631    $classes = array( 'view-' . $mode );
     632    if ( $current_mode === $mode ) {
     633        $classes[] = 'current';
     634    }
     635    printf(
     636        "<a href='%s' class='%s' id='view-switch-$mode'><span class='screen-reader-text'>%s</span></a>\n",
     637        esc_url( add_query_arg( 'mode', $mode ) ),
     638        implode( ' ', $classes ),
     639        $title
     640    );
     641}
    602642        ?>
    603643        </div>
     
    617657
    618658        $approved_comments_number = number_format_i18n( $approved_comments );
    619         $pending_comments_number = number_format_i18n( $pending_comments );
     659        $pending_comments_number  = number_format_i18n( $pending_comments );
    620660
    621661        $approved_only_phrase = sprintf( _n( '%s comment', '%s comments', $approved_comments ), $approved_comments_number );
    622         $approved_phrase = sprintf( _n( '%s approved comment', '%s approved comments', $approved_comments ), $approved_comments_number );
    623         $pending_phrase = sprintf( _n( '%s pending comment', '%s pending comments', $pending_comments ), $pending_comments_number );
     662        $approved_phrase      = sprintf( _n( '%s approved comment', '%s approved comments', $approved_comments ), $approved_comments_number );
     663        $pending_phrase       = sprintf( _n( '%s pending comment', '%s pending comments', $pending_comments ), $pending_comments_number );
    624664
    625665        // No comments at all.
    626666        if ( ! $approved_comments && ! $pending_comments ) {
    627             printf( '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>',
     667            printf(
     668                '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>',
    628669                __( 'No comments' )
    629670            );
    630         // Approved comments have different display depending on some conditions.
     671            // Approved comments have different display depending on some conditions.
    631672        } elseif ( $approved_comments ) {
    632             printf( '<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
    633                 esc_url( add_query_arg( array( 'p' => $post_id, 'comment_status' => 'approved' ), admin_url( 'edit-comments.php' ) ) ),
     673            printf(
     674                '<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
     675                esc_url(
     676                    add_query_arg(
     677                        array(
     678                            'p'              => $post_id,
     679                            'comment_status' => 'approved',
     680                        ), admin_url( 'edit-comments.php' )
     681                    )
     682                ),
    634683                $approved_comments_number,
    635684                $pending_comments ? $approved_phrase : $approved_only_phrase
    636685            );
    637686        } else {
    638             printf( '<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
     687            printf(
     688                '<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
    639689                $approved_comments_number,
    640690                $pending_comments ? __( 'No approved comments' ) : __( 'No comments' )
     
    643693
    644694        if ( $pending_comments ) {
    645             printf( '<a href="%s" class="post-com-count post-com-count-pending"><span class="comment-count-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
    646                 esc_url( add_query_arg( array( 'p' => $post_id, 'comment_status' => 'moderated' ), admin_url( 'edit-comments.php' ) ) ),
     695            printf(
     696                '<a href="%s" class="post-com-count post-com-count-pending"><span class="comment-count-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
     697                esc_url(
     698                    add_query_arg(
     699                        array(
     700                            'p'              => $post_id,
     701                            'comment_status' => 'moderated',
     702                        ), admin_url( 'edit-comments.php' )
     703                    )
     704                ),
    647705                $pending_comments_number,
    648706                $pending_phrase
    649707            );
    650708        } else {
    651             printf( '<span class="post-com-count post-com-count-pending post-com-count-no-pending"><span class="comment-count comment-count-no-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
     709            printf(
     710                '<span class="post-com-count post-com-count-pending post-com-count-no-pending"><span class="comment-count comment-count-no-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
    652711                $pending_comments_number,
    653712                $approved_comments ? __( 'No pending comments' ) : __( 'No comments' )
     
    666725        $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
    667726
    668         if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] )
     727        if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) {
    669728            $pagenum = $this->_pagination_args['total_pages'];
     729        }
    670730
    671731        return max( 1, $pagenum );
     
    683743    protected function get_items_per_page( $option, $default = 20 ) {
    684744        $per_page = (int) get_user_option( $option );
    685         if ( empty( $per_page ) || $per_page < 1 )
     745        if ( empty( $per_page ) || $per_page < 1 ) {
    686746            $per_page = $default;
     747        }
    687748
    688749        /**
     
    714775        }
    715776
    716         $total_items = $this->_pagination_args['total_items'];
    717         $total_pages = $this->_pagination_args['total_pages'];
     777        $total_items     = $this->_pagination_args['total_items'];
     778        $total_pages     = $this->_pagination_args['total_pages'];
    718779        $infinite_scroll = false;
    719780        if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
     
    727788        $output = '<span class="displaying-num">' . sprintf( _n( '%s item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
    728789
    729         $current = $this->get_pagenum();
     790        $current              = $this->get_pagenum();
    730791        $removable_query_args = wp_removable_query_args();
    731792
     
    741802        $disable_first = $disable_last = $disable_prev = $disable_next = false;
    742803
    743         if ( $current == 1 ) {
     804        if ( $current == 1 ) {
    744805            $disable_first = true;
    745             $disable_prev = true;
    746         }
     806            $disable_prev  = true;
     807        }
    747808        if ( $current == 2 ) {
    748809            $disable_first = true;
    749810        }
    750         if ( $current == $total_pages ) {
     811        if ( $current == $total_pages ) {
    751812            $disable_last = true;
    752813            $disable_next = true;
    753         }
     814        }
    754815        if ( $current == $total_pages - 1 ) {
    755816            $disable_last = true;
     
    759820            $page_links[] = '<span class="tablenav-pages-navspan" aria-hidden="true">&laquo;</span>';
    760821        } else {
    761             $page_links[] = sprintf( "<a class='first-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
     822            $page_links[] = sprintf(
     823                "<a class='first-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
    762824                esc_url( remove_query_arg( 'paged', $current_url ) ),
    763825                __( 'First page' ),
     
    769831            $page_links[] = '<span class="tablenav-pages-navspan" aria-hidden="true">&lsaquo;</span>';
    770832        } else {
    771             $page_links[] = sprintf( "<a class='prev-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
    772                 esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
     833            $page_links[] = sprintf(
     834                "<a class='prev-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
     835                esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ),
    773836                __( 'Previous page' ),
    774837                '&lsaquo;'
     
    780843            $total_pages_before = '<span class="screen-reader-text">' . __( 'Current Page' ) . '</span><span id="table-paging" class="paging-input"><span class="tablenav-paging-text">';
    781844        } else {
    782             $html_current_page = sprintf( "%s<input class='current-page' id='current-page-selector' type='text' name='paged' value='%s' size='%d' aria-describedby='table-paging' /><span class='tablenav-paging-text'>",
     845            $html_current_page = sprintf(
     846                "%s<input class='current-page' id='current-page-selector' type='text' name='paged' value='%s' size='%d' aria-describedby='table-paging' /><span class='tablenav-paging-text'>",
    783847                '<label for="current-page-selector" class="screen-reader-text">' . __( 'Current Page' ) . '</label>',
    784848                $current,
     
    787851        }
    788852        $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
    789         $page_links[] = $total_pages_before . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . $total_pages_after;
     853        $page_links[]     = $total_pages_before . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . $total_pages_after;
    790854
    791855        if ( $disable_next ) {
    792856            $page_links[] = '<span class="tablenav-pages-navspan" aria-hidden="true">&rsaquo;</span>';
    793857        } else {
    794             $page_links[] = sprintf( "<a class='next-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
    795                 esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
     858            $page_links[] = sprintf(
     859                "<a class='next-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
     860                esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ),
    796861                __( 'Next page' ),
    797862                '&rsaquo;'
     
    802867            $page_links[] = '<span class="tablenav-pages-navspan" aria-hidden="true">&raquo;</span>';
    803868        } else {
    804             $page_links[] = sprintf( "<a class='last-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
     869            $page_links[] = sprintf(
     870                "<a class='last-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
    805871                esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
    806872                __( 'Last page' ),
     
    863929    protected function get_default_primary_column_name() {
    864930        $columns = $this->get_columns();
    865         $column = '';
     931        $column  = '';
    866932
    867933        if ( empty( $columns ) ) {
     
    919985         * @param string $context Screen ID for specific list table, e.g. 'plugins'.
    920986         */
    921         $column  = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
     987        $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
    922988
    923989        if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {
     
    9491015
    9501016        $columns = get_column_headers( $this->screen );
    951         $hidden = get_hidden_columns( $this->screen );
     1017        $hidden  = get_hidden_columns( $this->screen );
    9521018
    9531019        $sortable_columns = $this->get_sortable_columns();
     
    9661032        $sortable = array();
    9671033        foreach ( $_sortable as $id => $data ) {
    968             if ( empty( $data ) )
     1034            if ( empty( $data ) ) {
    9691035                continue;
     1036            }
    9701037
    9711038            $data = (array) $data;
    972             if ( !isset( $data[1] ) )
     1039            if ( ! isset( $data[1] ) ) {
    9731040                $data[1] = false;
    974 
    975             $sortable[$id] = $data;
    976         }
    977 
    978         $primary = $this->get_primary_column_name();
     1041            }
     1042
     1043            $sortable[ $id ] = $data;
     1044        }
     1045
     1046        $primary               = $this->get_primary_column_name();
    9791047        $this->_column_headers = array( $columns, $hidden, $sortable, $primary );
    9801048
     
    9911059    public function get_column_count() {
    9921060        list ( $columns, $hidden ) = $this->get_column_info();
    993         $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
     1061        $hidden                    = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
    9941062        return count( $columns ) - count( $hidden );
    9951063    }
     
    10241092        if ( ! empty( $columns['cb'] ) ) {
    10251093            static $cb_counter = 1;
    1026             $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
     1094            $columns['cb']     = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
    10271095                . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
    10281096            $cb_counter++;
     
    10361104            }
    10371105
    1038             if ( 'cb' === $column_key )
     1106            if ( 'cb' === $column_key ) {
    10391107                $class[] = 'check-column';
    1040             elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) )
     1108            } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) {
    10411109                $class[] = 'num';
     1110            }
    10421111
    10431112            if ( $column_key === $primary ) {
     
    10451114            }
    10461115
    1047             if ( isset( $sortable[$column_key] ) ) {
    1048                 list( $orderby, $desc_first ) = $sortable[$column_key];
     1116            if ( isset( $sortable[ $column_key ] ) ) {
     1117                list( $orderby, $desc_first ) = $sortable[ $column_key ];
    10491118
    10501119                if ( $current_orderby === $orderby ) {
    1051                     $order = 'asc' === $current_order ? 'desc' : 'asc';
     1120                    $order   = 'asc' === $current_order ? 'desc' : 'asc';
    10521121                    $class[] = 'sorted';
    10531122                    $class[] = $current_order;
    10541123                } else {
    1055                     $order = $desc_first ? 'desc' : 'asc';
     1124                    $order   = $desc_first ? 'desc' : 'asc';
    10561125                    $class[] = 'sortable';
    10571126                    $class[] = $desc_first ? 'asc' : 'desc';
     
    10611130            }
    10621131
    1063             $tag = ( 'cb' === $column_key ) ? 'td' : 'th';
     1132            $tag   = ( 'cb' === $column_key ) ? 'td' : 'th';
    10641133            $scope = ( 'th' === $tag ) ? 'scope="col"' : '';
    1065             $id = $with_id ? "id='$column_key'" : '';
    1066 
    1067             if ( !empty( $class ) )
     1134            $id    = $with_id ? "id='$column_key'" : '';
     1135
     1136            if ( ! empty( $class ) ) {
    10681137                $class = "class='" . join( ' ', $class ) . "'";
     1138            }
    10691139
    10701140            echo "<$tag $scope $id $class>$column_display_name</$tag>";
     
    10911161    </thead>
    10921162
    1093     <tbody id="the-list"<?php
    1094         if ( $singular ) {
    1095             echo " data-wp-lists='list:$singular'";
    1096         } ?>>
     1163    <tbody id="the-list"
     1164    <?php
     1165    if ( $singular ) {
     1166        echo " data-wp-lists='list:$singular'";
     1167    }
     1168        ?>
     1169        >
    10971170        <?php $this->display_rows_or_placeholder(); ?>
    10981171    </tbody>
     
    11331206    <div class="tablenav <?php echo esc_attr( $which ); ?>">
    11341207
    1135         <?php if ( $this->has_items() ): ?>
     1208        <?php if ( $this->has_items() ) : ?>
    11361209        <div class="alignleft actions bulkactions">
    11371210            <?php $this->bulk_actions( $which ); ?>
    11381211        </div>
    1139         <?php endif;
     1212        <?php
     1213        endif;
    11401214        $this->extra_tablenav( $which );
    11411215        $this->pagination( $which );
     
    11771251     */
    11781252    public function display_rows() {
    1179         foreach ( $this->items as $item )
     1253        foreach ( $this->items as $item ) {
    11801254            $this->single_row( $item );
     1255        }
    11811256    }
    11821257
     
    11951270
    11961271    /**
    1197      *
    11981272     * @param object $item
    11991273     * @param string $column_name
     
    12021276
    12031277    /**
    1204      *
    12051278     * @param object $item
    12061279     */
     
    12491322                echo call_user_func( array( $this, 'column_' . $column_name ), $item );
    12501323                echo $this->handle_row_actions( $item, $column_name, $primary );
    1251                 echo "</td>";
     1324                echo '</td>';
    12521325            } else {
    12531326                echo "<td $attributes>";
    12541327                echo $this->column_default( $item, $column_name );
    12551328                echo $this->handle_row_actions( $item, $column_name, $primary );
    1256                 echo "</td>";
     1329                echo '</td>';
    12571330            }
    12581331        }
     
    12711344    protected function handle_row_actions( $item, $column_name, $primary ) {
    12721345        return $column_name === $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>' : '';
    1273     }
     1346    }
    12741347
    12751348    /**
     
    12991372        }
    13001373        if ( isset( $this->_pagination_args['total_pages'] ) ) {
    1301             $response['total_pages'] = $this->_pagination_args['total_pages'];
     1374            $response['total_pages']      = $this->_pagination_args['total_pages'];
    13021375            $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
    13031376        }
     
    13081381    /**
    13091382     * Send required variables to JavaScript land
    1310      *
    13111383     */
    13121384    public function _js_vars() {
     
    13161388                'id'   => $this->screen->id,
    13171389                'base' => $this->screen->base,
    1318             )
     1390            ),
    13191391        );
    13201392
Note: See TracChangeset for help on using the changeset viewer.