Block comments containing unwanted strings in WordPress

/**
 * Block comments that contains unwanted strings
 */
function lpj_contains($str, array $arr){
    foreach($arr as $a) {
        if (stripos($str,$a) !== false) return true;
    }
    return false;
}

function lpj_block_spam_comments($post_id) {
    $unwanted_strings = array(
        'www.',
        'http:',
        'https:',
        '<a',
        '.ru',
        'mail.ru',
        'yandex.ru',
        'bk.ru',
        'yandex.com',
        'viagra',
    );

    $is_spam = false;

    $comment = isset( $_POST['comment'] ) ? fss( $_POST['comment'] ) : '';

    if (lpj_contains($comment, $unwanted_strings)) {
        $is_spam = true;
    }

    if($is_spam) {
        $ret_link = get_permalink($post_id);

        wp_die('Comment declined: unwanted string detected. <a href="'.$ret_link.'">Return to Blog Post</a>');
    }

    return $post_id;
} 
add_filter('pre_comment_on_post', 'lpj_block_spam_comments');