X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/6c8f14c09105d0afa4c1574215c59b5021040e76..a6f44f0edcda2471c5a33e4156c1c9488c7f3210:/wp-includes/comment-template.php diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 8be25e10..afbee05f 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -393,8 +393,8 @@ function comment_date( $d = '', $comment_ID = 0 ) { /** * Retrieve the excerpt of the current comment. * - * Will cut each word and only output the first 20 words with '...' at the end. - * If the word count is less than 20, then no truncating is done and no '...' + * Will cut each word and only output the first 20 words with '…' at the end. + * If the word count is less than 20, then no truncating is done and no '…' * will appear. * * @since 1.5.0 @@ -419,7 +419,7 @@ function get_comment_excerpt( $comment_ID = 0 ) { for ($i=0; $i<$k; $i++) { $excerpt .= $blah[$i] . ' '; } - $excerpt .= ($use_dotdotdot) ? '...' : ''; + $excerpt .= ($use_dotdotdot) ? '…' : ''; return apply_filters('get_comment_excerpt', $excerpt); } @@ -516,7 +516,7 @@ function get_comment_link( $comment = null, $args = array() ) { * @return string The link to the comments */ function get_comments_link($post_id = 0) { - return get_permalink($post_id) . '#comments'; + return apply_filters( 'get_comments_link', get_permalink( $post_id ) . '#comments', $post_id ); } /** @@ -532,7 +532,7 @@ function comments_link( $deprecated = '', $deprecated_2 = '' ) { _deprecated_argument( __FUNCTION__, '0.72' ); if ( !empty( $deprecated_2 ) ) _deprecated_argument( __FUNCTION__, '1.3' ); - echo get_comments_link(); + echo esc_url( get_comments_link() ); } /** @@ -1244,11 +1244,11 @@ class Walker_Comment extends Walker { case 'div': break; case 'ol': - echo "
    \n"; + echo '
      ' . "\n"; break; default: case 'ul': - echo "
    \n"; + echo "
\n"; break; default: case 'ul': - echo "\n"; + echo "\n"; break; } } @@ -1295,7 +1295,7 @@ class Walker_Comment extends Walker { * 2.2 * */ - function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) { + function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { if ( !$element ) return; @@ -1325,18 +1325,72 @@ class Walker_Comment extends Walker { * @param int $depth Depth of comment in reference to parents. * @param array $args */ - function start_el( &$output, $comment, $depth, $args, $id = 0 ) { + function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) { $depth++; $GLOBALS['comment_depth'] = $depth; $GLOBALS['comment'] = $comment; - if ( !empty($args['callback']) ) { - call_user_func($args['callback'], $comment, $args, $depth); + if ( !empty( $args['callback'] ) ) { + call_user_func( $args['callback'], $comment, $args, $depth ); return; } - extract($args, EXTR_SKIP); + if ( ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) && $args['short_ping'] ) { + $this->ping( $comment, $depth, $args ); + } elseif ( 'html5' === $args['format'] ) { + $this->html5_comment( $comment, $depth, $args ); + } else { + $this->comment( $comment, $depth, $args ); + } + } + + /** + * @see Walker::end_el() + * @since 2.7.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param object $comment + * @param int $depth Depth of comment. + * @param array $args + */ + function end_el( &$output, $comment, $depth = 0, $args = array() ) { + if ( !empty( $args['end-callback'] ) ) { + call_user_func( $args['end-callback'], $comment, $args, $depth ); + return; + } + if ( 'div' == $args['style'] ) + echo "\n"; + else + echo "\n"; + } + + /** + * @since 3.6 + * @access protected + * + * @param object $comment + * @param int $depth Depth of comment. + * @param array $args + */ + protected function ping( $comment, $depth, $args ) { + $tag = ( 'div' == $args['style'] ) ? 'div' : 'li'; +?> + < id="comment-" > +
+ ', '' ); ?> +
+ - < id="comment-"> + < id="comment-"> -
+
- - %s says:'), get_comment_author_link()) ?> + + %s says:' ), get_comment_author_link() ); ?>
-comment_approved == '0') : ?> - + comment_approved ) : ?> +
- + - @@ -1377,25 +1431,48 @@ class Walker_Comment extends Walker { } /** - * @see Walker::end_el() - * @since 2.7.0 + * @since 3.6 + * @access protected * - * @param string $output Passed by reference. Used to append additional content. - * @param object $comment + * @param object $comment Comment to display. * @param int $depth Depth of comment. - * @param array $args + * @param array $args Optional args. */ - function end_el(&$output, $comment, $depth = 0, $args = array() ) { - if ( !empty($args['end-callback']) ) { - call_user_func($args['end-callback'], $comment, $args, $depth); - return; - } - if ( 'div' == $args['style'] ) - echo "
\n"; - else - echo "\n"; + protected function html5_comment( $comment, $depth, $args ) { + $tag = ( 'div' === $args['style'] ) ? 'div' : 'li'; +?> + < id="comment-" > +
+
+
+ + says:' ), sprintf( '%s', get_comment_author_link() ) ); ?> +
+ + + + comment_approved ) : ?> +

+ +
+ +
+ +
+ +
+ 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> +
+
+ null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all', - 'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => ''); + $defaults = array( + 'walker' => null, + 'max_depth' => '', + 'style' => 'ul', + 'callback' => null, + 'end-callback' => null, + 'type' => 'all', + 'page' => '', + 'per_page' => '', + 'avatar_size' => 32, + 'reverse_top_level' => null, + 'reverse_children' => '', + 'format' => current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml', + 'short_ping' => false, + ); $r = wp_parse_args( $args, $defaults ); @@ -1507,10 +1597,8 @@ function wp_list_comments($args = array(), $comments = null ) { * @return void */ function comment_form( $args = array(), $post_id = null ) { - global $id; - if ( null === $post_id ) - $post_id = $id; + $post_id = get_the_ID(); else $id = $post_id; @@ -1518,21 +1606,26 @@ function comment_form( $args = array(), $post_id = null ) { $user = wp_get_current_user(); $user_identity = $user->exists() ? $user->display_name : ''; - $req = get_option( 'require_name_email' ); + $args = wp_parse_args( $args ); + if ( ! isset( $args['format'] ) ) + $args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml'; + + $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); - $fields = array( + $html5 = 'html5' === $args['format']; + $fields = array( 'author' => '

' . ' ' . '

', 'email' => '

' . - '

', - 'url' => '

' . - '

', + '

', + 'url' => '

' . + '

', ); $required_text = sprintf( ' ' . __('Required fields are marked %s'), '*' ); $defaults = array( 'fields' => apply_filters( 'comment_form_default_fields', $fields ), - 'comment_field' => '

', + 'comment_field' => '

', 'must_log_in' => '

' . sprintf( __( 'You must be logged in to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '

', 'logged_in_as' => '

' . sprintf( __( 'Logged in as %2$s. Log out?' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '

', 'comment_notes_before' => '

' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '

', @@ -1543,6 +1636,7 @@ function comment_form( $args = array(), $post_id = null ) { 'title_reply_to' => __( 'Leave a Reply to %s' ), 'cancel_reply_link' => __( 'Cancel reply' ), 'label_submit' => __( 'Post Comment' ), + 'format' => 'xhtml', ); $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) ); @@ -1550,13 +1644,13 @@ function comment_form( $args = array(), $post_id = null ) { ?> -
-

+
+

-
+ >