X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/67f24b02807a1ff7e9d1a97453ed84c404c0af0f..5aa86a9053fb0fa15846bb60aac2fb8fdfff524a:/wp-includes/comment-template.php diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index a5ebcd16..25f73c3d 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -17,10 +17,11 @@ * @since 1.5.0 * @uses apply_filters() Calls 'get_comment_author' hook on the comment author * + * @param int $comment_ID The ID of the comment for which to retrieve the author. Optional. * @return string The comment author */ -function get_comment_author() { - global $comment; +function get_comment_author( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); if ( empty($comment->comment_author) ) { if (!empty($comment->user_id)){ $user=get_userdata($comment->user_id); @@ -39,9 +40,11 @@ function get_comment_author() { * * @since 0.71 * @uses apply_filters() Calls 'comment_author' on comment author before displaying + * + * @param int $comment_ID The ID of the comment for which to print the author. Optional. */ -function comment_author() { - $author = apply_filters('comment_author', get_comment_author() ); +function comment_author( $comment_ID = 0 ) { + $author = apply_filters('comment_author', get_comment_author( $comment_ID ) ); echo $author; } @@ -52,10 +55,11 @@ function comment_author() { * @uses apply_filters() Calls the 'get_comment_author_email' hook on the comment author email * @uses $comment * + * @param int $comment_ID The ID of the comment for which to get the author's email. Optional. * @return string The current comment author's email */ -function get_comment_author_email() { - global $comment; +function get_comment_author_email( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); return apply_filters('get_comment_author_email', $comment->comment_author_email); } @@ -70,9 +74,11 @@ function get_comment_author_email() { * * @since 0.71 * @uses apply_filters() Calls 'author_email' hook on the author email + * + * @param int $comment_ID The ID of the comment for which to print the author's email. Optional. */ -function comment_author_email() { - echo apply_filters('author_email', get_comment_author_email() ); +function comment_author_email( $comment_ID = 0 ) { + echo apply_filters('author_email', get_comment_author_email( $comment_ID ) ); } /** @@ -135,12 +141,13 @@ function get_comment_author_email_link($linktext='', $before='', $after='') { * @since 1.5.0 * @uses apply_filters() Calls 'get_comment_author_link' hook on the complete link HTML or author * + * @param int $comment_ID The ID of the comment for which to get the author's link. Optional. * @return string Comment Author name or HTML link for author's URL */ -function get_comment_author_link() { +function get_comment_author_link( $comment_ID = 0 ) { /** @todo Only call these functions when they are needed. Include in if... else blocks */ - $url = get_comment_author_url(); - $author = get_comment_author(); + $url = get_comment_author_url( $comment_ID ); + $author = get_comment_author( $comment_ID ); if ( empty( $url ) || 'http://' == $url ) $return = $author; @@ -153,10 +160,12 @@ function get_comment_author_link() { * Display the html link to the url of the author of the current comment. * * @since 0.71 - * @see get_comment_author_link() Echos result + * @see get_comment_author_link() Echoes result + * + * @param int $comment_ID The ID of the comment for which to print the author's link. Optional. */ -function comment_author_link() { - echo get_comment_author_link(); +function comment_author_link( $comment_ID = 0 ) { + echo get_comment_author_link( $comment_ID ); } /** @@ -166,10 +175,11 @@ function comment_author_link() { * @uses $comment * @uses apply_filters() * - * @return unknown + * @param int $comment_ID The ID of the comment for which to get the author's IP address. Optional. + * @return string The comment author's IP address. */ -function get_comment_author_IP() { - global $comment; +function get_comment_author_IP( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); return apply_filters('get_comment_author_IP', $comment->comment_author_IP); } @@ -177,10 +187,12 @@ function get_comment_author_IP() { * Display the IP address of the author of the current comment. * * @since 0.71 - * @see get_comment_author_IP() Echos Result + * @see get_comment_author_IP() Echoes Result + * + * @param int $comment_ID The ID of the comment for which to print the author's IP address. Optional. */ -function comment_author_IP() { - echo get_comment_author_IP(); +function comment_author_IP( $comment_ID = 0 ) { + echo get_comment_author_IP( $comment_ID ); } /** @@ -189,10 +201,11 @@ function comment_author_IP() { * @since 1.5.0 * @uses apply_filters() Calls 'get_comment_author_url' hook on the comment author's URL * + * @param int $comment_ID The ID of the comment for which to get the author's URL. Optional. * @return string */ -function get_comment_author_url() { - global $comment; +function get_comment_author_url( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); $url = ('http://' == $comment->comment_author_url) ? '' : $comment->comment_author_url; $url = esc_url( $url, array('http', 'https') ); return apply_filters('get_comment_author_url', $url); @@ -204,9 +217,11 @@ function get_comment_author_url() { * @since 0.71 * @uses apply_filters() * @uses get_comment_author_url() Retrieves the comment author's URL + * + * @param int $comment_ID The ID of the comment for which to print the author's URL. Optional. */ -function comment_author_url() { - echo apply_filters('comment_url', get_comment_author_url()); +function comment_author_url( $comment_ID = 0 ) { + echo apply_filters('comment_url', get_comment_author_url( $comment_ID )); } /** @@ -242,7 +257,7 @@ function get_comment_author_url_link( $linktext = '', $before = '', $after = '' * Displays the HTML link of the url of the author of the current comment. * * @since 0.71 - * @see get_comment_author_url_link() Echos result + * @see get_comment_author_url_link() Echoes result * * @param string $linktext The text to display instead of the comment author's email address * @param string $before The text or HTML to display before the email link. @@ -347,14 +362,15 @@ function get_comment_class( $class = '', $comment_id = null, $post_id = null ) { * Retrieve the comment date of the current comment. * * @since 1.5.0 - * @uses apply_filters() Calls 'get_comment_date' hook with the formated date and the $d parameter respectively + * @uses apply_filters() Calls 'get_comment_date' hook with the formatted date and the $d parameter respectively * @uses $comment * * @param string $d The format of the date (defaults to user's config) + * @param int $comment_ID The ID of the comment for which to get the date. Optional. * @return string The comment's date */ -function get_comment_date( $d = '' ) { - global $comment; +function get_comment_date( $d = '', $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); if ( '' == $d ) $date = mysql2date(get_option('date_format'), $comment->comment_date); else @@ -368,9 +384,10 @@ function get_comment_date( $d = '' ) { * @since 0.71 * * @param string $d The format of the date (defaults to user's config) + * @param int $comment_ID The ID of the comment for which to print the date. Optional. */ -function comment_date( $d = '' ) { - echo get_comment_date( $d ); +function comment_date( $d = '', $comment_ID = 0 ) { + echo get_comment_date( $d, $comment_ID ); } /** @@ -384,10 +401,11 @@ function comment_date( $d = '' ) { * @uses $comment * @uses apply_filters() Calls 'get_comment_excerpt' on truncated comment * + * @param int $comment_ID The ID of the comment for which to get the excerpt. Optional. * @return string The maybe truncated comment with 20 words or less */ -function get_comment_excerpt() { - global $comment; +function get_comment_excerpt( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); $comment_text = strip_tags($comment->comment_content); $blah = explode(' ', $comment_text); if (count($blah) > 20) { @@ -410,9 +428,11 @@ function get_comment_excerpt() { * * @since 1.2.0 * @uses apply_filters() Calls 'comment_excerpt' hook before displaying excerpt + * + * @param int $comment_ID The ID of the comment for which to print the excerpt. Optional. */ -function comment_excerpt() { - echo apply_filters('comment_excerpt', get_comment_excerpt() ); +function comment_excerpt( $comment_ID = 0 ) { + echo apply_filters('comment_excerpt', get_comment_excerpt($comment_ID) ); } /** @@ -433,7 +453,7 @@ function get_comment_ID() { * Displays the comment id of the current comment. * * @since 0.71 - * @see get_comment_ID() Echos Result + * @see get_comment_ID() Echoes Result */ function comment_ID() { echo get_comment_ID(); @@ -492,10 +512,11 @@ function get_comment_link( $comment = null, $args = array() ) { * * @since 1.5.0 * + * @param int $post_id Optional post id * @return string The link to the comments */ -function get_comments_link() { - return get_permalink() . '#comments'; +function get_comments_link($post_id = 0) { + return get_permalink($post_id) . '#comments'; } /** @@ -504,9 +525,13 @@ function get_comments_link() { * @since 0.71 * * @param string $deprecated Not Used - * @param bool $deprecated Not Used + * @param bool $deprecated_2 Not Used */ -function comments_link( $deprecated = '', $deprecated = '' ) { +function comments_link( $deprecated = '', $deprecated_2 = '' ) { + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '0.72' ); + if ( !empty( $deprecated_2 ) ) + _deprecated_argument( __FUNCTION__, '1.3' ); echo get_comments_link(); } @@ -520,11 +545,10 @@ function comments_link( $deprecated = '', $deprecated = '' ) { * @return int The number of comments a post has */ function get_comments_number( $post_id = 0 ) { - global $id; - $post_id = (int) $post_id; + $post_id = absint( $post_id ); if ( !$post_id ) - $post_id = (int) $id; + $post_id = get_the_ID(); $post = get_post($post_id); if ( ! isset($post->comment_count) ) @@ -532,14 +556,13 @@ function get_comments_number( $post_id = 0 ) { else $count = $post->comment_count; - return apply_filters('get_comments_number', $count); + return apply_filters('get_comments_number', $count, $post_id); } /** * Display the language string for the number of comments the current post has. * * @since 0.71 - * @uses $id * @uses apply_filters() Calls the 'comments_number' hook on the output and number of comments respectively. * * @param string $zero Text for no comments @@ -548,8 +571,10 @@ function get_comments_number( $post_id = 0 ) { * @param string $deprecated Not used. */ function comments_number( $zero = false, $one = false, $more = false, $deprecated = '' ) { - global $id; - $number = get_comments_number($id); + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '1.3' ); + + $number = get_comments_number(); if ( $number > 1 ) $output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% Comments') : $more); @@ -567,11 +592,12 @@ function comments_number( $zero = false, $one = false, $more = false, $deprecate * @since 1.5.0 * @uses $comment * + * @param int $comment_ID The ID of the comment for which to get the text. Optional. * @return string The comment content */ -function get_comment_text() { - global $comment; - return apply_filters('get_comment_text', $comment->comment_content); +function get_comment_text( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); + return apply_filters( 'get_comment_text', $comment->comment_content, $comment ); } /** @@ -580,9 +606,12 @@ function get_comment_text() { * @since 0.71 * @uses apply_filters() Passes the comment content through the 'comment_text' hook before display * @uses get_comment_text() Gets the comment content + * + * @param int $comment_ID The ID of the comment for which to print the text. Optional. */ -function comment_text() { - echo apply_filters('comment_text', get_comment_text() ); +function comment_text( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); + echo apply_filters( 'comment_text', get_comment_text( $comment_ID ), $comment ); } /** @@ -599,12 +628,12 @@ function comment_text() { */ function get_comment_time( $d = '', $gmt = false, $translate = true ) { global $comment; - $comment_date = $gmt? $comment->comment_date_gmt : $comment->comment_date; + $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date; if ( '' == $d ) $date = mysql2date(get_option('time_format'), $comment_date, $translate); else $date = mysql2date($d, $comment_date, $translate); - return apply_filters('get_comment_time', $date, $d, $gmt); + return apply_filters('get_comment_time', $date, $d, $gmt, $translate); } /** @@ -625,11 +654,11 @@ function comment_time( $d = '' ) { * @uses $comment * @uses apply_filters() Calls the 'get_comment_type' hook on the comment type * + * @param int $comment_ID The ID of the comment for which to get the type. Optional. * @return string The comment type */ -function get_comment_type() { - global $comment; - +function get_comment_type( $comment_ID = 0 ) { + $comment = get_comment( $comment_ID ); if ( '' == $comment->comment_type ) $comment->comment_type = 'comment'; @@ -646,9 +675,9 @@ function get_comment_type() { * @param string $pingbacktxt The string to display for pingback type */ function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt = false) { - if ( false === $commenttxt ) $commenttxt = _x( 'Comment', 'noun' ); - if ( false === $trackbacktxt ) $trackbacktxt = __( 'Trackback' ); - if ( false === $pingbacktxt ) $pingbacktxt = __( 'Pingback' ); + if ( false === $commenttxt ) $commenttxt = _x( 'Comment', 'noun' ); + if ( false === $trackbacktxt ) $trackbacktxt = __( 'Trackback' ); + if ( false === $pingbacktxt ) $pingbacktxt = __( 'Pingback' ); $type = get_comment_type(); switch( $type ) { case 'trackback' : @@ -671,16 +700,14 @@ function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt = * * @since 1.5.0 * @uses apply_filters() Calls 'trackback_url' on the resulting trackback URL - * @uses $id * * @return string The trackback URL after being filtered */ function get_trackback_url() { - global $id; if ( '' != get_option('permalink_structure') ) { $tb_url = trailingslashit(get_permalink()) . user_trailingslashit('trackback', 'single_trackback'); } else { - $tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . $id; + $tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . get_the_ID(); } return apply_filters('trackback_url', $tb_url); } @@ -691,36 +718,46 @@ function get_trackback_url() { * @since 0.71 * @uses get_trackback_url() Gets the trackback url for the current post * - * @param bool $deprecated Remove backwards compat in 2.5 + * @param bool $deprecated_echo Remove backwards compat in 2.5 * @return void|string Should only be used to echo the trackback URL, use get_trackback_url() for the result instead. */ -function trackback_url($deprecated = true) { - if ($deprecated) echo get_trackback_url(); - else return get_trackback_url(); +function trackback_url( $deprecated_echo = true ) { + if ( $deprecated_echo !== true ) + _deprecated_argument( __FUNCTION__, '2.5', __('Use get_trackback_url() instead if you do not want the value echoed.') ); + if ( $deprecated_echo ) + echo get_trackback_url(); + else + return get_trackback_url(); } /** * Generates and displays the RDF for the trackback information of current post. * + * Deprecated in 3.0.0, and restored in 3.0.1. + * * @since 0.71 * * @param int $deprecated Not used (Was $timezone = 0) */ -function trackback_rdf($deprecated = '') { - if (stripos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') === false) { - echo ' - \n"; - echo ''; - } +function trackback_rdf( $deprecated = '' ) { + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '2.5' ); + + if ( false !== stripos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') ) + return; + + echo ' + \n"; + echo ''; } /** @@ -795,14 +832,13 @@ function wp_comment_form_unfiltered_html_nonce() { * * The $file path is passed through a filter hook called, 'comments_template' * which includes the TEMPLATEPATH and $file combined. Tries the $filtered path - * first and if it fails it will require the default comment themplate from the + * first and if it fails it will require the default comment template from the * default theme. If either does not exist, then the WordPress process will be * halted. It is advised for that reason, that the default theme is not deleted. * * @since 1.5.0 * @global array $comment List of comment objects for the current post * @uses $wpdb - * @uses $id * @uses $post * @uses $withcomments Will not try to get the comments if the post has none. * @@ -813,7 +849,7 @@ function wp_comment_form_unfiltered_html_nonce() { function comments_template( $file = '/comments.php', $separate_comments = false ) { global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage; - if ( ! (is_single() || is_page() || $withcomments) ) + if ( !(is_single() || is_page() || $withcomments) || empty($post) ) return; if ( empty($file) ) @@ -835,12 +871,12 @@ function comments_template( $file = '/comments.php', $separate_comments = false /** * The email address of the current comment author escaped for use in attributes. - */ + */ $comment_author_email = $commenter['comment_author_email']; // Escaped by sanitize_comment_cookies() /** * The url of the current comment author escaped for use in attributes. - */ + */ $comment_author_url = esc_url($commenter['comment_author_url']); /** @todo Use API instead of SELECTs. */ @@ -877,8 +913,8 @@ function comments_template( $file = '/comments.php', $separate_comments = false require( $include ); elseif ( file_exists( TEMPLATEPATH . $file ) ) require( TEMPLATEPATH . $file ); - else - require( get_theme_root() . '/default/comments.php'); + else // Backward compat code will be removed in a future release + require( ABSPATH . WPINC . '/theme-compat/comments.php'); } /** @@ -892,7 +928,7 @@ function comments_template( $file = '/comments.php', $separate_comments = false * * @since 0.71 * @global string $wpcommentspopupfile The URL to use for the popup window - * @global int $wpcommentsjavascript Whether to use JavaScript or not. Set when function is called + * @global int $wpcommentsjavascript Whether to use JavaScript. Set when function is called * * @param int $width Optional. The width of the popup window * @param int $height Optional. The height of the popup window @@ -919,7 +955,6 @@ function comments_popup_script($width=400, $height=400, $file='') { * lists of posts * * @since 0.71 - * @uses $id * @uses $wpcommentspopupfile * @uses $wpcommentsjavascript * @uses $post @@ -932,12 +967,14 @@ function comments_popup_script($width=400, $height=400, $file='') { * @return null Returns null on single posts and pages. */ function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) { - global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post; + global $wpcommentspopupfile, $wpcommentsjavascript; - if ( false === $zero ) $zero = __( 'No Comments' ); - if ( false === $one ) $one = __( '1 Comment' ); - if ( false === $more ) $more = __( '% Comments' ); - if ( false === $none ) $none = __( 'Comments Off' ); + $id = get_the_ID(); + + if ( false === $zero ) $zero = __( 'No Comments' ); + if ( false === $one ) $one = __( '1 Comment' ); + if ( false === $more ) $more = __( '% Comments' ); + if ( false === $none ) $none = __( 'Comments Off' ); $number = get_comments_number( $id ); @@ -947,14 +984,14 @@ function comments_popup_link( $zero = false, $one = false, $more = false, $css_c } if ( post_password_required() ) { - echo __('Enter your password to view comments'); + echo __('Enter your password to view comments.'); return; } echo ' 0 ) ); echo apply_filters( 'comments_popup_link_attributes', '' ); echo ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '">'; - comments_number( $zero, $one, $more, $number ); + comments_number( $zero, $one, $more ); echo ''; } @@ -1010,6 +1047,8 @@ function get_comment_reply_link($args = array(), $comment = null, $post = null) extract($args, EXTR_SKIP); $comment = get_comment($comment); + if ( empty($post) ) + $post = $comment->comment_post_ID; $post = get_post($post); if ( !comments_open($post->ID) ) @@ -1020,7 +1059,7 @@ function get_comment_reply_link($args = array(), $comment = null, $post = null) if ( get_option('comment_registration') && !$user_ID ) $link = '' . $login_text . ''; else - $link = "comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'>$reply_text"; + $link = "comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'>$reply_text"; return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post); } @@ -1117,16 +1156,30 @@ function cancel_comment_reply_link($text = '') { } /** - * Output hidden input HTML for replying to comments. + * Retrieve hidden input HTML for replying to comments. * - * @since 2.7.0 + * @since 3.0.0 + * + * @return string Hidden input HTML for replying to comments */ -function comment_id_fields() { - global $id; +function get_comment_id_fields( $id = 0 ) { + if ( empty( $id ) ) + $id = get_the_ID(); $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0; - echo "\n"; - echo "\n"; + $result = "\n"; + $result .= "\n"; + return apply_filters('comment_id_fields', $result, $id, $replytoid); +} + +/** + * Output hidden input HTML for replying to comments. + * + * @since 2.7.0 + * @see get_comment_id_fields() Echoes result + */ +function comment_id_fields( $id = 0 ) { + echo get_comment_id_fields( $id ); } /** @@ -1160,26 +1213,26 @@ function comment_form_title( $noreplytext = false, $replytext = false, $linktopa * * @package WordPress * @uses Walker - * @since unknown + * @since 2.7.0 */ class Walker_Comment extends Walker { /** * @see Walker::$tree_type - * @since unknown + * @since 2.7.0 * @var string */ var $tree_type = 'comment'; /** * @see Walker::$db_fields - * @since unknown + * @since 2.7.0 * @var array */ var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID'); /** * @see Walker::start_lvl() - * @since unknown + * @since 2.7.0 * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of comment. @@ -1203,7 +1256,7 @@ class Walker_Comment extends Walker { /** * @see Walker::end_lvl() - * @since unknown + * @since 2.7.0 * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of comment. @@ -1225,9 +1278,48 @@ class Walker_Comment extends Walker { } } + /** + * This function is designed to enhance Walker::display_element() to + * display children of higher nesting levels than selected inline on + * the highest depth level displayed. This prevents them being orphaned + * at the end of the comment list. + * + * Example: max_depth = 2, with 5 levels of nested content. + * 1 + * 1.1 + * 1.1.1 + * 1.1.1.1 + * 1.1.1.1.1 + * 1.1.2 + * 1.1.2.1 + * 2 + * 2.2 + * + */ + function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) { + + if ( !$element ) + return; + + $id_field = $this->db_fields['id']; + $id = $element->$id_field; + + parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); + + // If we're at the max depth, and the current element still has children, loop over those and display them at this level + // This is to prevent them being orphaned to the end of the list. + if ( $max_depth <= $depth + 1 && isset( $children_elements[$id]) ) { + foreach ( $children_elements[ $id ] as $child ) + $this->display_element( $child, $children_elements, $max_depth, $depth, $args, $output ); + + unset( $children_elements[ $id ] ); + } + + } + /** * @see Walker::start_el() - * @since unknown + * @since 2.7.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $comment Comment data object. @@ -1255,7 +1347,7 @@ class Walker_Comment extends Walker { } ?> < id="comment-"> - +
@@ -1263,18 +1355,23 @@ class Walker_Comment extends Walker { %s says:'), get_comment_author_link()) ?>
comment_approved == '0') : ?> - +
-
+
+ +
$add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
- +
ID ) ? $user->display_name : ''; + + $req = get_option( 'require_name_email' ); + $aria_req = ( $req ? " aria-required='true'" : '' ); + $fields = array( + 'author' => '

' . ' ' . ( $req ? '*' : '' ) . + '

', + 'email' => '

' . ( $req ? '*' : '' ) . + '

', + 'url' => '

' . + '

', + ); + + $required_text = sprintf( ' ' . __('Required fields are marked %s'), '*' ); + $defaults = array( + 'fields' => apply_filters( 'comment_form_default_fields', $fields ), + '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?' ), admin_url( 'profile.php' ), $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 : '' ) . '

', + 'comment_notes_after' => '

' . sprintf( __( 'You may use these HTML tags and attributes: %s' ), ' ' . allowed_tags() . '' ) . '

', + 'id_form' => 'commentform', + 'id_submit' => 'submit', + 'title_reply' => __( 'Leave a Reply' ), + 'title_reply_to' => __( 'Leave a Reply to %s' ), + 'cancel_reply_link' => __( 'Cancel reply' ), + 'label_submit' => __( 'Post Comment' ), + ); + + $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) ); + + ?> + + +
+

+ + + + +
+ + + + + + + $field ) { + echo apply_filters( "comment_form_field_{$name}", $field ) . "\n"; + } + do_action( 'comment_form_after_fields' ); + ?> + + + +

+ + +

+ +
+ +
+ + + + +