Make WordPress Core

Ticket #20088: 20088.5.diff

File 20088.5.diff, 6.9 KB (added by obenland, 13 years ago)
  • wp-includes/comment-template.php

     
    12441244                        case 'div':
    12451245                                break;
    12461246                        case 'ol':
    1247                                 echo "<ol class='children'>\n";
     1247                                echo '<ol class="children">' . "\n";
    12481248                                break;
    12491249                        default:
    12501250                        case 'ul':
    1251                                 echo "<ul class='children'>\n";
     1251                                echo '<ul class="children">' . "\n";
    12521252                                break;
    12531253                }
    12541254        }
     
    12681268                        case 'div':
    12691269                                break;
    12701270                        case 'ol':
    1271                                 echo "</ol>\n";
     1271                                echo "</ol><!-- .children -->\n";
    12721272                                break;
    12731273                        default:
    12741274                        case 'ul':
    1275                                 echo "</ul>\n";
     1275                                echo "</ul><!-- .children -->\n";
    12761276                                break;
    12771277                }
    12781278        }
     
    13301330                $GLOBALS['comment_depth'] = $depth;
    13311331                $GLOBALS['comment'] = $comment;
    13321332
    1333                 if ( !empty($args['callback']) ) {
    1334                         call_user_func($args['callback'], $comment, $args, $depth);
     1333                if ( !empty( $args['callback'] ) ) {
     1334                        call_user_func( $args['callback'], $comment, $args, $depth );
    13351335                        return;
    13361336                }
    13371337
    1338                 extract($args, EXTR_SKIP);
     1338                extract( $args, EXTR_SKIP );
    13391339
    1340                 if ( 'div' == $args['style'] ) {
    1341                         $tag = 'div';
    1342                         $add_below = 'comment';
    1343                 } else {
    1344                         $tag = 'li';
    1345                         $add_below = 'div-comment';
    1346                 }
    1347 ?>
    1348                 <<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
    1349                 <?php if ( 'div' != $args['style'] ) : ?>
    1350                 <div id="div-comment-<?php comment_ID() ?>" class="comment-body">
    1351                 <?php endif; ?>
    1352                 <div class="comment-author vcard">
    1353                 <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
    1354                 <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
    1355                 </div>
    1356 <?php if ($comment->comment_approved == '0') : ?>
    1357                 <em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.') ?></em>
    1358                 <br />
    1359 <?php endif; ?>
     1340                $list_tag = ( 'div' == $style ) ? 'div' : 'li';
     1341                $wrapper_tag = ( 'html5' == strtolower( $markup ) ) ? 'article' : 'div';
    13601342
    1361                 <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
    1362                         <?php
    1363                                 /* translators: 1: date, 2: time */
    1364                                 printf( __('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),'&nbsp;&nbsp;','' );
    1365                         ?>
    1366                 </div>
     1343                // Display trackbacks differently than normal comments.
     1344                if ( ( 'pingback' == $comment->comment_type || 'pingback' == $comment->comment_type ) && $short_ping ) : ?>
    13671345
    1368                 <?php comment_text() ?>
     1346                        <<?php echo $list_tag ?> <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
     1347                                <div class="comment-body">
     1348                                        <?php _e( 'Pingback:' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)' ), '<span class="edit-link">', '</span>' ); ?>
     1349                                </div>
    13691350
    1370                 <div class="reply">
    1371                 <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
    1372                 </div>
    1373                 <?php if ( 'div' != $args['style'] ) : ?>
    1374                 </div>
    1375                 <?php endif; ?>
    1376 <?php
     1351                <?php else : // Proceed with normal comments. ?>
     1352
     1353                        <<?php echo $list_tag; ?> <?php comment_class( empty( $has_children ) ? '' : 'parent' ); ?> id="comment-<?php comment_ID(); ?>">
     1354                                <<?php echo $wrapper_tag; ?> id="div-comment-<?php comment_ID(); ?>" class="comment-body">
     1355
     1356                                        <?php if ( 'html5' == strtolower( $markup ) ) : ?>
     1357
     1358                                        <header class="comment-meta comment-author vcard">
     1359                                                <?php if ( 0 < $avatar_size ) echo get_avatar( $comment, $avatar_size ); ?>
     1360                                                <?php printf( __( '<cite class="fn">%s</cite> <span class="says">says:</span>' ), get_comment_author_link() ); ?>
     1361                                                <?php printf( '<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>',
     1362                                                                esc_url( get_comment_link( $comment->comment_ID ) ),
     1363                                                                get_comment_time( 'c' ),
     1364                                                                /* translators: 1: date, 2: time */
     1365                                                                sprintf( __( '%1$s at %2$s' ), get_comment_date(), get_comment_time() )
     1366                                                        ); ?>
     1367                                                <?php edit_comment_link( __( '(Edit)' ), '<span class="edit-link">', '</span>' ); ?>
     1368                                        </header><!-- .comment-meta -->
     1369
     1370                                        <?php else : ?>
     1371
     1372                                        <div class="comment-author vcard">
     1373                                                <?php if ( 0 < $avatar_size ) echo get_avatar( $comment, $avatar_size ); ?>
     1374                                                <?php printf( __( '<cite class="fn">%s</cite> <span class="says">says:</span>' ), get_comment_author_link() ); ?>
     1375                                        </div><!-- .comment-author -->
     1376
     1377                                        <div class="comment-meta commentmetadata">
     1378                                                <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
     1379                                                <?php printf( __( '%1$s at %2$s' ), get_comment_date(),  get_comment_time() ); /* translators: 1: date, 2: time */ ?></a>
     1380                                                <?php edit_comment_link( __( '(Edit)' ), '<span class="edit-link">', '</span>' ); ?>
     1381                                        </div><!-- .comment-meta -->
     1382
     1383                                        <?php endif; ?>
     1384
     1385                                        <?php if ( '0' == $comment->comment_approved ) : ?>
     1386                                        <p class="comment-awaiting-moderation"><em><?php _e( 'Your comment is awaiting moderation.' ); ?></em><p>
     1387                                        <?php endif; ?>
     1388
     1389                                        <?php if ( $comment_content_wrapper ) : ?><div class="comment-content"><?php endif; ?>
     1390                                                <?php comment_text(); ?>
     1391                                        <?php if ( $comment_content_wrapper ) : ?></div><!-- .comment-content --><?php endif; ?>
     1392
     1393                                        <div class="reply">
     1394                                                <?php comment_reply_link( array_merge( $args, array( 'add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $max_depth ) ) ); ?>
     1395                                        </div><!-- .reply -->
     1396
     1397                                </<?php echo $wrapper_tag; ?>><!-- div-comment-## -->
     1398
     1399                <?php endif; // end comment_type check
    13771400        }
    13781401
    13791402        /**
     
    13851408         * @param int $depth Depth of comment.
    13861409         * @param array $args
    13871410         */
    1388         function end_el(&$output, $comment, $depth = 0, $args = array() ) {
    1389                 if ( !empty($args['end-callback']) ) {
    1390                         call_user_func($args['end-callback'], $comment, $args, $depth);
     1411        function end_el( &$output, $comment, $depth = 0, $args = array() ) {
     1412                if ( !empty( $args['end-callback'] ) ) {
     1413                        call_user_func( $args['end-callback'], $comment, $args, $depth );
    13911414                        return;
    13921415                }
    13931416                if ( 'div' == $args['style'] )
    1394                         echo "</div>\n";
     1417                        echo "</div><!-- #comment-## -->\n";
    13951418                else
    1396                         echo "</li>\n";
     1419                        echo "</li><!-- #comment-## -->\n";
    13971420        }
    1398 
    13991421}
    14001422
    14011423/**
     
    14171439        $comment_alt = $comment_thread_alt = 0;
    14181440        $comment_depth = 1;
    14191441
    1420         $defaults = array('walker' => null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all',
    1421                 'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '');
     1442        $defaults = array( 'walker' => null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all',
     1443                'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '', 'short_ping' => false,
     1444                'markup' => '' );
    14221445
    14231446        $r = wp_parse_args( $args, $defaults );
    14241447