Ticket #10948: comment-walker-echo-issue-286.diff
File comment-walker-echo-issue-286.diff, 5.5 KB (added by , 15 years ago) |
---|
-
wp-includes/comment-template.php
1192 1192 case 'div': 1193 1193 break; 1194 1194 case 'ol': 1195 echo"<ol class='children'>\n";1195 $output .= "<ol class='children'>\n"; 1196 1196 break; 1197 1197 default: 1198 1198 case 'ul': 1199 echo"<ul class='children'>\n";1199 $output .= "<ul class='children'>\n"; 1200 1200 break; 1201 1201 } 1202 1202 } … … 1216 1216 case 'div': 1217 1217 break; 1218 1218 case 'ol': 1219 echo"</ol>\n";1219 $output .= "</ol>\n"; 1220 1220 break; 1221 1221 default: 1222 1222 case 'ul': 1223 echo"</ul>\n";1223 $output .= "</ul>\n"; 1224 1224 break; 1225 1225 } 1226 1226 } … … 1253 1253 $tag = 'li'; 1254 1254 $add_below = 'div-comment'; 1255 1255 } 1256 ?>1257 <<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">1258 <?php if ( 'ul' == $args['style'] ) : ?>1259 <div id="div-comment-<?php comment_ID() ?>" class="comment-body">1260 <?php endif; ?>1261 <div class="comment-author vcard">1262 <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>1263 <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>1264 </div>1265 <?php if ($comment->comment_approved == '0') : ?>1266 <em><?php _e('Your comment is awaiting moderation.') ?></em>1267 <br />1268 <?php endif; ?>1269 1256 1270 <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),' ','') ?></div> 1257 $output .= 1258 '<'. $tag .' '. comment_class(empty( $args['has_children'] ) ? '' : 'parent', null, null, false) .' id="comment-'. get_comment_ID() .'">' . "\n"; 1259 if ( 'ul' == $args['style'] ) : 1260 $output .= '<div id="div-comment-'. get_comment_ID() .'" class="comment-body">' . "\n"; 1261 endif; 1262 $output .= '<div class="comment-author vcard">' . "\n"; 1263 if ($args['avatar_size'] != 0) 1264 $output .= get_avatar( $comment, $args['avatar_size'] ); 1265 $output .= sprintf(__('<cite class="fn">%s</cite> <span class="says">says:</span>' . "\n"), get_comment_author_link()); 1266 $output .= '</div>' . "\n"; 1267 if ($comment->comment_approved == '0') : 1268 $output .= '<em>' . __('Your comment is awaiting moderation.') . '</em> . "\n"'; 1269 $output .= '<br /> . "\n"'; 1270 endif; 1271 1271 1272 <?php comment_text() ?>1272 $output .= '<div class="comment-meta commentmetadata"><a href="' . htmlspecialchars( get_comment_link( $comment->comment_ID ) ) .'">' . sprintf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) . '</a>' . edit_comment_link(__('(Edit)'),' ','', false) . '</div>' . "\n"; 1273 1273 1274 <div class="reply"> 1275 <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?> 1276 </div> 1277 <?php if ( 'ul' == $args['style'] ) : ?> 1278 </div> 1279 <?php endif; ?> 1280 <?php 1274 $output .= apply_filters('comment_text', get_comment_text() ) . "\n"; 1275 1276 $output .= '<div class="reply">' . "\n" . 1277 get_comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) . "\n" . 1278 '</div>' . "\n"; 1279 if ( 'ul' == $args['style'] ) : 1280 $output .= '</div>' . "\n"; 1281 endif; 1281 1282 } 1282 1283 1283 1284 /** … … 1295 1296 return; 1296 1297 } 1297 1298 if ( 'div' == $args['style'] ) 1298 echo"</div>\n";1299 $output .= "</div>\n"; 1299 1300 else 1300 echo"</li>\n";1301 $output .= "</li>\n"; 1301 1302 } 1302 1303 1303 1304 } … … 1322 1323 $comment_depth = 1; 1323 1324 1324 1325 $defaults = array('walker' => null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all', 1325 'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '' );1326 'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '', 'echo' => 1); 1326 1327 1327 1328 $r = wp_parse_args( $args, $defaults ); 1328 1329 … … 1390 1391 if ( empty($walker) ) 1391 1392 $walker = new Walker_Comment; 1392 1393 1393 $ walker->paged_walk($_comments, $max_depth, $page, $per_page, $r);1394 $output = $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r); 1394 1395 $wp_query->max_num_comment_pages = $walker->max_pages; 1395 1396 1396 1397 $in_comment_loop = false; 1398 1399 if ( $r['echo'] ) 1400 echo $output; 1401 else 1402 return $output; 1397 1403 } 1398 1404 1399 1405 ?> -
wp-includes/link-template.php
765 765 * @param string $after Optional. Display after edit link. 766 766 * @return string|null HTML content, if $echo is set to false. 767 767 */ 768 function edit_comment_link( $link = 'Edit This', $before = '', $after = '' ) {768 function edit_comment_link( $link = 'Edit This', $before = '', $after = '', $echo = true ) { 769 769 global $comment, $post; 770 770 771 771 if ( $post->post_type == 'page' ) { … … 777 777 } 778 778 779 779 $link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) . '" title="' . __( 'Edit comment' ) . '">' . $link . '</a>'; 780 echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after; 780 if ($echo) 781 echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after; 782 else 783 return $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after; 781 784 } 782 785 783 786 /**