silverstripe-spamprotection/code/Extension/CommentSpamProtection.php

33 lines
741 B
PHP
Raw Normal View History

<?php
namespace SilverStripe\SpamProtection\Extension;
2016-10-10 07:44:28 +02:00
use SilverStripe\Core\Extension;
/**
* Apply the spam protection to the comments module if it is installed.
*
* @package spamprotection
*/
2015-11-21 07:15:15 +01:00
class CommentSpamProtection extends Extension
{
public function alterCommentForm(&$form)
{
$form->enableSpamProtection(array(
'name' => 'IsSpam',
'mapping' => array(
'Name' => 'authorName',
'Email' => 'authorEmail',
'URL' => 'authorUrl',
'Comment' => 'body',
'ReturnURL' => 'contextUrl'
),
'checks' => array(
'spam',
'profanity'
)
));
}
}