Created
March 27, 2012 10:19
-
-
Save devster/2214618 to your computer and use it in GitHub Desktop.
Basic Form robot protection sf1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyForm extends sfForm | |
{ | |
protected $robotProtectionFieldName = "_honeypot_robot"; | |
public function __construct($defaults = array(), $options = array(), $CSRFSecret = null) | |
{ | |
parent::__construct($defaults, $options, $CSRFSecret); | |
$this->validatorSchema[$this->robotProtectionFieldName] = new sfValidatorRegex(array('required' => false, 'pattern' => '/^$/')); | |
$this->widgetSchema[$this->robotProtectionFieldName] = new sfWidgetFormInputText(array('is_hidden' => true), array('style' => 'display: none;')); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment