Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (9 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-includes/class-walker-category.php

    r42201 r42343  
    3636         * @todo Decouple this
    3737         */
    38         public $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
     38        public $db_fields = array(
     39                'parent' => 'parent',
     40                'id'     => 'term_id',
     41        );
    3942
    4043        /**
     
    5154         */
    5255        public function start_lvl( &$output, $depth = 0, $args = array() ) {
    53                 if ( 'list' != $args['style'] )
    54                         return;
    55 
    56                 $indent = str_repeat("\t", $depth);
     56                if ( 'list' != $args['style'] ) {
     57                        return;
     58                }
     59
     60                $indent  = str_repeat( "\t", $depth );
    5761                $output .= "$indent<ul class='children'>\n";
    5862        }
     
    7175         */
    7276        public function end_lvl( &$output, $depth = 0, $args = array() ) {
    73                 if ( 'list' != $args['style'] )
    74                         return;
    75 
    76                 $indent = str_repeat("\t", $depth);
     77                if ( 'list' != $args['style'] ) {
     78                        return;
     79                }
     80
     81                $indent  = str_repeat( "\t", $depth );
    7782                $output .= "$indent</ul>\n";
    7883        }
     
    130135
    131136                        if ( empty( $args['feed'] ) ) {
    132                                 $alt = ' alt="' . sprintf(__( 'Feed for all posts filed under %s' ), $cat_name ) . '"';
     137                                $alt = ' alt="' . sprintf( __( 'Feed for all posts filed under %s' ), $cat_name ) . '"';
    133138                        } else {
    134                                 $alt = ' alt="' . $args['feed'] . '"';
    135                                 $name = $args['feed'];
     139                                $alt   = ' alt="' . $args['feed'] . '"';
     140                                $name  = $args['feed'];
    136141                                $link .= empty( $args['title'] ) ? '' : $args['title'];
    137142                        }
     
    155160                }
    156161                if ( 'list' == $args['style'] ) {
    157                         $output .= "\t<li";
     162                        $output     .= "\t<li";
    158163                        $css_classes = array(
    159164                                'cat-item',
     
    163168                        if ( ! empty( $args['current_category'] ) ) {
    164169                                // 'current_category' can be an array, so we use `get_terms()`.
    165                                 $_current_terms = get_terms( $category->taxonomy, array(
    166                                         'include' => $args['current_category'],
    167                                         'hide_empty' => false,
    168                                 ) );
     170                                $_current_terms = get_terms(
     171                                        $category->taxonomy, array(
     172                                                'include'    => $args['current_category'],
     173                                                'hide_empty' => false,
     174                                        )
     175                                );
    169176
    170177                                foreach ( $_current_terms as $_current_term ) {
     
    176183                                        while ( $_current_term->parent ) {
    177184                                                if ( $category->term_id == $_current_term->parent ) {
    178                                                         $css_classes[] =  'current-cat-ancestor';
     185                                                        $css_classes[] = 'current-cat-ancestor';
    179186                                                        break;
    180187                                                }
     
    198205                        $css_classes = implode( ' ', apply_filters( 'category_css_class', $css_classes, $category, $depth, $args ) );
    199206
    200                         $output .=  ' class="' . $css_classes . '"';
     207                        $output .= ' class="' . $css_classes . '"';
    201208                        $output .= ">$link\n";
    202209                } elseif ( isset( $args['separator'] ) ) {
     
    221228         */
    222229        public function end_el( &$output, $page, $depth = 0, $args = array() ) {
    223                 if ( 'list' != $args['style'] )
    224                         return;
     230                if ( 'list' != $args['style'] ) {
     231                        return;
     232                }
    225233
    226234                $output .= "</li>\n";
Note: See TracChangeset for help on using the changeset viewer.