From 063ab31a4fab5317d36c1955a75a5d9823e119fd Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Mon, 10 Jan 2005 20:26:10 +0000 Subject: [PATCH] Add more hooks into commenting. git-svn-id: https://develop.svn.wordpress.org/trunk@2076 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions-post.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wp-includes/functions-post.php b/wp-includes/functions-post.php index c5307e2a74..0626f5dee4 100644 --- a/wp-includes/functions-post.php +++ b/wp-includes/functions-post.php @@ -384,6 +384,8 @@ function user_can_edit_user($user_id, $other_user) { function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) { global $wpdb; + do_action('wp_blacklist_check', ''); + if ( preg_match_all('/&#(\d+);/', $comment, $chars) ) { foreach ($chars[1] as $char) { // If it's an encoded char in the normal ASCII set, reject @@ -446,6 +448,7 @@ function wp_new_comment( $commentdata, $spam = false ) { $time_lastcomment = mysql2date('U', $lasttime); $time_newcomment = mysql2date('U', $now_gmt); if ( ($time_newcomment - $time_lastcomment) < 15 ) + do_action('comment_flood_trigger', ''); die( __('Sorry, you can only post a new comment once every 15 seconds. Slow down cowboy.') ); } @@ -455,6 +458,8 @@ function wp_new_comment( $commentdata, $spam = false ) { $approved = 0; if ( wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) ) $approved = 'spam'; + + $approved = apply_filters('pre_comment_approved', $approved); $result = $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type)