PHP code example of tractorcow / silverstripe-akismet

1. Go to this page and download the library: Download tractorcow/silverstripe-akismet library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tractorcow / silverstripe-akismet example snippets


Config::inst()->update('FormSpamProtectionExtension', 'default_spam_protector', 'AkismetSpamProtector');
AkismetSpamProtector::set_api_key('5555dddd55d5d');

if(!Director::isLive()) {
	Config::inst()->remove('AkismetSpamProtector', 'bypass_permission');
	Config::inst()->remove('AkismetSpamProtector', 'bypass_members');
}

CommentingController::add_extension('CommentSpamProtection');

Config::inst()->update('AkismetSpamProtector', '

define('SS_AKISMET_API_KEY', '5555dddd55d5d');
// and set AkismetSpamProtector as your spam protector using one of the above methods
`
$form  = new Form($this, 'Form', $fields, $actions, $validator);
$form->enableSpamProtection(array(
  'mapping' => array(
    'Name' => 'authorName',
    'Email' => 'authorMail',
    'Comments' => 'body'
    )
  )
);