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
|
|
|
*/
|
2010-07-21 03:56:12 +02:00
|
|
|
if(class_exists('EditableFormField')){
|
|
|
|
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
|
|
|
|
2010-07-21 03:56:12 +02:00
|
|
|
function getFormField() {
|
|
|
|
if($protector = SpamProtectorManager::get_spam_protector()) {
|
|
|
|
if($protector) {
|
|
|
|
$protector = new $protector();
|
2012-04-14 13:23:38 +02:00
|
|
|
|
2010-07-21 03:56:12 +02: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;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getFieldValidationOptions() {
|
2012-07-07 00:59:57 +02:00
|
|
|
return new FieldList();
|
2012-04-14 13:23:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
2010-07-21 03:56:12 +02:00
|
|
|
function showInReports() {
|
|
|
|
return false;
|
|
|
|
}
|
2009-07-05 08:47:43 +02:00
|
|
|
}
|
2010-07-21 03:56:12 +02:00
|
|
|
}
|