From fbd7cc9b6d985d91da41e2cb58993730e1c0507a Mon Sep 17 00:00:00 2001 From: saxmatt Date: Sun, 9 May 2004 22:36:47 +0000 Subject: [PATCH] Comment count patch from Kitty. http://poker.mookitty.co.uk/ git-svn-id: http://svn.automattic.com/wordpress/trunk@1252 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 8196caa08..02ad4c91a 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1334,6 +1334,10 @@ function get_posts($args) { function check_comment($author, $email, $url, $comment, $user_ip) { if (1 == get_settings('comment_moderation')) return false; // If moderation is set to manual + + if ( (count(explode('http:', $comment)) - 1) >= get_settings('comment_max_links') ) + return false; // Check # of external links + if ('' == trim( get_settings('moderation_keys') ) ) return true; // If moderation keys are empty $words = explode("\n", get_settings('moderation_keys') ); foreach ($words as $word) { @@ -1346,10 +1350,6 @@ function check_comment($author, $email, $url, $comment, $user_ip) { if ( preg_match($pattern, $user_ip) ) return false; } - preg_match_all('|([\n ])([a-z]+?)://([^, <>{}\n\r]+)|i', $comment, $all_links); - $number = count($all_links[0]); - if ($number >= get_settings('comment_max_links')) return false; - return true; }