mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-02 09:30:09 +00:00
Move plugin replacebale functions to pluggable-functions.php. http://mosquito.wordpress.org/view.php?id=1211
git-svn-id: https://develop.svn.wordpress.org/trunk@2516 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -614,105 +614,6 @@ function wp_get_comment_status($comment_id) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('wp_notify_postauthor') ) {
|
||||
function wp_notify_postauthor($comment_id, $comment_type='') {
|
||||
global $wpdb;
|
||||
|
||||
$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
|
||||
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
|
||||
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID='$post->post_author' LIMIT 1");
|
||||
|
||||
if ('' == $user->user_email) return false; // If there's no email to send the comment to
|
||||
|
||||
$comment_author_domain = gethostbyaddr($comment->comment_author_IP);
|
||||
|
||||
$blogname = get_settings('blogname');
|
||||
|
||||
if ( empty( $comment_type ) ) $comment_type = 'comment';
|
||||
|
||||
if ('comment' == $comment_type) {
|
||||
$notify_message = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\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";
|
||||
$notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";
|
||||
$notify_message .= sprintf( __('URI : %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";
|
||||
$subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title );
|
||||
} elseif ('trackback' == $comment_type) {
|
||||
$notify_message = sprintf( __('New trackback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
|
||||
$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( __('URI : %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";
|
||||
$subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
|
||||
} elseif ('pingback' == $comment_type) {
|
||||
$notify_message = sprintf( __('New pingback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
|
||||
$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( __('URI : %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";
|
||||
$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 .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
|
||||
|
||||
if ('' == $comment->comment_author_email || '' == $comment->comment_author) {
|
||||
$from = "From: \"$blogname\" <wordpress@" . $_SERVER['SERVER_NAME'] . '>';
|
||||
} else {
|
||||
$from = 'From: "' . $comment->comment_author . "\" <$comment->comment_author_email>";
|
||||
}
|
||||
|
||||
$message_headers = "MIME-Version: 1.0\r\n"
|
||||
. "$from\r\n"
|
||||
. "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\r\n";
|
||||
|
||||
@wp_mail($user->user_email, $subject, $notify_message, $message_headers);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* wp_notify_moderator
|
||||
notifies the moderator of the blog (usually the admin)
|
||||
about a new comment that waits for approval
|
||||
always returns true
|
||||
*/
|
||||
if ( !function_exists('wp_notify_moderator') ) {
|
||||
function wp_notify_moderator($comment_id) {
|
||||
global $wpdb;
|
||||
|
||||
if( get_settings( "moderation_notify" ) == 0 )
|
||||
return true;
|
||||
|
||||
$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
|
||||
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
|
||||
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID='$post->post_author' LIMIT 1");
|
||||
|
||||
$comment_author_domain = gethostbyaddr($comment->comment_author_IP);
|
||||
$comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");
|
||||
|
||||
$notify_message = sprintf( __('A new comment on the post #%1$s "%2$s" is waiting for your approval'), $post->ID, $post->post_title ) . "\r\n";
|
||||
$notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\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";
|
||||
$notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";
|
||||
$notify_message .= sprintf( __('URI : %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 .= sprintf( __('To approve this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=mailapprovecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
|
||||
$notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
|
||||
$notify_message .= sprintf( __('Currently %s comments are waiting for approval. Please visit the moderation panel:'), $comments_waiting ) . "\r\n";
|
||||
$notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n";
|
||||
|
||||
$subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_settings('blogname'), $post->post_title );
|
||||
$admin_email = get_settings("admin_email");
|
||||
|
||||
@wp_mail($admin_email, $subject, $notify_message);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) {
|
||||
global $wpdb;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user