Version: current

     1 <?php
     2
     3 /**
     4  * Protecter class to handle spam protection interface
     5  *
     6  * @package recaptcha
     7  */
     8
     9 class PhpCaptchaProtector implements SpamProtector {
    10
    11     /**
    12      * Return the Field that we will use in this protector
    13      *
    14      * @return string
    15      */
    16     function getFormField($name = "PhpCaptchaField", $title = "Captcha", $value = null, $form = null, $rightTitle = null) {
    17         return new PhpCaptchaField($name, $title, $value, $form, $rightTitle);
    18     }
    19
    20     /**
    21      * Needed for the interface. Recaptcha does not have a feedback loop
    22      *
    23      * @return boolean
    24      */
    25     function sendFeedback($object = null, $feedback = "") {
    26         return false;
    27     }
    28     public function getFieldName() {
    29         return 'PhpCaptchaField';
    30     }
    31
    32     /**
    33      * Update a form with the Simple Spam Field Protection
    34      */
    35     function updateForm($form, $before=null, $fieldsToSpamServiceMapping=null) {
    36         if ($before && $form->Fields()->fieldByName($before)) {
    37             $form->Fields()->insertBefore($this->getFormField("Captcha", null, null, $form, null), $before);
    38         } else {
    39             $form->Fields()->push($this->getFormField("Captcha", null, null, $form, null));
    40         }
    41         return $form->Fields();
    42     }
    43
    44     /**
    45      * Set which fields need to be mapped for protection
    46      */
    47     function setFieldMapping($fieldToPostTitle, $fieldsToPostBody=null, $fieldToAuthorName=null, $fieldToAuthorUrl=null, $fieldToAuthorEmail=null, $fieldToAuthorOpenId=null) {
    48
    49     }
    50 }
    51

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -