Make WordPress Core

Ticket #14041: 14041.diff

File 14041.diff, 2.5 KB (added by obenland, 10 years ago)

Refreshed patch

  • src/wp-includes/class-wp-walker.php

     
    4040        protected $max_pages = 1;
    4141
    4242        /**
     43         * Wether the current element has children or not. To be used in start_el()
     44         *
     45         * @since 4.0.0
     46         * @var bool
     47         * @access protected
     48         */
     49        protected $has_children;
     50
     51        /**
    4352         * Make private properties readable for backwards compatibility
    4453         *
    4554         * @since 4.0.0
     
    172181                        return;
    173182
    174183                $id_field = $this->db_fields['id'];
     184                $id       = $element->$id_field;
    175185
    176186                //display this element
    177                 if ( isset( $args[0] ) && is_array( $args[0] ) )
    178                         $args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] );
     187                $this->has_children = ! empty( $children_elements[ $id ] );
     188                if ( isset( $args[0] ) && is_array( $args[0] ) ) {
     189                        $args[0]['has_children'] = $this->has_children; // Backwards compatibility.
     190                }
     191
    179192                $cb_args = array_merge( array(&$output, $element, $depth), $args);
    180193                call_user_func_array(array($this, 'start_el'), $cb_args);
    181194
    182                 $id = $element->$id_field;
    183 
    184195                // descend only when the depth is right and there are childrens for this element
    185196                if ( ($max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id]) ) {
    186197
  • src/wp-includes/comment-template.php

     
    17861786                        $add_below = 'div-comment';
    17871787                }
    17881788?>
    1789                 <<?php echo $tag; ?> <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?> id="comment-<?php comment_ID(); ?>">
     1789                <<?php echo $tag; ?> <?php comment_class( $this->has_children ? 'parent' : '' ); ?> id="comment-<?php comment_ID(); ?>">
    17901790                <?php if ( 'div' != $args['style'] ) : ?>
    17911791                <div id="div-comment-<?php comment_ID(); ?>" class="comment-body">
    17921792                <?php endif; ?>
     
    18321832        protected function html5_comment( $comment, $depth, $args ) {
    18331833                $tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
    18341834?>
    1835                 <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>>
     1835                <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'parent' : '' ); ?>>
    18361836                        <article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
    18371837                                <footer class="comment-meta">
    18381838                                        <div class="comment-author vcard">