2009-03-25 03:14:26 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Editable Spam Protecter Field. Used with the User Defined Forms module (if
|
|
|
|
* installed) to allow the user to have captcha fields with their custom forms
|
|
|
|
*
|
2009-09-17 06:06:53 +02:00
|
|
|
* @package spamprotection
|
2009-03-25 03:14:26 +01:00
|
|
|
*/
|
2014-02-10 08:53:59 +01:00
|
|
|
if(class_exists('EditableFormField')) {
|
|
|
|
|
2010-07-21 03:56:12 +02:00
|
|
|
class EditableSpamProtectionField extends EditableFormField {
|
2009-03-25 03:14:26 +01:00
|
|
|
|
2010-07-21 03:56:12 +02:00
|
|
|
static $singular_name = 'Spam Protection Field';
|
2009-03-25 03:14:26 +01:00
|
|
|
|
2010-07-21 03:56:12 +02:00
|
|
|
static $plural_name = 'Spam Protection Fields';
|
2009-03-25 03:14:26 +01:00
|
|
|
|
2014-02-10 08:53:59 +01:00
|
|
|
public function getFormField() {
|
|
|
|
if($protector = Config::inst()->get('FormSpamProtectionExtension', 'default_spam_protector')) {
|
|
|
|
$protector = Injector::inst()->create($protector);
|
2012-04-14 13:23:38 +02:00
|
|
|
|
2014-02-10 08:53:59 +01:00
|
|
|
return $protector->getFormField($this->Name, $this->Title, null);
|
2009-03-25 03:14:26 +01:00
|
|
|
}
|
2012-04-14 13:23:38 +02:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-02-10 08:53:59 +01:00
|
|
|
public function getFieldValidationOptions() {
|
2012-07-07 00:59:57 +02:00
|
|
|
return new FieldList();
|
2012-04-14 13:23:38 +02:00
|
|
|
}
|
|
|
|
|
2014-02-10 08:53:59 +01:00
|
|
|
public function getRequired() {
|
2010-07-21 03:56:12 +02:00
|
|
|
return false;
|
2009-03-25 03:14:26 +01:00
|
|
|
}
|
2009-09-17 06:06:53 +02:00
|
|
|
|
2010-07-21 03:56:12 +02:00
|
|
|
public function Icon() {
|
|
|
|
return 'spamprotection/images/' . strtolower($this->class) . '.png';
|
|
|
|
}
|
2009-04-20 05:06:29 +02:00
|
|
|
|
2014-02-10 08:53:59 +01:00
|
|
|
public function showInReports() {
|
2010-07-21 03:56:12 +02:00
|
|
|
return false;
|
|
|
|
}
|
2009-07-05 08:47:43 +02:00
|
|
|
}
|
2010-07-21 03:56:12 +02:00
|
|
|
}
|