2017-07-07 04:23:01 +02:00
|
|
|
<?php
|
2010-12-13 01:50:08 +01:00
|
|
|
|
2017-08-28 00:53:32 +02:00
|
|
|
namespace SilverStripe\SpamProtection\Extension;
|
2016-10-10 07:44:28 +02:00
|
|
|
|
|
|
|
use SilverStripe\Core\Extension;
|
|
|
|
|
2010-12-13 01:50:08 +01:00
|
|
|
/**
|
2014-02-10 08:53:59 +01:00
|
|
|
* Apply the spam protection to the comments module if it is installed.
|
2010-12-13 01:50:08 +01:00
|
|
|
*
|
|
|
|
* @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'
|
|
|
|
)
|
|
|
|
));
|
|
|
|
}
|
2013-04-10 04:52:08 +02:00
|
|
|
}
|