Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_blacklist_check [ WordPress Function ]

wp_blacklist_check ( $author, $email, $url, $comment, $user_ip, $user_agent )
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
Uses:
Returns:
  • (bool) True if comment contains blacklisted content, false if comment does not
Defined at:



Does comment contain blacklisted characters or words.

Source


<?php
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 trimget_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;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics