API Refactor field mapping from FormSpamProtectionExtension into SpamProtector API EditableSpamProtectionField may now be configured for spam on an individual field basis Translations added

This commit is contained in:
Damian Mooyman 2014-02-18 16:19:29 +13:00 committed by Will Rossiter
parent 39f7f0be45
commit 9abe13fcb6
2 changed files with 10 additions and 12 deletions

View File

@ -13,7 +13,6 @@ if(class_exists('EditableFormField')) {
static $singular_name = 'Spam Protection Field';
static $plural_name = 'Spam Protection Fields';
/**
* Fields to include spam detection for
*
@ -27,10 +26,9 @@ if(class_exists('EditableFormField')) {
);
public function getFormField() {
// Get protector
$protector = FormSpamProtectionExtension::get_protector();
if(empty($protector)) return false;
if(!$protector) return false;
// Extract saved field mappings and update this field.
$fieldMapping = array();

View File

@ -51,15 +51,15 @@ class FormSpamProtectionExtension extends Extension {
// generate the spam protector
if(isset($options['protector'])) {
$protector = $options['protector'];
if(is_string($protector)) {
$protector = Injector::inst()->create($protector);
}
} else {
$protector = Config::inst()->get('FormSpamProtectionExtension', 'default_spam_protector');
$protector = Injector::inst()->create($protector);
}
return $protector;
if($protector && class_exists($protector)) {
return Injector::inst()->create($protector);
} else {
return null;
}
}
/**