Ticket #10948: comment-walker-echo-issue-284.diff
File comment-walker-echo-issue-284.diff, 5.5 KB (added by , 15 years ago) |
---|
-
wp-includes/comment-template.php
1190 1190 case 'div': 1191 1191 break; 1192 1192 case 'ol': 1193 echo"<ol class='children'>\n";1193 $output .= "<ol class='children'>\n"; 1194 1194 break; 1195 1195 default: 1196 1196 case 'ul': 1197 echo"<ul class='children'>\n";1197 $output .= "<ul class='children'>\n"; 1198 1198 break; 1199 1199 } 1200 1200 } … … 1214 1214 case 'div': 1215 1215 break; 1216 1216 case 'ol': 1217 echo"</ol>\n";1217 $output .= "</ol>\n"; 1218 1218 break; 1219 1219 default: 1220 1220 case 'ul': 1221 echo"</ul>\n";1221 $output .= "</ul>\n"; 1222 1222 break; 1223 1223 } 1224 1224 } … … 1251 1251 $tag = 'li'; 1252 1252 $add_below = 'div-comment'; 1253 1253 } 1254 ?>1255 <<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">1256 <?php if ( 'ul' == $args['style'] ) : ?>1257 <div id="div-comment-<?php comment_ID() ?>" class="comment-body">1258 <?php endif; ?>1259 <div class="comment-author vcard">1260 <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>1261 <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>1262 </div>1263 <?php if ($comment->comment_approved == '0') : ?>1264 <em><?php _e('Your comment is awaiting moderation.') ?></em>1265 <br />1266 <?php endif; ?>1267 1254 1268 <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> 1255 $output .= 1256 '<'. $tag .' '. comment_class(empty( $args['has_children'] ) ? '' : 'parent', null, null, false) .' id="comment-'. get_comment_ID() .'">' . "\n"; 1257 if ( 'ul' == $args['style'] ) : 1258 $output .= '<div id="div-comment-'. get_comment_ID() .'" class="comment-body">' . "\n"; 1259 endif; 1260 $output .= '<div class="comment-author vcard">' . "\n"; 1261 if ($args['avatar_size'] != 0) 1262 $output .= get_avatar( $comment, $args['avatar_size'] ); 1263 $output .= sprintf(__('<cite class="fn">%s</cite> <span class="says">says:</span>' . "\n"), get_comment_author_link()); 1264 $output .= '</div>' . "\n"; 1265 if ($comment->comment_approved == '0') : 1266 $output .= '<em>' . __('Your comment is awaiting moderation.') . '</em> . "\n"'; 1267 $output .= '<br /> . "\n"'; 1268 endif; 1269 1269 1270 <?php comment_text() ?>1270 $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"; 1271 1271 1272 <div class="reply"> 1273 <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?> 1274 </div> 1275 <?php if ( 'ul' == $args['style'] ) : ?> 1276 </div> 1277 <?php endif; ?> 1278 <?php 1272 $output .= apply_filters('comment_text', get_comment_text() ) . "\n"; 1273 1274 $output .= '<div class="reply">' . "\n" . 1275 get_comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) . "\n" . 1276 '</div>' . "\n"; 1277 if ( 'ul' == $args['style'] ) : 1278 $output .= '</div>' . "\n"; 1279 endif; 1279 1280 } 1280 1281 1281 1282 /** … … 1293 1294 return; 1294 1295 } 1295 1296 if ( 'div' == $args['style'] ) 1296 echo"</div>\n";1297 $output .= "</div>\n"; 1297 1298 else 1298 echo"</li>\n";1299 $output .= "</li>\n"; 1299 1300 } 1300 1301 1301 1302 } … … 1320 1321 $comment_depth = 1; 1321 1322 1322 1323 $defaults = array('walker' => null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all', 1323 'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '' );1324 'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '', 'echo' => 1); 1324 1325 1325 1326 $r = wp_parse_args( $args, $defaults ); 1326 1327 … … 1388 1389 if ( empty($walker) ) 1389 1390 $walker = new Walker_Comment; 1390 1391 1391 $ walker->paged_walk($_comments, $max_depth, $page, $per_page, $r);1392 $output = $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r); 1392 1393 $wp_query->max_num_comment_pages = $walker->max_pages; 1393 1394 1394 1395 $in_comment_loop = false; 1396 1397 if ( $r['echo'] ) 1398 echo $output; 1399 else 1400 return $output; 1395 1401 } 1396 1402 1397 1403 ?> -
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 /**