Changeset 42343 for trunk/src/wp-includes/class-walker-comment.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-walker-comment.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-walker-comment.php
r41688 r42343 36 36 * @todo Decouple this 37 37 */ 38 public $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID'); 38 public $db_fields = array( 39 'parent' => 'comment_parent', 40 'id' => 'comment_ID', 41 ); 39 42 40 43 /** … … 127 130 */ 128 131 public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { 129 if ( ! $element )132 if ( ! $element ) { 130 133 return; 134 } 131 135 132 136 $id_field = $this->db_fields['id']; 133 $id = $element->$id_field;137 $id = $element->$id_field; 134 138 135 139 parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); … … 140 144 * of the list. 141 145 */ 142 if ( $max_depth <= $depth + 1 && isset( $children_elements[ $id]) ) {143 foreach ( $children_elements[ $id ] as $child ) 146 if ( $max_depth <= $depth + 1 && isset( $children_elements[ $id ] ) ) { 147 foreach ( $children_elements[ $id ] as $child ) { 144 148 $this->display_element( $child, $children_elements, $max_depth, $depth, $args, $output ); 149 } 145 150 146 151 unset( $children_elements[ $id ] ); … … 168 173 $depth++; 169 174 $GLOBALS['comment_depth'] = $depth; 170 $GLOBALS['comment'] = $comment;171 172 if ( ! empty( $args['callback'] ) ) {175 $GLOBALS['comment'] = $comment; 176 177 if ( ! empty( $args['callback'] ) ) { 173 178 ob_start(); 174 179 call_user_func( $args['callback'], $comment, $args, $depth ); … … 206 211 */ 207 212 public function end_el( &$output, $comment, $depth = 0, $args = array() ) { 208 if ( ! empty( $args['end-callback'] ) ) {213 if ( ! empty( $args['end-callback'] ) ) { 209 214 ob_start(); 210 215 call_user_func( $args['end-callback'], $comment, $args, $depth ); … … 212 217 return; 213 218 } 214 if ( 'div' == $args['style'] ) 219 if ( 'div' == $args['style'] ) { 215 220 $output .= "</div><!-- #comment-## -->\n"; 216 else221 } else { 217 222 $output .= "</li><!-- #comment-## -->\n"; 223 } 218 224 } 219 225 … … 252 258 protected function comment( $comment, $depth, $args ) { 253 259 if ( 'div' == $args['style'] ) { 254 $tag = 'div';260 $tag = 'div'; 255 261 $add_below = 'comment'; 256 262 } else { 257 $tag = 'li';263 $tag = 'li'; 258 264 $add_below = 'div-comment'; 259 265 } … … 264 270 <?php endif; ?> 265 271 <div class="comment-author vcard"> 266 <?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?> 272 <?php 273 if ( 0 != $args['avatar_size'] ) { 274 echo get_avatar( $comment, $args['avatar_size'] );} 275 ?> 267 276 <?php 268 277 /* translators: %s: comment author link */ 269 printf( __( '%s <span class="says">says:</span>' ), 278 printf( 279 __( '%s <span class="says">says:</span>' ), 270 280 sprintf( '<cite class="fn">%s</cite>', get_comment_author_link( $comment ) ) 271 281 ); … … 273 283 </div> 274 284 <?php if ( '0' == $comment->comment_approved ) : ?> 275 <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ) ?></em>285 <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ); ?></em> 276 286 <br /> 277 287 <?php endif; ?> … … 280 290 <?php 281 291 /* translators: 1: comment date, 2: comment time */ 282 printf( __( '%1$s at %2$s' ), get_comment_date( '', $comment ), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)' ), ' ', '' ); 292 printf( __( '%1$s at %2$s' ), get_comment_date( '', $comment ), get_comment_time() ); 293 ?> 294 </a> 295 <?php 296 edit_comment_link( __( '(Edit)' ), ' ', '' ); 283 297 ?> 284 298 </div> 285 299 286 <?php comment_text( $comment, array_merge( $args, array( 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>287 288 300 <?php 289 comment_reply_link( array_merge( $args, array( 290 'add_below' => $add_below, 291 'depth' => $depth, 292 'max_depth' => $args['max_depth'], 293 'before' => '<div class="reply">', 294 'after' => '</div>' 295 ) ) ); 301 comment_text( 302 $comment, array_merge( 303 $args, array( 304 'add_below' => $add_below, 305 'depth' => $depth, 306 'max_depth' => $args['max_depth'], 307 ) 308 ) 309 ); 310 ?> 311 312 <?php 313 comment_reply_link( 314 array_merge( 315 $args, array( 316 'add_below' => $add_below, 317 'depth' => $depth, 318 'max_depth' => $args['max_depth'], 319 'before' => '<div class="reply">', 320 'after' => '</div>', 321 ) 322 ) 323 ); 296 324 ?> 297 325 … … 320 348 <footer class="comment-meta"> 321 349 <div class="comment-author vcard"> 322 <?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?> 350 <?php 351 if ( 0 != $args['avatar_size'] ) { 352 echo get_avatar( $comment, $args['avatar_size'] );} 353 ?> 323 354 <?php 324 355 /* translators: %s: comment author link */ 325 printf( __( '%s <span class="says">says:</span>' ), 356 printf( 357 __( '%s <span class="says">says:</span>' ), 326 358 sprintf( '<b class="fn">%s</b>', get_comment_author_link( $comment ) ) 327 359 ); … … 351 383 352 384 <?php 353 comment_reply_link( array_merge( $args, array( 354 'add_below' => 'div-comment', 355 'depth' => $depth, 356 'max_depth' => $args['max_depth'], 357 'before' => '<div class="reply">', 358 'after' => '</div>' 359 ) ) ); 385 comment_reply_link( 386 array_merge( 387 $args, array( 388 'add_below' => 'div-comment', 389 'depth' => $depth, 390 'max_depth' => $args['max_depth'], 391 'before' => '<div class="reply">', 392 'after' => '</div>', 393 ) 394 ) 395 ); 360 396 ?> 361 397 </article><!-- .comment-body -->
Note: See TracChangeset
for help on using the changeset viewer.