Make WordPress Core


Ignore:
Timestamp:
09/22/2015 06:05:39 AM (10 years ago)
Author:
wonderboymusic
Message:

List Tables: when comparing string literals (non-numeric in nature) against vars, strict comparison can/should be used.

Props wonderboymusic, Viper007Bond.
Fixes #21249.

File:
1 edited

Legend:

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

    r34229 r34383  
    284284     */
    285285    public function get_pagination_arg( $key ) {
    286         if ( 'page' == $key )
     286        if ( 'page' === $key ) {
    287287            return $this->get_pagenum();
    288 
    289         if ( isset( $this->_pagination_args[$key] ) )
     288        }
     289
     290        if ( isset( $this->_pagination_args[$key] ) ) {
    290291            return $this->_pagination_args[$key];
     292        }
    291293    }
    292294
     
    441443
    442444        foreach ( $this->_actions as $name => $title ) {
    443             $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
     445            $class = 'edit' === $name ? ' class="hide-if-no-js"' : '';
    444446
    445447            echo "\t<option value='$name'$class>$title</option>\n";
     
    599601            foreach ( $this->modes as $mode => $title ) {
    600602                $classes = array( 'view-' . $mode );
    601                 if ( $current_mode == $mode )
     603                if ( $current_mode === $mode )
    602604                    $classes[] = 'current';
    603605                printf(
     
    783785        }
    784786
    785         if ( 'bottom' == $which ) {
     787        if ( 'bottom' === $which ) {
    786788            $html_current_page  = $current;
    787789            $total_pages_before = '<span class="screen-reader-text">' . __( 'Current Page' ) . '</span><span id="table-paging" class="paging-input">';
     
    10261028            $current_orderby = '';
    10271029
    1028         if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] )
     1030        if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] )
    10291031            $current_order = 'desc';
    10301032        else
     
    10451047            }
    10461048
    1047             if ( 'cb' == $column_key )
     1049            if ( 'cb' === $column_key )
    10481050                $class[] = 'check-column';
    10491051            elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) )
     
    10571059                list( $orderby, $desc_first ) = $sortable[$column_key];
    10581060
    1059                 if ( $current_orderby == $orderby ) {
    1060                     $order = 'asc' == $current_order ? 'desc' : 'asc';
     1061                if ( $current_orderby === $orderby ) {
     1062                    $order = 'asc' === $current_order ? 'desc' : 'asc';
    10611063                    $class[] = 'sorted';
    10621064                    $class[] = $current_order;
     
    11371139     */
    11381140    protected function display_tablenav( $which ) {
    1139         if ( 'top' == $which )
     1141        if ( 'top' === $which ) {
    11401142            wp_nonce_field( 'bulk-' . $this->_args['plural'] );
    1141 
     1143        }
    11421144        if ( $this->has_items() ) : ?>
    11431145    <div class="tablenav <?php echo esc_attr( $which ); ?>">
     
    12481250            $attributes = "class='$classes' $data";
    12491251
    1250             if ( 'cb' == $column_name ) {
     1252            if ( 'cb' === $column_name ) {
    12511253                echo '<th scope="row" class="check-column">';
    12521254                echo $this->column_cb( $item );
     
    12861288     */
    12871289    protected function handle_row_actions( $item, $column_name, $primary ) {
    1288         return $column_name == $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>' : '';
     1290        return $column_name === $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>' : '';
    12891291    }
    12901292
Note: See TracChangeset for help on using the changeset viewer.