-
-
Notifications
You must be signed in to change notification settings - Fork 28
en Hooks
timse201 edited this page Jan 28, 2017
·
11 revisions
Hooks allow to the user to extend the functional extent of a WordPress-Plugins. The following Hooks are deposited in Antispam Bee and can be addressed or controlled via code:
Extension of RegExp rules or regular expressions. This allows you to specify custom antispam rules that are adapted to the current type of spam at any time. Conclusion: Faster response with less spam. Nevertheless, we would be glad if you report this spam or if you pull the extension here on the GitHub repository.
Type: Array
Example:
function antispam_bee_patterns() {
add_filter( 'antispam_bee_patterns', 'antispam_bee_add_custom_patterns' );
}
add_action( 'init', 'antispam_bee_patterns' );
// Determine individual filters (author, host, body, ip, email). Separate multiple regular expressions with |
function antispam_bee_add_custom_patterns($patterns) {
// Autoren filtern
$patterns[] = array(
'author' => 'Autor1|Autor2|Autor3'
);
// Filter URL (example filters example.de.cool and example.de with and without www.)
$patterns[] = array(
'host' => '^(www\.)?example\.de\.cool$|^(www\.)?example\.de$'
);
// Filter comment content (example treats 3 or more links in the comment as spam)
$patterns[] = array(
'body' => '(.*(http|https|ftp|ftps)\:\/\/){3,}'
);
// Filter IP address (example filters 192.168.XXX.XXX)
$patterns[] = array(
'ip' => '^(192\.)(168\.)(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.)([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'
);
// Filter e-mail address (example treats .xx or .xxx as spam)
$patterns[] = array(
'email' => '(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.(xx|xxx)+$)'
);
return $patterns;
}
With this plugin filter the subject of the notification mails can be defined according to your own wishes.
Type: String