Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 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-links-list-table.php

    r41161 r42343  
    2828     */
    2929    public function __construct( $args = array() ) {
    30         parent::__construct( array(
    31             'plural' => 'bookmarks',
    32             'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
    33         ) );
    34     }
    35 
    36     /**
    37      *
     30        parent::__construct(
     31            array(
     32                'plural' => 'bookmarks',
     33                'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
     34            )
     35        );
     36    }
     37
     38    /**
    3839     * @return bool
    3940     */
     
    4344
    4445    /**
    45      *
    4646     * @global int    $cat_id
    4747     * @global string $s
     
    5454        wp_reset_vars( array( 'action', 'cat_id', 'link_id', 'orderby', 'order', 's' ) );
    5555
    56         $args = array( 'hide_invisible' => 0, 'hide_empty' => 0 );
    57 
    58         if ( 'all' != $cat_id )
     56        $args = array(
     57            'hide_invisible' => 0,
     58            'hide_empty'     => 0,
     59        );
     60
     61        if ( 'all' != $cat_id ) {
    5962            $args['category'] = $cat_id;
    60         if ( !empty( $s ) )
     63        }
     64        if ( ! empty( $s ) ) {
    6165            $args['search'] = $s;
    62         if ( !empty( $orderby ) )
     66        }
     67        if ( ! empty( $orderby ) ) {
    6368            $args['orderby'] = $orderby;
    64         if ( !empty( $order ) )
     69        }
     70        if ( ! empty( $order ) ) {
    6571            $args['order'] = $order;
     72        }
    6673
    6774        $this->items = get_bookmarks( $args );
     
    7582
    7683    /**
    77      *
    7884     * @return array
    7985     */
    8086    protected function get_bulk_actions() {
    81         $actions = array();
     87        $actions           = array();
    8288        $actions['delete'] = __( 'Delete' );
    8389
     
    8692
    8793    /**
    88      *
    8994     * @global int $cat_id
    9095     * @param string $which
     
    9398        global $cat_id;
    9499
    95         if ( 'top' != $which )
     100        if ( 'top' != $which ) {
    96101            return;
     102        }
    97103?>
    98104        <div class="alignleft actions">
    99105<?php
    100106            $dropdown_options = array(
    101                 'selected' => $cat_id,
    102                 'name' => 'cat_id',
    103                 'taxonomy' => 'link_category',
     107                'selected'        => $cat_id,
     108                'name'            => 'cat_id',
     109                'taxonomy'        => 'link_category',
    104110                'show_option_all' => get_taxonomy( 'link_category' )->labels->all_items,
    105                 'hide_empty' => true,
    106                 'hierarchical' => 1,
    107                 'show_count' => 0,
    108                 'orderby' => 'name',
     111                'hide_empty'      => true,
     112                'hierarchical'    => 1,
     113                'show_count'      => 0,
     114                'orderby'         => 'name',
    109115            );
    110116
     
    118124
    119125    /**
    120      *
    121126     * @return array
    122127     */
     
    129134            'rel'        => __( 'Relationship' ),
    130135            'visible'    => __( 'Visible' ),
    131             'rating'     => __( 'Rating' )
    132         );
    133     }
    134 
    135     /**
    136      *
     136            'rating'     => __( 'Rating' ),
     137        );
     138    }
     139
     140    /**
    137141     * @return array
    138142     */
     
    142146            'url'     => 'url',
    143147            'visible' => 'visible',
    144             'rating'  => 'rating'
     148            'rating'  => 'rating',
    145149        );
    146150    }
     
    180184    public function column_name( $link ) {
    181185        $edit_link = get_edit_bookmark_link( $link );
    182         printf( '<strong><a class="row-title" href="%s" aria-label="%s">%s</a></strong>',
     186        printf(
     187            '<strong><a class="row-title" href="%s" aria-label="%s">%s</a></strong>',
    183188            $edit_link,
    184189            /* translators: %s: link name */
     
    286291    public function display_rows() {
    287292        foreach ( $this->items as $link ) {
    288             $link = sanitize_bookmark( $link );
    289             $link->link_name = esc_attr( $link->link_name );
     293            $link                = sanitize_bookmark( $link );
     294            $link->link_name     = esc_attr( $link->link_name );
    290295            $link->link_category = wp_get_link_cats( $link->link_id );
    291296?>
    292297        <tr id="link-<?php echo $link->link_id; ?>">
    293             <?php $this->single_row_columns( $link ) ?>
     298            <?php $this->single_row_columns( $link ); ?>
    294299        </tr>
    295300<?php
     
    314319        $edit_link = get_edit_bookmark_link( $link );
    315320
    316         $actions = array();
    317         $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
    318         $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm( '" . esc_js(sprintf(__("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name)) . "' ) ) { return true;}return false;\">" . __('Delete') . "</a>";
     321        $actions           = array();
     322        $actions['edit']   = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
     323        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( "You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ) . "' ) ) { return true;}return false;\">" . __( 'Delete' ) . '</a>';
    319324        return $this->row_actions( $actions );
    320325    }
Note: See TracChangeset for help on using the changeset viewer.