Ticket #10948: comment-walker-echo-issue-trunk-12304.diff
File comment-walker-echo-issue-trunk-12304.diff, 5.6 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 ( 'div' != $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 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> 1271 1272 <?php comment_text() ?> 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 ( 'div' != $args['style'] ) : ?> 1278 </div> 1279 <?php endif; ?> 1280 <?php 1256 $output .= ' <' . $tag . ' ' . comment_class(empty( $args['has_children'] ) ? '' : 'parent', null, null, false) .' id="comment-' . get_comment_ID() . '">' . "\n"; 1257 if ( 'div' != $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) $output .= ' ' . get_avatar( $comment, $args['avatar_size'] ); 1262 $output .= sprintf(__(' <cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()); 1263 $output .= ' </div>' . "\n"; 1264 if ($comment->comment_approved == '0') : 1265 $output .= '<em>'. __('Your comment is awaiting moderation.') . '</em>' . "\n"; 1266 $output .= '<br />' . "\n"; 1267 endif; 1268 $output .= "\n" . ' <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\n "; 1269 $output .= apply_filters('comment_text', get_comment_text() ) . "\n"; 1270 $output .= ' <div class="reply">'; 1271 $output .= get_comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) . "\n"; 1272 $output .= ' </div>' . "\n"; 1273 if ( 'div' != $args['style'] ) : 1274 $output .= ' </div>' . "\n"; 1275 endif; 1281 1276 } 1282 1277 1283 1278 /** … … 1295 1290 return; 1296 1291 } 1297 1292 if ( 'div' == $args['style'] ) 1298 echo "</div>\n";1293 $output .= " </div>\n"; 1299 1294 else 1300 echo "</li>\n";1295 $output .= " </li>\n"; 1301 1296 } 1302 1297 1303 1298 } … … 1322 1317 $comment_depth = 1; 1323 1318 1324 1319 $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' => '' );1320 'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '', 'echo' => 1); 1326 1321 1327 1322 $r = wp_parse_args( $args, $defaults ); 1328 1323 … … 1390 1385 if ( empty($walker) ) 1391 1386 $walker = new Walker_Comment; 1392 1387 1393 $ walker->paged_walk($_comments, $max_depth, $page, $per_page, $r);1388 $output = $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r); 1394 1389 $wp_query->max_num_comment_pages = $walker->max_pages; 1395 1390 1396 1391 $in_comment_loop = false; 1392 1393 if ( $r['echo'] ) 1394 echo $output; 1395 else 1396 return $output; 1397 1397 } 1398 1398 1399 1399 ?> -
wp-includes/link-template.php
820 820 * @param string $after Optional. Display after edit link. 821 821 * @return string|null HTML content, if $echo is set to false. 822 822 */ 823 function edit_comment_link( $link = null, $before = '', $after = '' ) {823 function edit_comment_link( $link = null, $before = '', $after = '', $echo = true ) { 824 824 global $comment, $post; 825 825 826 826 if ( $post->post_type == 'page' ) { … … 835 835 $link = __('Edit This'); 836 836 837 837 $link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) . '" title="' . __( 'Edit comment' ) . '">' . $link . '</a>'; 838 echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after; 838 if ($echo) 839 echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after; 840 else 841 return $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after; 839 842 } 840 843 841 844 /**