Ticket #10948: 10948.2.diff
File 10948.2.diff, 4.7 KB (added by , 12 years ago) |
---|
-
wp-includes/comment-template.php
1244 1244 case 'div': 1245 1245 break; 1246 1246 case 'ol': 1247 echo'<ol class="children">' . "\n";1247 $output .= '<ol class="children">' . "\n"; 1248 1248 break; 1249 1249 default: 1250 1250 case 'ul': 1251 echo'<ul class="children">' . "\n";1251 $output .= '<ul class="children">' . "\n"; 1252 1252 break; 1253 1253 } 1254 1254 } … … 1268 1268 case 'div': 1269 1269 break; 1270 1270 case 'ol': 1271 echo"</ol><!-- .children -->\n";1271 $output .= "</ol><!-- .children -->\n"; 1272 1272 break; 1273 1273 default: 1274 1274 case 'ul': 1275 echo"</ul><!-- .children -->\n";1275 $output .= "</ul><!-- .children -->\n"; 1276 1276 break; 1277 1277 } 1278 1278 } … … 1331 1331 $GLOBALS['comment'] = $comment; 1332 1332 1333 1333 if ( !empty( $args['callback'] ) ) { 1334 ob_start(); 1334 1335 call_user_func( $args['callback'], $comment, $args, $depth ); 1336 $output .= ob_get_clean(); 1335 1337 return; 1336 1338 } 1337 1339 1338 1340 if ( ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) && $args['short_ping'] ) { 1339 $this->ping( $ comment, $depth, $args );1341 $this->ping( $output, $comment, $depth, $args ); 1340 1342 } elseif ( 'html5' === $args['format'] ) { 1341 $this->html5_comment( $ comment, $depth, $args );1343 $this->html5_comment( $output, $comment, $depth, $args ); 1342 1344 } else { 1343 $this->comment( $ comment, $depth, $args );1345 $this->comment( $output, $comment, $depth, $args ); 1344 1346 } 1345 1347 } 1346 1348 … … 1355 1357 */ 1356 1358 function end_el( &$output, $comment, $depth = 0, $args = array() ) { 1357 1359 if ( !empty( $args['end-callback'] ) ) { 1360 ob_start(); 1358 1361 call_user_func( $args['end-callback'], $comment, $args, $depth ); 1362 $output .= ob_get_clean(); 1359 1363 return; 1360 1364 } 1361 1365 if ( 'div' == $args['style'] ) 1362 echo"</div><!-- #comment-## -->\n";1366 $output .= "</div><!-- #comment-## -->\n"; 1363 1367 else 1364 echo"</li><!-- #comment-## -->\n";1368 $output .= "</li><!-- #comment-## -->\n"; 1365 1369 } 1366 1370 1367 1371 /** 1368 1372 * @since 3.6 1369 1373 * @access protected 1370 1374 * 1375 * @param string $output Passed by reference. Used to append additional content. 1371 1376 * @param object $comment 1372 1377 * @param int $depth Depth of comment. 1373 1378 * @param array $args 1374 1379 */ 1375 protected function ping( $comment, $depth, $args ) {1380 protected function ping( &$output, $comment, $depth, $args ) { 1376 1381 $tag = ( 'div' == $args['style'] ) ? 'div' : 'li'; 1382 ob_start(); 1377 1383 ?> 1378 1384 <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>> 1379 1385 <div class="comment-body"> 1380 1386 <?php _e( 'Pingback:' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?> 1381 1387 </div> 1382 1388 <?php 1389 $output .= ob_get_clean(); 1383 1390 } 1384 1391 1385 1392 /** 1386 1393 * @since 3.6 1387 1394 * @access protected 1388 1395 * 1396 * @param string $output Passed by reference. Used to append additional content. 1389 1397 * @param object $comment Comment to display. 1390 1398 * @param int $depth Depth of comment. 1391 1399 * @param array $args Optional args. 1392 1400 */ 1393 protected function comment( $comment, $depth, $args ) { 1401 protected function comment( &$output, $comment, $depth, $args ) { 1402 ob_start(); 1394 1403 if ( 'div' == $args['style'] ) { 1395 1404 $tag = 'div'; 1396 1405 $add_below = 'comment'; … … 1428 1437 </div> 1429 1438 <?php endif; ?> 1430 1439 <?php 1440 $output .= ob_get_clean(); 1431 1441 } 1432 1442 1433 1443 /** 1434 1444 * @since 3.6 1435 1445 * @access protected 1436 1446 * 1447 * @param string $output Passed by reference. Used to append additional content. 1437 1448 * @param object $comment Comment to display. 1438 1449 * @param int $depth Depth of comment. 1439 1450 * @param array $args Optional args. 1440 1451 */ 1441 protected function html5_comment( $comment, $depth, $args ) {1452 protected function html5_comment( &$output, $comment, $depth, $args ) { 1442 1453 $tag = ( 'div' === $args['style'] ) ? 'div' : 'li'; 1454 ob_start(); 1443 1455 ?> 1444 1456 <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>> 1445 1457 <article id="div-comment-<?php comment_ID(); ?>" class="comment-body"> … … 1472 1484 </div><!-- .reply --> 1473 1485 </article><!-- .comment-body --> 1474 1486 <?php 1487 $output .= ob_get_clean(); 1475 1488 } 1476 1489 } 1477 1490 … … 1508 1521 'reverse_children' => '', 1509 1522 'format' => current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml', 1510 1523 'short_ping' => false, 1524 'echo' => true, 1511 1525 ); 1512 1526 1513 1527 $r = wp_parse_args( $args, $defaults ); … … 1576 1590 if ( empty($walker) ) 1577 1591 $walker = new Walker_Comment; 1578 1592 1579 $ walker->paged_walk($_comments, $max_depth, $page, $per_page, $r);1593 $output = $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r); 1580 1594 $wp_query->max_num_comment_pages = $walker->max_pages; 1581 1595 1582 1596 $in_comment_loop = false; 1597 1598 if ( $r['echo'] ) 1599 echo $output; 1600 else 1601 return $output; 1583 1602 } 1584 1603 1585 1604 /**