wp/wp-includes/comment-template.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
--- a/wp/wp-includes/comment-template.php	Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-includes/comment-template.php	Mon Oct 14 18:28:13 2019 +0200
@@ -18,17 +18,18 @@
  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  *
  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to retrieve the author.
- *									 Default current comment.
+ *                                   Default current comment.
  * @return string The comment author
  */
 function get_comment_author( $comment_ID = 0 ) {
 	$comment = get_comment( $comment_ID );
 
 	if ( empty( $comment->comment_author ) ) {
-		if ( $comment->user_id && $user = get_userdata( $comment->user_id ) )
+		if ( $comment->user_id && $user = get_userdata( $comment->user_id ) ) {
 			$author = $user->display_name;
-		else
-			$author = __('Anonymous');
+		} else {
+			$author = __( 'Anonymous' );
+		}
 	} else {
 		$author = $comment->comment_author;
 	}
@@ -53,7 +54,7 @@
  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  *
  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author.
- *									 Default current comment.
+ *                                   Default current comment.
  */
 function comment_author( $comment_ID = 0 ) {
 	$comment = get_comment( $comment_ID );
@@ -78,7 +79,7 @@
  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  *
  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's email.
- *									 Default current comment.
+ *                                   Default current comment.
  * @return string The current comment author's email
  */
 function get_comment_author_email( $comment_ID = 0 ) {
@@ -101,7 +102,7 @@
  * Display the email of the author of the current global $comment.
  *
  * Care should be taken to protect the email address and assure that email
- * harvesters do not capture your commentors' email address. Most assume that
+ * harvesters do not capture your commenter's email address. Most assume that
  * their email address will not appear in raw form on the site. Doing so will
  * enable anyone, including those that people don't want to get the email
  * address and use it for their own means good and bad.
@@ -110,7 +111,7 @@
  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  *
  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's email.
- *									 Default current comment.
+ *                                   Default current comment.
  */
 function comment_author_email( $comment_ID = 0 ) {
 	$comment      = get_comment( $comment_ID );
@@ -132,7 +133,7 @@
  * Display the html email link to the author of the current comment.
  *
  * Care should be taken to protect the email address and assure that email
- * harvesters do not capture your commentors' email address. Most assume that
+ * harvesters do not capture your commenter's email address. Most assume that
  * their email address will not appear in raw form on the site. Doing so will
  * enable anyone, including those that people don't want to get the email
  * address and use it for their own means good and bad.
@@ -156,7 +157,7 @@
  * Return the html email link to the author of the current comment.
  *
  * Care should be taken to protect the email address and assure that email
- * harvesters do not capture your commentors' email address. Most assume that
+ * harvesters do not capture your commenter's email address. Most assume that
  * their email address will not appear in raw form on the site. Doing so will
  * enable anyone, including those that people don't want to get the email
  * address and use it for their own means good and bad.
@@ -189,11 +190,11 @@
 	 */
 	$email = apply_filters( 'comment_email', $comment->comment_author_email, $comment );
 
-	if ((!empty($email)) && ($email != '@')) {
-	$display = ($linktext != '') ? $linktext : $email;
+	if ( ( ! empty( $email ) ) && ( $email != '@' ) ) {
+		$display = ( $linktext != '' ) ? $linktext : $email;
 		$return  = $before;
 		$return .= sprintf( '<a href="%1$s">%2$s</a>', esc_url( 'mailto:' . $email ), esc_html( $display ) );
-	 	$return .= $after;
+		$return .= $after;
 		return $return;
 	} else {
 		return '';
@@ -210,7 +211,7 @@
  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  *
  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's link.
- *									 Default current comment.
+ *                                   Default current comment.
  * @return string The comment author name or HTML link for author's URL.
  */
 function get_comment_author_link( $comment_ID = 0 ) {
@@ -218,10 +219,11 @@
 	$url     = get_comment_author_url( $comment );
 	$author  = get_comment_author( $comment );
 
-	if ( empty( $url ) || 'http://' == $url )
+	if ( empty( $url ) || 'http://' == $url ) {
 		$return = $author;
-	else
+	} else {
 		$return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
+	}
 
 	/**
 	 * Filters the comment author's link for display.
@@ -244,7 +246,7 @@
  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  *
  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's link.
- *									 Default current comment.
+ *                                   Default current comment.
  */
 function comment_author_link( $comment_ID = 0 ) {
 	echo get_comment_author_link( $comment_ID );
@@ -257,7 +259,7 @@
  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  *
  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's IP address.
- *									 Default current comment.
+ *                                   Default current comment.
  * @return string Comment author's IP address.
  */
 function get_comment_author_IP( $comment_ID = 0 ) {
@@ -283,7 +285,7 @@
  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  *
  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's IP address.
- *									 Default current comment.
+ *                                   Default current comment.
  */
 function comment_author_IP( $comment_ID = 0 ) {
 	echo esc_html( get_comment_author_IP( $comment_ID ) );
@@ -296,17 +298,17 @@
  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  *
  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's URL.
- *									 Default current comment.
+ *                                   Default current comment.
  * @return string Comment author URL.
  */
 function get_comment_author_url( $comment_ID = 0 ) {
 	$comment = get_comment( $comment_ID );
-	$url = '';
-	$id = 0;
+	$url     = '';
+	$id      = 0;
 	if ( ! empty( $comment ) ) {
 		$author_url = ( 'http://' == $comment->comment_author_url ) ? '' : $comment->comment_author_url;
-		$url = esc_url( $author_url, array( 'http', 'https' ) );
-		$id = $comment->comment_ID;
+		$url        = esc_url( $author_url, array( 'http', 'https' ) );
+		$id         = $comment->comment_ID;
 	}
 
 	/**
@@ -329,7 +331,7 @@
  * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
  *
  * @param int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's URL.
- *									 Default current comment.
+ *                                   Default current comment.
  */
 function comment_author_url( $comment_ID = 0 ) {
 	$comment    = get_comment( $comment_ID );
@@ -371,13 +373,13 @@
  * @return string The HTML link between the $before and $after parameters.
  */
 function get_comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) {
-	$url = get_comment_author_url( $comment );
-	$display = ($linktext != '') ? $linktext : $url;
+	$url     = get_comment_author_url( $comment );
+	$display = ( $linktext != '' ) ? $linktext : $url;
 	$display = str_replace( 'http://www.', '', $display );
 	$display = str_replace( 'http://', '', $display );
 
-	if ( '/' == substr($display, -1) ) {
-		$display = substr($display, 0, -1);
+	if ( '/' == substr( $display, -1 ) ) {
+		$display = substr( $display, 0, -1 );
 	}
 
 	$return = "$before<a href='$url' rel='external'>$display</a>$after";
@@ -428,10 +430,11 @@
 function comment_class( $class = '', $comment = null, $post_id = null, $echo = true ) {
 	// Separates classes with a single space, collates classes for comment DIV
 	$class = 'class="' . join( ' ', get_comment_class( $class, $comment, $post_id ) ) . '"';
-	if ( $echo)
+	if ( $echo ) {
 		echo $class;
-	else
+	} else {
 		return $class;
+	}
 }
 
 /**
@@ -467,19 +470,22 @@
 		$classes[] = 'byuser';
 		$classes[] = 'comment-author-' . sanitize_html_class( $user->user_nicename, $comment->user_id );
 		// For comment authors who are the author of the post
-		if ( $post = get_post($post_id) ) {
+		if ( $post = get_post( $post_id ) ) {
 			if ( $comment->user_id === $post->post_author ) {
 				$classes[] = 'bypostauthor';
 			}
 		}
 	}
 
-	if ( empty($comment_alt) )
+	if ( empty( $comment_alt ) ) {
 		$comment_alt = 0;
-	if ( empty($comment_depth) )
+	}
+	if ( empty( $comment_depth ) ) {
 		$comment_depth = 1;
-	if ( empty($comment_thread_alt) )
+	}
+	if ( empty( $comment_thread_alt ) ) {
 		$comment_thread_alt = 0;
+	}
 
 	if ( $comment_alt % 2 ) {
 		$classes[] = 'odd';
@@ -503,20 +509,21 @@
 
 	$classes[] = "depth-$comment_depth";
 
-	if ( !empty($class) ) {
-		if ( !is_array( $class ) )
-			$class = preg_split('#\s+#', $class);
-		$classes = array_merge($classes, $class);
+	if ( ! empty( $class ) ) {
+		if ( ! is_array( $class ) ) {
+			$class = preg_split( '#\s+#', $class );
+		}
+		$classes = array_merge( $classes, $class );
 	}
 
-	$classes = array_map('esc_attr', $classes);
+	$classes = array_map( 'esc_attr', $classes );
 
 	/**
 	 * Filters the returned CSS classes for the current comment.
 	 *
 	 * @since 2.7.0
 	 *
-	 * @param array       $classes    An array of comment classes.
+	 * @param string[]    $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 WP_Comment  $comment    The comment object.
@@ -538,10 +545,11 @@
  */
 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
-		$date = mysql2date($d, $comment->comment_date);
+	if ( '' == $d ) {
+		$date = mysql2date( get_option( 'date_format' ), $comment->comment_date );
+	} else {
+		$date = mysql2date( $d, $comment->comment_date );
+	}
 	/**
 	 * Filters the returned comment date.
 	 *
@@ -583,9 +591,9 @@
  * @return string The maybe truncated comment with 20 words or less.
  */
 function get_comment_excerpt( $comment_ID = 0 ) {
-	$comment = get_comment( $comment_ID );
+	$comment      = get_comment( $comment_ID );
 	$comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment->comment_content ) );
-	$words = explode( ' ', $comment_text );
+	$words        = explode( ' ', $comment_text );
 
 	/**
 	 * Filters the amount of words used in the comment excerpt.
@@ -702,7 +710,7 @@
 function get_comment_link( $comment = null, $args = array() ) {
 	global $wp_rewrite, $in_comment_loop;
 
-	$comment = get_comment($comment);
+	$comment = get_comment( $comment );
 
 	// Back-compat.
 	if ( ! is_array( $args ) ) {
@@ -716,7 +724,7 @@
 		'max_depth' => '',
 		'cpage'     => null,
 	);
-	$args = wp_parse_args( $args, $defaults );
+	$args     = wp_parse_args( $args, $defaults );
 
 	$link = get_permalink( $comment->comment_post_ID );
 
@@ -724,15 +732,15 @@
 	if ( ! is_null( $args['cpage'] ) ) {
 		$cpage = $args['cpage'];
 
-	// No 'cpage' is provided, so we calculate one.
+		// No 'cpage' is provided, so we calculate one.
 	} else {
 		if ( '' === $args['per_page'] && get_option( 'page_comments' ) ) {
-			$args['per_page'] = get_option('comments_per_page');
+			$args['per_page'] = get_option( 'comments_per_page' );
 		}
 
 		if ( empty( $args['per_page'] ) ) {
 			$args['per_page'] = 0;
-			$args['page'] = 0;
+			$args['page']     = 0;
 		}
 
 		$cpage = $args['page'];
@@ -765,7 +773,6 @@
 		} elseif ( $cpage ) {
 			$link = add_query_arg( 'cpage', $cpage, $link );
 		}
-
 	}
 
 	if ( $wp_rewrite->using_permalinks() ) {
@@ -799,7 +806,7 @@
  * @return string The link to the comments.
  */
 function get_comments_link( $post_id = 0 ) {
-	$hash = get_comments_number( $post_id ) ? '#comments' : '#respond';
+	$hash          = get_comments_number( $post_id ) ? '#comments' : '#respond';
 	$comments_link = get_permalink( $post_id ) . $hash;
 
 	/**
@@ -822,10 +829,12 @@
  * @param string $deprecated_2 Not Used.
  */
 function comments_link( $deprecated = '', $deprecated_2 = '' ) {
-	if ( !empty( $deprecated ) )
+	if ( ! empty( $deprecated ) ) {
 		_deprecated_argument( __FUNCTION__, '0.72' );
-	if ( !empty( $deprecated_2 ) )
+	}
+	if ( ! empty( $deprecated_2 ) ) {
 		_deprecated_argument( __FUNCTION__, '1.3.0' );
+	}
 	echo esc_url( get_comments_link() );
 }
 
@@ -844,7 +853,7 @@
 	if ( ! $post ) {
 		$count = 0;
 	} else {
-		$count = $post->comment_count;
+		$count   = $post->comment_count;
 		$post_id = $post->ID;
 	}
 
@@ -1011,10 +1020,11 @@
 	$comment = get_comment();
 
 	$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);
+	if ( '' == $d ) {
+		$date = mysql2date( get_option( 'time_format' ), $comment_date, $translate );
+	} else {
+		$date = mysql2date( $d, $comment_date, $translate );
+	}
 
 	/**
 	 * Filters the returned comment time.
@@ -1038,7 +1048,7 @@
  * @param string $d Optional. The format of the time. Default user's settings.
  */
 function comment_time( $d = '' ) {
-	echo get_comment_time($d);
+	echo get_comment_time( $d );
 }
 
 /**
@@ -1053,8 +1063,9 @@
  */
 function get_comment_type( $comment_ID = 0 ) {
 	$comment = get_comment( $comment_ID );
-	if ( '' == $comment->comment_type )
+	if ( '' == $comment->comment_type ) {
 		$comment->comment_type = 'comment';
+	}
 
 	/**
 	 * Filters the returned comment type.
@@ -1063,7 +1074,7 @@
 	 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
 	 *
 	 * @param string     $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
-	 * @param int 	     $comment_ID   The comment ID.
+	 * @param int        $comment_ID   The comment ID.
 	 * @param WP_Comment $comment      The comment object.
 	 */
 	return apply_filters( 'get_comment_type', $comment->comment_type, $comment->comment_ID, $comment );
@@ -1079,18 +1090,24 @@
  * @param string $pingbacktxt  Optional. String to display for pingback type. Default false.
  */
 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' :
+	switch ( $type ) {
+		case 'trackback':
 			echo $trackbacktxt;
 			break;
-		case 'pingback' :
+		case 'pingback':
 			echo $pingbacktxt;
 			break;
-		default :
+		default:
 			echo $commenttxt;
 	}
 }
@@ -1107,10 +1124,11 @@
  * @return string The trackback URL after being filtered.
  */
 function get_trackback_url() {
-	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=' . get_the_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=' . get_the_ID();
+	}
 
 	/**
 	 * Filters the returned trackback URL.
@@ -1133,9 +1151,12 @@
  */
 function trackback_url( $deprecated_echo = true ) {
 	if ( true !== $deprecated_echo ) {
-		_deprecated_argument( __FUNCTION__, '2.5.0',
+		_deprecated_argument(
+			__FUNCTION__,
+			'2.5.0',
 			/* translators: %s: get_trackback_url() */
-			sprintf( __( 'Use %s instead if you do not want the value echoed.' ),
+			sprintf(
+				__( 'Use %s instead if you do not want the value echoed.' ),
 				'<code>get_trackback_url()</code>'
 			)
 		);
@@ -1171,17 +1192,21 @@
 			xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
 		<rdf:Description rdf:about="';
 	the_permalink();
-	echo '"'."\n";
+	echo '"' . "\n";
 	echo '    dc:identifier="';
 	the_permalink();
-	echo '"'."\n";
-	echo '    dc:title="'.str_replace('--', '&#x2d;&#x2d;', wptexturize(strip_tags(get_the_title()))).'"'."\n";
-	echo '    trackback:ping="'.get_trackback_url().'"'." />\n";
+	echo '"' . "\n";
+	echo '    dc:title="' . str_replace( '--', '&#x2d;&#x2d;', wptexturize( strip_tags( get_the_title() ) ) ) . '"' . "\n";
+	echo '    trackback:ping="' . get_trackback_url() . '"' . " />\n";
 	echo '</rdf:RDF>';
 }
 
 /**
- * Whether the current post is open for comments.
+ * Determines whether the current post is open for comments.
+ *
+ * For more information on this and similar theme functions, check out
+ * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
+ * Conditional Tags} article in the Theme Developer Handbook.
  *
  * @since 1.5.0
  *
@@ -1190,10 +1215,10 @@
  */
 function comments_open( $post_id = null ) {
 
-	$_post = get_post($post_id);
+	$_post = get_post( $post_id );
 
 	$post_id = $_post ? $_post->ID : 0;
-	$open = ( 'open' == $_post->comment_status );
+	$open    = ( 'open' == $_post->comment_status );
 
 	/**
 	 * Filters whether the current post is open for comments.
@@ -1207,7 +1232,11 @@
 }
 
 /**
- * Whether the current post is open for pings.
+ * Determines whether the current post is open for pings.
+ *
+ * For more information on this and similar theme functions, check out
+ * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
+ * Conditional Tags} article in the Theme Developer Handbook.
  *
  * @since 1.5.0
  *
@@ -1216,10 +1245,10 @@
  */
 function pings_open( $post_id = null ) {
 
-	$_post = get_post($post_id);
+	$_post = get_post( $post_id );
 
 	$post_id = $_post ? $_post->ID : 0;
-	$open = ( 'open' == $_post->ping_status );
+	$open    = ( 'open' == $_post->ping_status );
 
 	/**
 	 * Filters whether the current post is open for pings.
@@ -1247,7 +1276,7 @@
  * @since 2.1.3
  */
 function wp_comment_form_unfiltered_html_nonce() {
-	$post = get_post();
+	$post    = get_post();
 	$post_id = $post ? $post->ID : 0;
 
 	if ( current_user_can( 'unfiltered_html' ) ) {
@@ -1294,13 +1323,15 @@
 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) || empty($post) )
+	if ( ! ( is_single() || is_page() || $withcomments ) || empty( $post ) ) {
 		return;
+	}
 
-	if ( empty($file) )
+	if ( empty( $file ) ) {
 		$file = '/comments.php';
+	}
 
-	$req = get_option('require_name_email');
+	$req = get_option( 'require_name_email' );
 
 	/*
 	 * Comment author information fetched from the comment cookies.
@@ -1322,18 +1353,18 @@
 	/*
 	 * The url of the current comment author escaped for use in attributes.
 	 */
-	$comment_author_url = esc_url($commenter['comment_author_url']);
+	$comment_author_url = esc_url( $commenter['comment_author_url'] );
 
 	$comment_args = array(
-		'orderby' => 'comment_date_gmt',
-		'order' => 'ASC',
-		'status'  => 'approve',
-		'post_id' => $post->ID,
-		'no_found_rows' => false,
+		'orderby'                   => 'comment_date_gmt',
+		'order'                     => 'ASC',
+		'status'                    => 'approve',
+		'post_id'                   => $post->ID,
+		'no_found_rows'             => false,
 		'update_comment_meta_cache' => false, // We lazy-load comment meta for performance.
 	);
 
-	if ( get_option('thread_comments') ) {
+	if ( get_option( 'thread_comments' ) ) {
 		$comment_args['hierarchical'] = 'threaded';
 	} else {
 		$comment_args['hierarchical'] = false;
@@ -1341,8 +1372,12 @@
 
 	if ( $user_ID ) {
 		$comment_args['include_unapproved'] = array( $user_ID );
-	} elseif ( ! empty( $comment_author_email ) ) {
-		$comment_args['include_unapproved'] = array( $comment_author_email );
+	} else {
+		$unapproved_email = wp_get_unapproved_comment_author_email();
+
+		if ( $unapproved_email ) {
+			$comment_args['include_unapproved'] = array( $unapproved_email );
+		}
 	}
 
 	$per_page = 0;
@@ -1353,7 +1388,7 @@
 		}
 
 		$comment_args['number'] = $per_page;
-		$page = (int) get_query_var( 'cpage' );
+		$page                   = (int) get_query_var( 'cpage' );
 
 		if ( $page ) {
 			$comment_args['offset'] = ( $page - 1 ) * $per_page;
@@ -1406,20 +1441,22 @@
 	 *     @type int          $number                    Number of comments to fetch.
 	 * }
 	 */
-	$comment_args = apply_filters( 'comments_template_query_args', $comment_args );
+	$comment_args  = apply_filters( 'comments_template_query_args', $comment_args );
 	$comment_query = new WP_Comment_Query( $comment_args );
-	$_comments = $comment_query->comments;
+	$_comments     = $comment_query->comments;
 
 	// Trees must be flattened before they're passed to the walker.
 	if ( $comment_args['hierarchical'] ) {
 		$comments_flat = array();
 		foreach ( $_comments as $_comment ) {
 			$comments_flat[]  = $_comment;
-			$comment_children = $_comment->get_children( array(
-				'format' => 'flat',
-				'status' => $comment_args['status'],
-				'orderby' => $comment_args['orderby']
-			) );
+			$comment_children = $_comment->get_children(
+				array(
+					'format'  => 'flat',
+					'status'  => $comment_args['status'],
+					'orderby' => $comment_args['orderby'],
+				)
+			);
 
 			foreach ( $comment_children as $comment_child ) {
 				$comments_flat[] = $comment_child;
@@ -1439,25 +1476,26 @@
 	 */
 	$wp_query->comments = apply_filters( 'comments_array', $comments_flat, $post->ID );
 
-	$comments = &$wp_query->comments;
-	$wp_query->comment_count = count($wp_query->comments);
+	$comments                        = &$wp_query->comments;
+	$wp_query->comment_count         = count( $wp_query->comments );
 	$wp_query->max_num_comment_pages = $comment_query->max_num_pages;
 
 	if ( $separate_comments ) {
-		$wp_query->comments_by_type = separate_comments($comments);
-		$comments_by_type = &$wp_query->comments_by_type;
+		$wp_query->comments_by_type = separate_comments( $comments );
+		$comments_by_type           = &$wp_query->comments_by_type;
 	} else {
 		$wp_query->comments_by_type = array();
 	}
 
 	$overridden_cpage = false;
 	if ( '' == get_query_var( 'cpage' ) && $wp_query->max_num_comment_pages > 1 ) {
-		set_query_var( 'cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1 );
+		set_query_var( 'cpage', 'newest' == get_option( 'default_comments_page' ) ? get_comment_pages_count() : 1 );
 		$overridden_cpage = true;
 	}
 
-	if ( !defined('COMMENTS_TEMPLATE') )
-		define('COMMENTS_TEMPLATE', true);
+	if ( ! defined( 'COMMENTS_TEMPLATE' ) ) {
+		define( 'COMMENTS_TEMPLATE', true );
+	}
 
 	$theme_template = STYLESHEETPATH . $file;
 	/**
@@ -1468,12 +1506,13 @@
 	 * @param string $theme_template The path to the theme template file.
 	 */
 	$include = apply_filters( 'comments_template', $theme_template );
-	if ( file_exists( $include ) )
+	if ( file_exists( $include ) ) {
 		require( $include );
-	elseif ( file_exists( TEMPLATEPATH . $file ) )
+	} elseif ( file_exists( TEMPLATEPATH . $file ) ) {
 		require( TEMPLATEPATH . $file );
-	else // Backward compat code will be removed in a future release
-		require( ABSPATH . WPINC . '/theme-compat/comments.php');
+	} else { // Backward compat code will be removed in a future release
+		require( ABSPATH . WPINC . '/theme-compat/comments.php' );
+	}
 }
 
 /**
@@ -1481,18 +1520,15 @@
  *
  * @since 0.71
  *
- * @param string $zero      Optional. String to display when no comments. Default false.
- * @param string $one       Optional. String to display when only one comment is available.
- *                          Default false.
- * @param string $more      Optional. String to display when there are more than one comment.
- *                          Default false.
- * @param string $css_class Optional. CSS class to use for comments. Default empty.
- * @param string $none      Optional. String to display when comments have been turned off.
- *                          Default false.
+ * @param false|string $zero      Optional. String to display when no comments. Default false.
+ * @param false|string $one       Optional. String to display when only one comment is available. Default false.
+ * @param false|string $more      Optional. String to display when there are more than one comment. Default false.
+ * @param string       $css_class Optional. CSS class to use for comments. Default empty.
+ * @param false|string $none      Optional. String to display when comments have been turned off. Default false.
  */
 function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
-	$id = get_the_ID();
-	$title = get_the_title();
+	$id     = get_the_ID();
+	$title  = get_the_title();
 	$number = get_comments_number( $id );
 
 	if ( false === $zero ) {
@@ -1506,7 +1542,7 @@
 	}
 
 	if ( false === $more ) {
-		/* translators: 1: Number of comments 2: post title */
+		/* translators: 1: number of comments, 2: post title */
 		$more = _n( '%1$s Comment<span class="screen-reader-text"> on %2$s</span>', '%1$s Comments<span class="screen-reader-text"> on %2$s</span>', $number );
 		$more = sprintf( $more, number_format_i18n( $number ), $title );
 	}
@@ -1516,8 +1552,8 @@
 		$none = sprintf( __( 'Comments Off<span class="screen-reader-text"> on %s</span>' ), $title );
 	}
 
-	if ( 0 == $number && !comments_open() && !pings_open() ) {
-		echo '<span' . ((!empty($css_class)) ? ' class="' . esc_attr( $css_class ) . '"' : '') . '>' . $none . '</span>';
+	if ( 0 == $number && ! comments_open() && ! pings_open() ) {
+		echo '<span' . ( ( ! empty( $css_class ) ) ? ' class="' . esc_attr( $css_class ) . '"' : '' ) . '>' . $none . '</span>';
 		return;
 	}
 
@@ -1543,8 +1579,8 @@
 	}
 	echo '"';
 
-	if ( !empty( $css_class ) ) {
-		echo ' class="'.$css_class.'" ';
+	if ( ! empty( $css_class ) ) {
+		echo ' class="' . $css_class . '" ';
 	}
 
 	$attributes = '';
@@ -1595,13 +1631,13 @@
 		'add_below'     => 'comment',
 		'respond_id'    => 'respond',
 		'reply_text'    => __( 'Reply' ),
-		/* translators: Comment reply button text. 1: Comment author name */
+		/* translators: Comment reply button text. %s: Comment author name */
 		'reply_to_text' => __( 'Reply to %s' ),
 		'login_text'    => __( 'Log in to Reply' ),
 		'max_depth'     => 0,
 		'depth'         => 0,
 		'before'        => '',
-		'after'         => ''
+		'after'         => '',
 	);
 
 	$args = wp_parse_args( $args, $defaults );
@@ -1635,18 +1671,39 @@
 	$args = apply_filters( 'comment_reply_link_args', $args, $comment, $post );
 
 	if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) {
-		$link = sprintf( '<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>',
+		$link = sprintf(
+			'<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>',
 			esc_url( wp_login_url( get_permalink() ) ),
 			$args['login_text']
 		);
 	} else {
-		$onclick = sprintf( 'return addComment.moveForm( "%1$s-%2$s", "%2$s", "%3$s", "%4$s" )',
-			$args['add_below'], $comment->comment_ID, $args['respond_id'], $post->ID
+		$data_attributes = array(
+			'commentid'      => $comment->comment_ID,
+			'postid'         => $post->ID,
+			'belowelement'   => $args['add_below'] . '-' . $comment->comment_ID,
+			'respondelement' => $args['respond_id'],
 		);
 
-		$link = sprintf( "<a rel='nofollow' class='comment-reply-link' href='%s' onclick='%s' aria-label='%s'>%s</a>",
-			esc_url( add_query_arg( 'replytocom', $comment->comment_ID, get_permalink( $post->ID ) ) ) . "#" . $args['respond_id'],
-			$onclick,
+		$data_attribute_string = '';
+
+		foreach ( $data_attributes as $name => $value ) {
+			$data_attribute_string .= " data-${name}=\"" . esc_attr( $value ) . '"';
+		}
+
+		$data_attribute_string = trim( $data_attribute_string );
+
+		$link = sprintf(
+			"<a rel='nofollow' class='comment-reply-link' href='%s' %s aria-label='%s'>%s</a>",
+			esc_url(
+				add_query_arg(
+					array(
+						'replytocom'      => $comment->comment_ID,
+						'unapproved'      => false,
+						'moderation-hash' => false,
+					)
+				)
+			) . '#' . $args['respond_id'],
+			$data_attribute_string,
 			esc_attr( sprintf( $args['reply_to_text'], $comment->comment_author ) ),
 			$args['reply_text']
 		);
@@ -1678,8 +1735,8 @@
  *                             Default current post.
  * @return mixed Link to show comment form, if successful. False, if comments are closed.
  */
-function comment_reply_link($args = array(), $comment = null, $post = null) {
-	echo get_comment_reply_link($args, $comment, $post);
+function comment_reply_link( $args = array(), $comment = null, $post = null ) {
+	echo get_comment_reply_link( $args, $comment, $post );
 }
 
 /**
@@ -1705,35 +1762,40 @@
  *                             Default current post.
  * @return false|null|string Link to show comment form, if successful. False, if comments are closed.
  */
-function get_post_reply_link($args = array(), $post = null) {
+function get_post_reply_link( $args = array(), $post = null ) {
 	$defaults = array(
 		'add_below'  => 'post',
 		'respond_id' => 'respond',
-		'reply_text' => __('Leave a Comment'),
-		'login_text' => __('Log in to leave a Comment'),
+		'reply_text' => __( 'Leave a Comment' ),
+		'login_text' => __( 'Log in to leave a Comment' ),
 		'before'     => '',
 		'after'      => '',
 	);
 
-	$args = wp_parse_args($args, $defaults);
+	$args = wp_parse_args( $args, $defaults );
 
-	$post = get_post($post);
+	$post = get_post( $post );
 
 	if ( ! comments_open( $post->ID ) ) {
 		return false;
 	}
 
-	if ( get_option('comment_registration') && ! is_user_logged_in() ) {
-		$link = sprintf( '<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>',
+	if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) {
+		$link = sprintf(
+			'<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>',
 			wp_login_url( get_permalink() ),
 			$args['login_text']
 		);
 	} else {
-		$onclick = sprintf( 'return addComment.moveForm( "%1$s-%2$s", "0", "%3$s", "%2$s" )',
-			$args['add_below'], $post->ID, $args['respond_id']
+		$onclick = sprintf(
+			'return addComment.moveForm( "%1$s-%2$s", "0", "%3$s", "%2$s" )',
+			$args['add_below'],
+			$post->ID,
+			$args['respond_id']
 		);
 
-		$link = sprintf( "<a rel='nofollow' class='comment-reply-link' href='%s' onclick='%s'>%s</a>",
+		$link = sprintf(
+			"<a rel='nofollow' class='comment-reply-link' href='%s' onclick='%s'>%s</a>",
 			get_permalink( $post->ID ) . '#' . $args['respond_id'],
 			$onclick,
 			$args['reply_text']
@@ -1764,8 +1826,8 @@
  *                          Default current post.
  * @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
  */
-function post_reply_link($args = array(), $post = null) {
-	echo get_post_reply_link($args, $post);
+function post_reply_link( $args = array(), $post = null ) {
+	echo get_post_reply_link( $args, $post );
 }
 
 /**
@@ -1777,11 +1839,12 @@
  * @return string
  */
 function get_cancel_comment_reply_link( $text = '' ) {
-	if ( empty($text) )
-		$text = __('Click here to cancel reply.');
+	if ( empty( $text ) ) {
+		$text = __( 'Click here to cancel reply.' );
+	}
 
-	$style = isset($_GET['replytocom']) ? '' : ' style="display:none;"';
-	$link = esc_html( remove_query_arg('replytocom') ) . '#respond';
+	$style = isset( $_GET['replytocom'] ) ? '' : ' style="display:none;"';
+	$link  = esc_html( remove_query_arg( array( 'replytocom', 'unapproved', 'moderation-hash' ) ) ) . '#respond';
 
 	$formatted_link = '<a rel="nofollow" id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>';
 
@@ -1805,7 +1868,7 @@
  * @param string $text Optional. Text to display for cancel reply link. Default empty.
  */
 function cancel_comment_reply_link( $text = '' ) {
-	echo get_cancel_comment_reply_link($text);
+	echo get_cancel_comment_reply_link( $text );
 }
 
 /**
@@ -1817,12 +1880,13 @@
  * @return string Hidden input HTML for replying to comments
  */
 function get_comment_id_fields( $id = 0 ) {
-	if ( empty( $id ) )
+	if ( empty( $id ) ) {
 		$id = get_the_ID();
+	}
 
-	$replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
-	$result  = "<input type='hidden' name='comment_post_ID' value='$id' id='comment_post_ID' />\n";
-	$result .= "<input type='hidden' name='comment_parent' id='comment_parent' value='$replytoid' />\n";
+	$replytoid = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0;
+	$result    = "<input type='hidden' name='comment_post_ID' value='$id' id='comment_post_ID' />\n";
+	$result   .= "<input type='hidden' name='comment_parent' id='comment_parent' value='$replytoid' />\n";
 
 	/**
 	 * Filters the returned comment id fields.
@@ -1870,17 +1934,21 @@
 function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true ) {
 	global $comment;
 
-	if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' );
-	if ( false === $replytext ) $replytext = __( 'Leave a Reply to %s' );
-
-	$replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
+	if ( false === $noreplytext ) {
+		$noreplytext = __( 'Leave a Reply' );
+	}
+	if ( false === $replytext ) {
+		$replytext = __( 'Leave a Reply to %s' );
+	}
 
-	if ( 0 == $replytoid )
+	$replytoid = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0;
+
+	if ( 0 == $replytoid ) {
 		echo $noreplytext;
-	else {
+	} else {
 		// Sets the global so that template tags can be used in the comment form.
-		$comment = get_comment($replytoid);
-		$author = ( $linktoparent ) ? '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author( $comment ) . '</a>' : get_comment_author( $comment );
+		$comment = get_comment( $replytoid );
+		$author  = ( $linktoparent ) ? '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author( $comment ) . '</a>' : get_comment_author( $comment );
 		printf( $replytext, $author );
 	}
 }
@@ -1928,7 +1996,7 @@
 
 	$in_comment_loop = true;
 
-	$comment_alt = $comment_thread_alt = 0;
+	$comment_alt   = $comment_thread_alt = 0;
 	$comment_depth = 1;
 
 	$defaults = array(
@@ -1964,13 +2032,15 @@
 	// Figure out what comments we'll be looping through ($_comments)
 	if ( null !== $comments ) {
 		$comments = (array) $comments;
-		if ( empty($comments) )
+		if ( empty( $comments ) ) {
 			return;
+		}
 		if ( 'all' != $r['type'] ) {
-			$comments_by_type = separate_comments($comments);
-			if ( empty($comments_by_type[$r['type']]) )
+			$comments_by_type = separate_comments( $comments );
+			if ( empty( $comments_by_type[ $r['type'] ] ) ) {
 				return;
-			$_comments = $comments_by_type[$r['type']];
+			}
+			$_comments = $comments_by_type[ $r['type'] ];
 		} else {
 			$_comments = $comments;
 		}
@@ -1990,16 +2060,17 @@
 				$comment_args = array(
 					'post_id' => get_the_ID(),
 					'orderby' => 'comment_date_gmt',
-					'order' => 'ASC',
-					'status' => 'approve',
+					'order'   => 'ASC',
+					'status'  => 'approve',
 				);
 
 				if ( is_user_logged_in() ) {
 					$comment_args['include_unapproved'] = get_current_user_id();
 				} else {
-					$commenter = wp_get_current_commenter();
-					if ( $commenter['comment_author_email'] ) {
-						$comment_args['include_unapproved'] = $commenter['comment_author_email'];
+					$unapproved_email = wp_get_unapproved_comment_author_email();
+
+					if ( $unapproved_email ) {
+						$comment_args['include_unapproved'] = array( $unapproved_email );
 					}
 				}
 
@@ -2017,74 +2088,80 @@
 				}
 			}
 
-		// Otherwise, fall back on the comments from `$wp_query->comments`.
+			// Otherwise, fall back on the comments from `$wp_query->comments`.
 		} else {
-			if ( empty($wp_query->comments) )
+			if ( empty( $wp_query->comments ) ) {
 				return;
+			}
 			if ( 'all' != $r['type'] ) {
-				if ( empty($wp_query->comments_by_type) )
-					$wp_query->comments_by_type = separate_comments($wp_query->comments);
-				if ( empty($wp_query->comments_by_type[$r['type']]) )
+				if ( empty( $wp_query->comments_by_type ) ) {
+					$wp_query->comments_by_type = separate_comments( $wp_query->comments );
+				}
+				if ( empty( $wp_query->comments_by_type[ $r['type'] ] ) ) {
 					return;
-				$_comments = $wp_query->comments_by_type[$r['type']];
+				}
+				$_comments = $wp_query->comments_by_type[ $r['type'] ];
 			} else {
 				$_comments = $wp_query->comments;
 			}
 
 			if ( $wp_query->max_num_comment_pages ) {
 				$default_comments_page = get_option( 'default_comments_page' );
-				$cpage = get_query_var( 'cpage' );
+				$cpage                 = get_query_var( 'cpage' );
 				if ( 'newest' === $default_comments_page ) {
 					$r['cpage'] = $cpage;
 
-				/*
-				 * When first page shows oldest comments, post permalink is the same as
-				 * the comment permalink.
-				 */
+					/*
+					* When first page shows oldest comments, post permalink is the same as
+					* the comment permalink.
+					*/
 				} elseif ( $cpage == 1 ) {
 					$r['cpage'] = '';
 				} else {
 					$r['cpage'] = $cpage;
 				}
 
-				$r['page'] = 0;
+				$r['page']     = 0;
 				$r['per_page'] = 0;
 			}
 		}
 	}
 
 	if ( '' === $r['per_page'] && get_option( 'page_comments' ) ) {
-		$r['per_page'] = get_query_var('comments_per_page');
+		$r['per_page'] = get_query_var( 'comments_per_page' );
 	}
 
-	if ( empty($r['per_page']) ) {
+	if ( empty( $r['per_page'] ) ) {
 		$r['per_page'] = 0;
-		$r['page'] = 0;
+		$r['page']     = 0;
 	}
 
 	if ( '' === $r['max_depth'] ) {
-		if ( get_option('thread_comments') )
-			$r['max_depth'] = get_option('thread_comments_depth');
-		else
+		if ( get_option( 'thread_comments' ) ) {
+			$r['max_depth'] = get_option( 'thread_comments_depth' );
+		} else {
 			$r['max_depth'] = -1;
+		}
 	}
 
 	if ( '' === $r['page'] ) {
-		if ( empty($overridden_cpage) ) {
-			$r['page'] = get_query_var('cpage');
+		if ( empty( $overridden_cpage ) ) {
+			$r['page'] = get_query_var( 'cpage' );
 		} else {
-			$threaded = ( -1 != $r['max_depth'] );
-			$r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($_comments, $r['per_page'], $threaded) : 1;
+			$threaded  = ( -1 != $r['max_depth'] );
+			$r['page'] = ( 'newest' == get_option( 'default_comments_page' ) ) ? get_comment_pages_count( $_comments, $r['per_page'], $threaded ) : 1;
 			set_query_var( 'cpage', $r['page'] );
 		}
 	}
 	// Validation check
-	$r['page'] = intval($r['page']);
-	if ( 0 == $r['page'] && 0 != $r['per_page'] )
+	$r['page'] = intval( $r['page'] );
+	if ( 0 == $r['page'] && 0 != $r['per_page'] ) {
 		$r['page'] = 1;
+	}
 
-	if ( null === $r['reverse_top_level'] )
-		$r['reverse_top_level'] = ( 'desc' == get_option('comment_order') );
+	if ( null === $r['reverse_top_level'] ) {
+		$r['reverse_top_level'] = ( 'desc' == get_option( 'comment_order' ) );
+	}
 
 	wp_queue_comments_for_comment_meta_lazyload( $_comments );
 
@@ -2170,8 +2247,9 @@
  * @param int|WP_Post $post_id Post ID or WP_Post object to generate the form for. Default current post.
  */
 function comment_form( $args = array(), $post_id = null ) {
-	if ( null === $post_id )
+	if ( null === $post_id ) {
 		$post_id = get_the_ID();
+	}
 
 	// Exit the function when comments for the post are closed.
 	if ( ! comments_open( $post_id ) ) {
@@ -2185,23 +2263,24 @@
 		return;
 	}
 
-	$commenter = wp_get_current_commenter();
-	$user = wp_get_current_user();
+	$commenter     = wp_get_current_commenter();
+	$user          = wp_get_current_user();
 	$user_identity = $user->exists() ? $user->display_name : '';
 
 	$args = wp_parse_args( $args );
-	if ( ! isset( $args['format'] ) )
+	if ( ! isset( $args['format'] ) ) {
 		$args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml';
+	}
 
 	$req      = get_option( 'require_name_email' );
 	$html_req = ( $req ? " required='required'" : '' );
 	$html5    = 'html5' === $args['format'];
-	$fields   =  array(
-		'author'  => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
+	$fields   = array(
+		'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
 					 '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245"' . $html_req . ' /></p>',
-		'email'   => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
+		'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
 					 '<input id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" maxlength="100" aria-describedby="email-notes"' . $html_req . ' /></p>',
-		'url'     => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' .
+		'url'    => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' .
 					 '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>',
 	);
 
@@ -2223,29 +2302,29 @@
 	 *
 	 * @since 3.0.0
 	 *
-	 * @param array $fields The default comment fields.
+	 * @param string[] $fields Array of the default comment fields.
 	 */
-	$fields = apply_filters( 'comment_form_default_fields', $fields );
+	$fields   = apply_filters( 'comment_form_default_fields', $fields );
 	$defaults = array(
 		'fields'               => $fields,
 		'comment_field'        => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea></p>',
 		/** This filter is documented in wp-includes/link-template.php */
 		'must_log_in'          => '<p class="must-log-in">' . sprintf(
-		                              /* translators: %s: login URL */
-		                              __( 'You must be <a href="%s">logged in</a> to post a comment.' ),
-		                              wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
-		                          ) . '</p>',
+			/* translators: %s: login URL */
+									__( 'You must be <a href="%s">logged in</a> to post a comment.' ),
+			wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
+		) . '</p>',
 		/** This filter is documented in wp-includes/link-template.php */
 		'logged_in_as'         => '<p class="logged-in-as">' . sprintf(
-		                              /* translators: 1: edit user link, 2: accessibility text, 3: user name, 4: logout URL */
-		                              __( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ),
-		                              get_edit_user_link(),
-		                              /* translators: %s: user name */
-		                              esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ),
-		                              $user_identity,
-		                              wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
-		                          ) . '</p>',
-		'comment_notes_before' => '<p class="comment-notes"><span id="email-notes">' . __( 'Your email address will not be published.' ) . '</span>'. ( $req ? $required_text : '' ) . '</p>',
+			/* translators: 1: edit user link, 2: accessibility text, 3: user name, 4: logout URL */
+									__( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ),
+			get_edit_user_link(),
+			/* translators: %s: user name */
+									esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ),
+			$user_identity,
+			wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
+		) . '</p>',
+		'comment_notes_before' => '<p class="comment-notes"><span id="email-notes">' . __( 'Your email address will not be published.' ) . '</span>' . ( $req ? $required_text : '' ) . '</p>',
 		'comment_notes_after'  => '',
 		'action'               => site_url( '/wp-comments-post.php' ),
 		'id_form'              => 'commentform',
@@ -2301,7 +2380,7 @@
 
 		echo $args['title_reply_after'];
 
-		if ( get_option( 'comment_registration' ) && !is_user_logged_in() ) :
+		if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) :
 			echo $args['must_log_in'];
 			/**
 			 * Fires after the HTML-formatted 'must log in after' message in the comment form.
@@ -2309,7 +2388,8 @@
 			 * @since 3.0.0
 			 */
 			do_action( 'comment_form_must_log_in_after' );
-		else : ?>
+		else :
+			?>
 			<form action="<?php echo esc_url( $args['action'] ); ?>" method="post" id="<?php echo esc_attr( $args['id_form'] ); ?>" class="<?php echo esc_attr( $args['class_form'] ); ?>"<?php echo $html5 ? ' novalidate' : ''; ?>>
 				<?php
 				/**
@@ -2433,7 +2513,7 @@
 				 * @since 4.2.0
 				 *
 				 * @param string $submit_button HTML markup for the submit button.
-				 * @param array  $args          Arguments passed to `comment_form()`.
+				 * @param array  $args          Arguments passed to comment_form().
 				 */
 				$submit_button = apply_filters( 'comment_form_submit_button', $submit_button, $args );