Definition:
function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) {}
Does comment contain blacklisted characters or words.
Parameters
- string $author: The author of the comment
- string $email: The email of the comment
- string $url: The url used in the comment
- string $comment: The comment content
- string $user_ip: The comment author IP address
- string $user_agent: The author’s browser user agent
Return values
returns:True if comment contains blacklisted content, false if comment does not
Defined actions
- wp_blacklist_check
do_action('wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent);
Source code
function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) { do_action('wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent); $mod_keys = trim( get_option('blacklist_keys') ); if ( '' == $mod_keys ) return false; // If moderation keys are empty $words = explode("\n", $mod_keys ); foreach ( (array) $words as $word ) { $word = trim($word); // Skip empty lines if ( empty($word) ) { continue; } // Do some escaping magic so that '#' chars in the // spam words don't break things: $word = preg_quote($word, '#'); $pattern = "#$word#i"; if ( preg_match($pattern, $author) || preg_match($pattern, $email) || preg_match($pattern, $url) || preg_match($pattern, $comment) || preg_match($pattern, $user_ip) || preg_match($pattern, $user_agent) ) return true; } return false; }
3433
No comments yet... Be the first to leave a reply!