silverstripe-spamprotection/code/extensions/CommentSpamProtection.php
Will Rossiter 440e30b611 API: Use config / extension APIs
Overhaul of spam protection to use an extension on Form rather than the SpamProtectorManager. More fluent interface and easier to replace the built in spam protection api with an alternative.
2014-02-10 20:53:59 +13:00

27 lines
485 B
PHP

<?php
/**
* Apply the spam protection to the comments module if it is installed.
*
* @package spamprotection
*/
class CommentSpamProtection extends Extension {
public function alterCommentForm(&$form) {
$form->enableSpamProtection(array(
'mapping' => array(
'Name' => 'authorName',
'Email' => 'authorEmail',
'URL' => 'authorUrl',
'Comment' => 'body',
'ReturnURL' => 'contextUrl'
),
'checks' => array(
'spam',
'profanity'
)
));
}
}