- $blogname = get_option('blogname');
-
- if ( empty( $comment_type ) ) $comment_type = 'comment';
-
- if ('comment' == $comment_type) {
- /* translators: 1: post id, 2: post title */
- $notify_message = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
- /* translators: 1: comment author, 2: author IP, 3: author domain */
- $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
- $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";
- $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n";
- $notify_message .= sprintf( __('Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n";
- $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
- $notify_message .= __('You can see all comments on this post here: ') . "\r\n";
- /* translators: 1: blog name, 2: post title */
- $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title );
- } elseif ('trackback' == $comment_type) {
- /* translators: 1: post id, 2: post title */
- $notify_message = sprintf( __('New trackback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
- /* translators: 1: website name, 2: author IP, 3: author domain */
- $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
- $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n";
- $notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
- $notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n";
- /* translators: 1: blog name, 2: post title */
- $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
- } elseif ('pingback' == $comment_type) {
- /* translators: 1: post id, 2: post title */
- $notify_message = sprintf( __('New pingback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
- /* translators: 1: comment author, 2: author IP, 3: author domain */
- $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
- $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n";
- $notify_message .= __('Excerpt: ') . "\r\n" . sprintf('[...] %s [...]', $comment->comment_content ) . "\r\n\r\n";
- $notify_message .= __('You can see all pingbacks on this post here: ') . "\r\n";
- /* translators: 1: blog name, 2: post title */
- $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title );
+ // The blogname option is escaped with esc_html on the way into the database in sanitize_option
+ // we want to reverse this for the plain text arena of emails.
+ $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
+ $comment_content = wp_specialchars_decode( $comment->comment_content );
+
+ switch ( $comment->comment_type ) {
+ case 'trackback':
+ /* translators: 1: Post title */
+ $notify_message = sprintf( __( 'New trackback on your post "%s"' ), $post->post_title ) . "\r\n";
+ /* translators: 1: Trackback/pingback website name, 2: website IP, 3: website hostname */
+ $notify_message .= sprintf( __('Website: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
+ $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
+ $notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
+ $notify_message .= __( 'You can see all trackbacks on this post here:' ) . "\r\n";
+ /* translators: 1: blog name, 2: post title */
+ $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
+ break;
+ case 'pingback':
+ /* translators: 1: Post title */
+ $notify_message = sprintf( __( 'New pingback on your post "%s"' ), $post->post_title ) . "\r\n";
+ /* translators: 1: Trackback/pingback website name, 2: website IP, 3: website hostname */
+ $notify_message .= sprintf( __('Website: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
+ $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
+ $notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
+ $notify_message .= __( 'You can see all pingbacks on this post here:' ) . "\r\n";
+ /* translators: 1: blog name, 2: post title */
+ $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title );
+ break;
+ default: // Comments
+ $notify_message = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n";
+ /* translators: 1: comment author, 2: author IP, 3: author domain */
+ $notify_message .= sprintf( __( 'Author: %1$s (IP: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
+ $notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n";
+ $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
+ $notify_message .= sprintf( __('Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
+ $notify_message .= __( 'You can see all comments on this post here:' ) . "\r\n";
+ /* translators: 1: blog name, 2: post title */
+ $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title );
+ break;