Avoid PHP notices in wp_notify_postauthor() when using a custom comment type.
Use a switch statement for consistency with wp_notify_moderator(). fixes #25880. Built from https://develop.svn.wordpress.org/trunk@26114 git-svn-id: http://core.svn.wordpress.org/trunk@26026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
04128120f3
commit
9c3b98e6d3
|
@ -1043,7 +1043,28 @@ function wp_notify_postauthor( $comment_id, $comment_type = '' ) {
|
||||||
|
|
||||||
if ( empty( $comment_type ) ) $comment_type = 'comment';
|
if ( empty( $comment_type ) ) $comment_type = 'comment';
|
||||||
|
|
||||||
if ('comment' == $comment_type) {
|
switch ( $comment_type ) {
|
||||||
|
case 'trackback':
|
||||||
|
$notify_message = sprintf( __( 'New trackback on your post "%s"' ), $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 );
|
||||||
|
break;
|
||||||
|
case 'pingback':
|
||||||
|
$notify_message = sprintf( __( 'New pingback on your post "%s"' ), $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 );
|
||||||
|
break;
|
||||||
|
default: // Comments
|
||||||
$notify_message = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n";
|
$notify_message = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n";
|
||||||
/* translators: 1: comment author, 2: author IP, 3: author domain */
|
/* 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( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
|
||||||
|
@ -1054,24 +1075,7 @@ function wp_notify_postauthor( $comment_id, $comment_type = '' ) {
|
||||||
$notify_message .= __('You can see all comments on this post here: ') . "\r\n";
|
$notify_message .= __('You can see all comments on this post here: ') . "\r\n";
|
||||||
/* translators: 1: blog name, 2: post title */
|
/* translators: 1: blog name, 2: post title */
|
||||||
$subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title );
|
$subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title );
|
||||||
} elseif ('trackback' == $comment_type) {
|
break;
|
||||||
$notify_message = sprintf( __( 'New trackback on your post "%s"' ), $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) {
|
|
||||||
$notify_message = sprintf( __( 'New pingback on your post "%s"' ), $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 );
|
|
||||||
}
|
}
|
||||||
$notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
|
$notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
|
||||||
$notify_message .= sprintf( __('Permalink: %s'), get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment_id ) . "\r\n";
|
$notify_message .= sprintf( __('Permalink: %s'), get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment_id ) . "\r\n";
|
||||||
|
@ -1148,8 +1152,7 @@ function wp_notify_moderator($comment_id) {
|
||||||
// we want to reverse this for the plain text arena of emails.
|
// we want to reverse this for the plain text arena of emails.
|
||||||
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
||||||
|
|
||||||
switch ($comment->comment_type)
|
switch ( $comment->comment_type ) {
|
||||||
{
|
|
||||||
case 'trackback':
|
case 'trackback':
|
||||||
$notify_message = sprintf( __('A new trackback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n";
|
$notify_message = sprintf( __('A new trackback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n";
|
||||||
$notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
|
$notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
|
||||||
|
|
Loading…
Reference in New Issue