1 | <?php namespace StudioBonito\SilverStripe\SpamProtection\Honeypot\FormField; |
||
5 | class HoneypotField extends \HiddenField |
||
6 | { |
||
7 | /** |
||
8 | * The number of seconds before you can submit a valid request. |
||
9 | * |
||
10 | * @var int |
||
11 | * @config |
||
12 | */ |
||
13 | private static $time_limit = 5; |
||
|
|||
14 | |||
15 | /** |
||
16 | * Reject the field if the honeypot has been filled or if the form has been submitted to quickly. |
||
17 | * |
||
18 | * @param $validator |
||
19 | * |
||
20 | * @return bool |
||
21 | */ |
||
22 | 6 | public function validate($validator) |
|
43 | |||
44 | /** |
||
45 | * Override the Type to remove the class namespace. |
||
46 | * |
||
47 | * @codeCoverageIgnore |
||
48 | * |
||
49 | * @return string |
||
50 | */ |
||
51 | public function Type() |
||
55 | |||
56 | /** |
||
57 | * Override the Field to add the Captcha and Timestamp fields. |
||
58 | * |
||
59 | * @codeCoverageIgnore |
||
60 | * |
||
61 | * @param array $properties |
||
62 | * |
||
63 | * @return string |
||
64 | */ |
||
65 | public function Field($properties = array()) |
||
69 | |||
70 | /** |
||
71 | * Create the Captcha Field. |
||
72 | * |
||
73 | * @codeCoverageIgnore |
||
74 | * |
||
75 | * @return string |
||
76 | */ |
||
77 | protected function createHoneypotField() |
||
90 | |||
91 | /** |
||
92 | * Create the Timestamp Field. |
||
93 | * |
||
94 | * @codeCoverageIgnore |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | protected function createTimestampField() |
||
111 | } |
||
112 |
This check marks private properties in classes that are never used. Those properties can be removed.