From 2a3564c8ad3b22751b4cc1d165f93f667cec4b61 Mon Sep 17 00:00:00 2001 From: nacin Date: Sun, 28 Feb 2010 20:02:14 +0000 Subject: [PATCH] Provide filter to allow including comment author's URL in comment moderation link count. see #11684 git-svn-id: http://svn.automattic.com/wordpress/trunk@13513 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 7c6bf4b6d..cbe8bba4f 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -45,8 +45,13 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $ if ( 1 == get_option('comment_moderation') ) return false; // If moderation is set to manual - if ( get_option( 'comment_max_links' ) && preg_match_all( '/]*href/i', apply_filters( 'comment_text', $comment ), $out) >= get_option( 'comment_max_links' ) ) - return false; // Check # of external links + // Check # of external links + if ( $max_links = get_option( 'comment_max_links' ) ) { + $num_links = preg_match_all( '/]*href/i', apply_filters( 'comment_text', $comment ), $out ); + $num_links = apply_filters( 'comment_max_links_url', $num_links, $url ); // provide for counting of $url as a link + if ( $num_links >= $max_links ) + return false; + } $mod_keys = trim(get_option('moderation_keys')); if ( !empty($mod_keys) ) {