<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[25584] trunk/src/wp-includes/comment-template.php: Inline documentation for hooks in wp-includes/comment-template.php.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/25584">25584</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2013-09-23 21:20:48 +0000 (Mon, 23 Sep 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Inline documentation for hooks in wp-includes/comment-template.php.
Fixes <a href="http://core.trac.wordpress.org/ticket/25396">#25396</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludescommenttemplatephp">trunk/src/wp-includes/comment-template.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludescommenttemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/comment-template.php (25583 => 25584)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/comment-template.php 2013-09-23 20:31:01 UTC (rev 25583)
+++ trunk/src/wp-includes/comment-template.php 2013-09-23 21:20:48 UTC (rev 25584)
</span><span class="lines">@@ -31,6 +31,13 @@
</span><span class="cx"> $author = $comment->comment_author;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Filter the returned comment author name.
+ *
+ * @since 1.5.2
+ *
+ * @param string $author The comment author's username.
+ */
</ins><span class="cx"> return apply_filters( 'get_comment_author', $author );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -42,7 +49,15 @@
</span><span class="cx"> * @param int $comment_ID Optional. The ID of the comment for which to print the author. Default current comment.
</span><span class="cx"> */
</span><span class="cx"> function comment_author( $comment_ID = 0 ) {
</span><del>- $author = apply_filters('comment_author', get_comment_author( $comment_ID ) );
</del><ins>+ $author = get_comment_author( $comment_ID );
+ /**
+ * Filter the comment author's name for display.
+ *
+ * @since 1.2.1
+ *
+ * @param string $author The comment author's username.
+ */
+ $author = apply_filters( 'comment_author', $author );
</ins><span class="cx"> echo $author;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -56,7 +71,14 @@
</span><span class="cx"> */
</span><span class="cx"> function get_comment_author_email( $comment_ID = 0 ) {
</span><span class="cx"> $comment = get_comment( $comment_ID );
</span><del>- return apply_filters('get_comment_author_email', $comment->comment_author_email);
</del><ins>+ /**
+ * Filter the comment author's returned email address.
+ *
+ * @since 1.5.2
+ *
+ * @param string $comment->comment_author_email The comment author's email address.
+ */
+ return apply_filters( 'get_comment_author_email', $comment->comment_author_email );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -73,7 +95,15 @@
</span><span class="cx"> * @param int $comment_ID Optional. The ID of the comment for which to print the author's email. Default current comment.
</span><span class="cx"> */
</span><span class="cx"> function comment_author_email( $comment_ID = 0 ) {
</span><del>- echo apply_filters('author_email', get_comment_author_email( $comment_ID ) );
</del><ins>+ $author_email = get_comment_author_email( $comment_ID );
+ /**
+ * Filter the comment author's email for display.
+ *
+ * @since 1.2.1
+ *
+ * @param string $author_email The comment author's email address.
+ */
+ echo apply_filters( 'author_email', $author_email );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -117,7 +147,17 @@
</span><span class="cx"> */
</span><span class="cx"> function get_comment_author_email_link( $linktext = '', $before = '', $after = '' ) {
</span><span class="cx"> global $comment;
</span><del>- $email = apply_filters('comment_email', $comment->comment_author_email);
</del><ins>+ /**
+ * Filter the comment author's email for display.
+ *
+ * Care should be taken to protect the email address and assure that email
+ * harvesters do not capture your commentors' email address.
+ *
+ * @since 1.2.1
+ *
+ * @param string $comment->comment_author_email The comment author's email address.
+ */
+ $email = apply_filters( 'comment_email', $comment->comment_author_email );
</ins><span class="cx"> if ((!empty($email)) && ($email != '@')) {
</span><span class="cx"> $display = ($linktext != '') ? $linktext : $email;
</span><span class="cx"> $return = $before;
</span><span class="lines">@@ -148,7 +188,15 @@
</span><span class="cx"> $return = $author;
</span><span class="cx"> else
</span><span class="cx"> $return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
</span><del>- return apply_filters('get_comment_author_link', $return);
</del><ins>+
+ /**
+ * Filter the comment author's link for display.
+ *
+ * @since 1.5.2
+ *
+ * @param string $return The HTML-formatted comment author link. Empty for an invalid URL.
+ */
+ return apply_filters( 'get_comment_author_link', $return );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -173,7 +221,15 @@
</span><span class="cx"> */
</span><span class="cx"> function get_comment_author_IP( $comment_ID = 0 ) {
</span><span class="cx"> $comment = get_comment( $comment_ID );
</span><del>- return apply_filters('get_comment_author_IP', $comment->comment_author_IP);
</del><ins>+
+ /**
+ * Filter the comment author's returned IP address.
+ *
+ * @since 1.5.2
+ *
+ * @param string $comment->comment_author_IP The comment author's IP address.
+ */
+ return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -210,7 +266,15 @@
</span><span class="cx"> * @param int $comment_ID Optional. The ID of the comment for which to print the author's URL. Default current comment.
</span><span class="cx"> */
</span><span class="cx"> function comment_author_url( $comment_ID = 0 ) {
</span><del>- echo apply_filters('comment_url', get_comment_author_url( $comment_ID ));
</del><ins>+ $author_url = get_comment_author_url( $comment_ID );
+ /**
+ * Filter the comment author's URL for display.
+ *
+ * @since 1.2.1
+ *
+ * @param string $author_url The comment author's URL.
+ */
+ echo apply_filters( 'comment_url', $author_url );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -238,7 +302,15 @@
</span><span class="cx"> if ( '/' == substr($display, -1) )
</span><span class="cx"> $display = substr($display, 0, -1);
</span><span class="cx"> $return = "$before<a href='$url' rel='external'>$display</a>$after";
</span><del>- return apply_filters('get_comment_author_url_link', $return);
</del><ins>+
+ /**
+ * Filter the comment author's returned URL link.
+ *
+ * @since 1.5.2
+ *
+ * @param string $return The HTML-formatted comment author URL link.
+ */
+ return apply_filters( 'get_comment_author_url_link', $return );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -342,7 +414,17 @@
</span><span class="cx">
</span><span class="cx"> $classes = array_map('esc_attr', $classes);
</span><span class="cx">
</span><del>- return apply_filters('comment_class', $classes, $class, $comment_id, $post_id);
</del><ins>+ /**
+ * Filter the returned CSS classes for the current comment.
+ *
+ * @since 2.7.0
+ *
+ * @param array $classes An array of comment classes.
+ * @param string $class A comma-separated list of additional classes added to the list.
+ * @param int $comment_id The comment id.
+ * @param int|WP_Post $post_id The post ID or WP_Post object.
+ */
+ return apply_filters( 'comment_class', $classes, $class, $comment_id, $post_id );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -360,7 +442,15 @@
</span><span class="cx"> $date = mysql2date(get_option('date_format'), $comment->comment_date);
</span><span class="cx"> else
</span><span class="cx"> $date = mysql2date($d, $comment->comment_date);
</span><del>- return apply_filters('get_comment_date', $date, $d);
</del><ins>+ /**
+ * Filter the returned comment date.
+ *
+ * @since 1.5.2
+ *
+ * @param string|int $date Formatted date string or Unix timestamp.
+ * @param string $d The format of the date.
+ */
+ return apply_filters( 'get_comment_date', $date, $d );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -414,7 +504,15 @@
</span><span class="cx"> * @param int $comment_ID Optional. The ID of the comment for which to print the excerpt. Default current comment.
</span><span class="cx"> */
</span><span class="cx"> function comment_excerpt( $comment_ID = 0 ) {
</span><del>- echo apply_filters('comment_excerpt', get_comment_excerpt($comment_ID) );
</del><ins>+ $comment_excerpt = get_comment_excerpt($comment_ID);
+ /**
+ * Filter the comment excerpt for display.
+ *
+ * @since 1.2.1
+ *
+ * @param string $comment_excerpt The comment excerpt text.
+ */
+ echo apply_filters( 'comment_excerpt', $comment_excerpt );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -426,7 +524,14 @@
</span><span class="cx"> */
</span><span class="cx"> function get_comment_ID() {
</span><span class="cx"> global $comment;
</span><del>- return apply_filters('get_comment_ID', $comment->comment_ID);
</del><ins>+ /**
+ * Filter the returned comment ID.
+ *
+ * @since 1.5.2
+ *
+ * @param int $comment->comment_ID The current comment ID.
+ */
+ return apply_filters( 'get_comment_ID', $comment->comment_ID );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -482,7 +587,17 @@
</span><span class="cx"> $link = get_permalink( $comment->comment_post_ID );
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return apply_filters( 'get_comment_link', $link . '#comment-' . $comment->comment_ID, $comment, $args );
</del><ins>+ $link = $link . '#comment-' . $comment->comment_ID;
+ /**
+ * Filter the returned single comment permalink.
+ *
+ * @since 2.8.0
+ *
+ * @param string $link The comment permalink with '#comment-$id' appended.
+ * @param object $comment The current comment object.
+ * @param array $args An array of arguments to override the defaults. @see get_page_of_comment()
+ */
+ return apply_filters( 'get_comment_link', $link, $comment, $args );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -494,7 +609,16 @@
</span><span class="cx"> * @return string The link to the comments.
</span><span class="cx"> */
</span><span class="cx"> function get_comments_link( $post_id = 0 ) {
</span><del>- return apply_filters( 'get_comments_link', get_permalink( $post_id ) . '#comments', $post_id );
</del><ins>+ $comments_link = get_permalink( $post_id ) . '#comments';
+ /**
+ * Filter the returned post comments permalink.
+ *
+ * @since
+ *
+ * @param string $comments_link The post comments permalink with '#comments' appended.
+ * @param int|WP_Post $post_id The post ID or WP_Post object.
+ */
+ return apply_filters( 'get_comments_link', $comments_link, $post_id );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -533,7 +657,15 @@
</span><span class="cx"> else
</span><span class="cx"> $count = $post->comment_count;
</span><span class="cx">
</span><del>- return apply_filters('get_comments_number', $count, $post_id);
</del><ins>+ /**
+ * Filter the returned comment count for a post.
+ *
+ * @since 1.5.2
+ *
+ * @param int $count The number of comments a post has.
+ * @param int|WP_Post $post_id The post ID or WP_Post object.
+ */
+ return apply_filters( 'get_comments_number', $count, $post_id );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -559,7 +691,15 @@
</span><span class="cx"> else // must be one
</span><span class="cx"> $output = ( false === $one ) ? __('1 Comment') : $one;
</span><span class="cx">
</span><del>- echo apply_filters('comments_number', $output, $number);
</del><ins>+ /**
+ * Filter the comments count for display.
+ *
+ * @since 1.5.2
+ *
+ * @param string $output A translatable string formatted based on whether the count is equal to 0, 1, or 1+. @see _n()
+ * @param int $number The number of post comments.
+ */
+ echo apply_filters( 'comments_number', $output, $number );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -629,7 +769,18 @@
</span><span class="cx"> $date = mysql2date(get_option('time_format'), $comment_date, $translate);
</span><span class="cx"> else
</span><span class="cx"> $date = mysql2date($d, $comment_date, $translate);
</span><del>- return apply_filters('get_comment_time', $date, $d, $gmt, $translate);
</del><ins>+
+ /**
+ * Filter the returned comment time.
+ *
+ * @since 1.5.2
+ *
+ * @param string|int $date The comment time, formatted as a date string or Unix timestamp.
+ * @param string $d The date format.
+ * @param bool $gmt Whether the GMT date is in use.
+ * @param bool $translate Whether the time is translated.
+ */
+ return apply_filters( 'get_comment_time', $date, $d, $gmt, $translate );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -656,7 +807,14 @@
</span><span class="cx"> if ( '' == $comment->comment_type )
</span><span class="cx"> $comment->comment_type = 'comment';
</span><span class="cx">
</span><del>- return apply_filters('get_comment_type', $comment->comment_type);
</del><ins>+ /**
+ * Filter the returned comment type.
+ *
+ * @since 1.5.2
+ *
+ * @param string $comment->comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
+ */
+ return apply_filters( 'get_comment_type', $comment->comment_type );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -697,12 +855,19 @@
</span><span class="cx"> * @return string The trackback URL after being filtered.
</span><span class="cx"> */
</span><span class="cx"> function get_trackback_url() {
</span><del>- if ( '' != get_option('permalink_structure') ) {
</del><ins>+ if ( '' != get_option('permalink_structure') )
</ins><span class="cx"> $tb_url = trailingslashit(get_permalink()) . user_trailingslashit('trackback', 'single_trackback');
</span><del>- } else {
</del><ins>+ else
</ins><span class="cx"> $tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . get_the_ID();
</span><del>- }
- return apply_filters('trackback_url', $tb_url);
</del><ins>+
+ /**
+ * Filter the returned trackback URL.
+ *
+ * @since 2.2.0
+ *
+ * @param string $tb_url The trackback URL.
+ */
+ return apply_filters( 'trackback_url', $tb_url );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -765,6 +930,15 @@
</span><span class="cx"> $_post = get_post($post_id);
</span><span class="cx">
</span><span class="cx"> $open = ( 'open' == $_post->comment_status );
</span><ins>+
+ /**
+ * Filter whether the current post is open for comments.
+ *
+ * @since
+ *
+ * @param bool $open Whether the current post is open for comments.
+ * @param int|WP_Post $post_id The post ID or WP_Post object.
+ */
</ins><span class="cx"> return apply_filters( 'comments_open', $open, $post_id );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -876,6 +1050,14 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // keep $comments for legacy's sake
</span><ins>+ /**
+ * Filter the comments array.
+ *
+ * @since 2.1.0
+ *
+ * @param array $comments The array of comments supplied to the comments template.
+ * @param int $post->ID The post ID.
+ */
</ins><span class="cx"> $wp_query->comments = apply_filters( 'comments_array', $comments, $post->ID );
</span><span class="cx"> $comments = &$wp_query->comments;
</span><span class="cx"> $wp_query->comment_count = count($wp_query->comments);
</span><span class="lines">@@ -895,7 +1077,15 @@
</span><span class="cx"> if ( !defined('COMMENTS_TEMPLATE') )
</span><span class="cx"> define('COMMENTS_TEMPLATE', true);
</span><span class="cx">
</span><del>- $include = apply_filters('comments_template', STYLESHEETPATH . $file );
</del><ins>+ $theme_template = STYLESHEETPATH . $file;
+ /**
+ * Filter the path to the theme template file used for the comments template.
+ *
+ * @since 1.5.2
+ *
+ * @param string $theme_template The path to the theme template file.
+ */
+ $include = apply_filters( 'comments_template', $theme_template );
</ins><span class="cx"> if ( file_exists( $include ) )
</span><span class="cx"> require( $include );
</span><span class="cx"> elseif ( file_exists( TEMPLATEPATH . $file ) )
</span><span class="lines">@@ -997,7 +1187,15 @@
</span><span class="cx"> }
</span><span class="cx"> $title = the_title_attribute( array('echo' => 0 ) );
</span><span class="cx">
</span><del>- echo apply_filters( 'comments_popup_link_attributes', '' );
</del><ins>+ $attributes = '';
+ /**
+ * Filter the comments popup link attributes for display.
+ *
+ * @since 2.5.0
+ *
+ * @param string $attributes The comments popup link attributes. Default empty.
+ */
+ echo apply_filters( 'comments_popup_link_attributes', $attributes );
</ins><span class="cx">
</span><span class="cx"> echo ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '">';
</span><span class="cx"> comments_number( $zero, $one, $more );
</span><span class="lines">@@ -1130,12 +1328,21 @@
</span><span class="cx"> if ( !comments_open($post->ID) )
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if ( get_option('comment_registration') && ! is_user_logged_in() ) {
</del><ins>+ if ( get_option('comment_registration') && ! is_user_logged_in() )
</ins><span class="cx"> $link = '<a rel="nofollow" href="' . wp_login_url( get_permalink() ) . '">' . $login_text . '</a>';
</span><del>- } else {
</del><ins>+ else
</ins><span class="cx"> $link = "<a rel='nofollow' class='comment-reply-link' href='" . get_permalink($post->ID) . "#$respond_id' onclick='return addComment.moveForm(\"$add_below-$post->ID\", \"0\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
</span><del>- }
- return apply_filters('post_comments_link', $before . $link . $after, $post);
</del><ins>+
+ $formatted_link = $before . $link . $after;
+ /**
+ * Filter the formatted post comments link HTML.
+ *
+ * @since 2.7.0
+ *
+ * @param string $formatted The HTML-formatted post comments link.
+ * @param int|WP_Post $post The post ID or WP_Post object.
+ */
+ return apply_filters( 'post_comments_link', $formatted_link, $post );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -1164,7 +1371,18 @@
</span><span class="cx">
</span><span class="cx"> $style = isset($_GET['replytocom']) ? '' : ' style="display:none;"';
</span><span class="cx"> $link = esc_html( remove_query_arg('replytocom') ) . '#respond';
</span><del>- return apply_filters('cancel_comment_reply_link', '<a rel="nofollow" id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>', $link, $text);
</del><ins>+
+ $formatted_link = '<a rel="nofollow" id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>';
+ /**
+ * Filter the cancel comment reply link HTML.
+ *
+ * @since 2.7.0
+ *
+ * @param string $formatted_link The HTML-formatted cancel comment reply link.
+ * @param string $link The cancel comment reply link URL.
+ * @param string $text The cancel comment reply link text.
+ */
+ return apply_filters( 'cancel_comment_reply_link', $formatted_link, $link, $text );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -1193,7 +1411,17 @@
</span><span class="cx"> $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
</span><span class="cx"> $result = "<input type='hidden' name='comment_post_ID' value='$id' id='comment_post_ID' />\n";
</span><span class="cx"> $result .= "<input type='hidden' name='comment_parent' id='comment_parent' value='$replytoid' />\n";
</span><del>- return apply_filters('comment_id_fields', $result, $id, $replytoid);
</del><ins>+
+ /**
+ * Filter the returned comment id fields.
+ *
+ * @since 3.0.0
+ *
+ * @param string $result The HTML-formatted hidden id field comment elements.
+ * @param int $id The post ID.
+ * @param int $replytoid The id of the comment being replied to.
+ */
+ return apply_filters( 'comment_id_fields', $result, $id, $replytoid );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -1695,8 +1923,17 @@
</span><span class="cx"> );
</span><span class="cx">
</span><span class="cx"> $required_text = sprintf( ' ' . __('Required fields are marked %s'), '<span class="required">*</span>' );
</span><ins>+
+ /**
+ * Filter the default comment form fields.
+ *
+ * @since 3.0.0
+ *
+ * @param array $fields The default comment fields.
+ */
+ $fields = apply_filters( 'comment_form_default_fields', $fields );
</ins><span class="cx"> $defaults = array(
</span><del>- 'fields' => apply_filters( 'comment_form_default_fields', $fields ),
</del><ins>+ 'fields' => $fields,
</ins><span class="cx"> 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
</span><span class="cx"> 'must_log_in' => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
</span><span class="cx"> 'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
</span><span class="lines">@@ -1711,45 +1948,144 @@
</span><span class="cx"> 'format' => 'xhtml',
</span><span class="cx"> );
</span><span class="cx">
</span><ins>+ /**
+ * Filter the comment form default arguments.
+ *
+ * Use 'comment_form_default_fields' to filter the comment fields.
+ *
+ * @since 3.0.0
+ *
+ * @param array $defaults The default comment form arguments.
+ */
</ins><span class="cx"> $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) );
</span><span class="cx">
</span><span class="cx"> ?>
</span><span class="cx"> <?php if ( comments_open( $post_id ) ) : ?>
</span><del>- <?php do_action( 'comment_form_before' ); ?>
</del><ins>+ <?php
+ /**
+ * Fires before the comment form.
+ *
+ * @since 3.0.0
+ */
+ do_action( 'comment_form_before' );
+ ?>
</ins><span class="cx"> <div id="respond" class="comment-respond">
</span><span class="cx"> <h3 id="reply-title" class="comment-reply-title"><?php comment_form_title( $args['title_reply'], $args['title_reply_to'] ); ?> <small><?php cancel_comment_reply_link( $args['cancel_reply_link'] ); ?></small></h3>
</span><span class="cx"> <?php if ( get_option( 'comment_registration' ) && !is_user_logged_in() ) : ?>
</span><span class="cx"> <?php echo $args['must_log_in']; ?>
</span><del>- <?php do_action( 'comment_form_must_log_in_after' ); ?>
</del><ins>+ <?php
+ /**
+ * Fires after the HTML-formatted 'must log in after' message in the comment form.
+ *
+ * @since 3.0.0
+ */
+ do_action( 'comment_form_must_log_in_after' );
+ ?>
</ins><span class="cx"> <?php else : ?>
</span><span class="cx"> <form action="<?php echo site_url( '/wp-comments-post.php' ); ?>" method="post" id="<?php echo esc_attr( $args['id_form'] ); ?>" class="comment-form"<?php echo $html5 ? ' novalidate' : ''; ?>>
</span><del>- <?php do_action( 'comment_form_top' ); ?>
</del><ins>+ <?php
+ /**
+ * Fires at the top of the comment form, inside the <form> tag.
+ *
+ * @since 3.0.0
+ */
+ do_action( 'comment_form_top' );
+ ?>
</ins><span class="cx"> <?php if ( is_user_logged_in() ) : ?>
</span><del>- <?php echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity ); ?>
- <?php do_action( 'comment_form_logged_in_after', $commenter, $user_identity ); ?>
</del><ins>+ <?php
+ /**
+ * Filter the 'logged in' message for the comment form for display.
+ *
+ * @since 3.0.0
+ *
+ * @param string $args['logged_in_as'] The logged-in-as HTML-formatted message.
+ * @param array $commenter An array containing the comment author's username, email, and URL.
+ * @param string $user_identity If the commenter is a registered user, the display name, blank otherwise.
+ */
+ echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity );
+ ?>
+ <?php
+ /**
+ * Fires after the is_user_logged_in() check in the comment form.
+ *
+ * @since 3.0.0
+ *
+ * @param array $commenter An array containing the comment author's username, email, and URL.
+ * @param string $user_identity If the commenter is a registered user, the display name, blank otherwise.
+ */
+ do_action( 'comment_form_logged_in_after', $commenter, $user_identity );
+ ?>
</ins><span class="cx"> <?php else : ?>
</span><span class="cx"> <?php echo $args['comment_notes_before']; ?>
</span><span class="cx"> <?php
</span><ins>+ /**
+ * Fires before the comment fields in the comment form.
+ *
+ * @since 3.0.0
+ */
</ins><span class="cx"> do_action( 'comment_form_before_fields' );
</span><span class="cx"> foreach ( (array) $args['fields'] as $name => $field ) {
</span><ins>+ /**
+ * Filter a comment form field for display.
+ *
+ * The dynamic portion of the filter hook, $name, refers to the name
+ * of the comment form field. Such as 'author', 'email', or 'url'.
+ *
+ * @since 3.0.0
+ *
+ * @param string $field The HTML-formatted output of the comment form field.
+ */
</ins><span class="cx"> echo apply_filters( "comment_form_field_{$name}", $field ) . "\n";
</span><span class="cx"> }
</span><ins>+ /**
+ * Fires after the comment fields in the comment form.
+ *
+ * @since 3.0.0
+ */
</ins><span class="cx"> do_action( 'comment_form_after_fields' );
</span><span class="cx"> ?>
</span><span class="cx"> <?php endif; ?>
</span><del>- <?php echo apply_filters( 'comment_form_field_comment', $args['comment_field'] ); ?>
</del><ins>+ <?php
+ /**
+ * Filter the content of the comment textarea field for display.
+ *
+ * @since 3.0.0
+ *
+ * @param string $args['comment_field'] The content of the comment textarea field.
+ */
+ echo apply_filters( 'comment_form_field_comment', $args['comment_field'] );
+ ?>
</ins><span class="cx"> <?php echo $args['comment_notes_after']; ?>
</span><span class="cx"> <p class="form-submit">
</span><span class="cx"> <input name="submit" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" value="<?php echo esc_attr( $args['label_submit'] ); ?>" />
</span><span class="cx"> <?php comment_id_fields( $post_id ); ?>
</span><span class="cx"> </p>
</span><del>- <?php do_action( 'comment_form', $post_id ); ?>
</del><ins>+ <?php
+ /**
+ * Fires at the bottom of the comment form, inside the closing </form> tag.
+ *
+ * @since 1.5.2
+ *
+ * @param int $post_id The post ID.
+ */
+ do_action( 'comment_form', $post_id );
+ ?>
</ins><span class="cx"> </form>
</span><span class="cx"> <?php endif; ?>
</span><span class="cx"> </div><!-- #respond -->
</span><del>- <?php do_action( 'comment_form_after' ); ?>
- <?php else : ?>
- <?php do_action( 'comment_form_comments_closed' ); ?>
- <?php endif; ?>
- <?php
</del><ins>+ <?php
+ /**
+ * Fires after the comment form.
+ *
+ * @since 3.0.0
+ */
+ do_action( 'comment_form_after' );
+ else :
+ /**
+ * Fires after the comment form if comments are closed.
+ *
+ * @since 3.0.0
+ */
+ do_action( 'comment_form_comments_closed' );
+ endif;
</ins><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>