1 | <?php namespace StudioBonito\SilverStripe\SpamProtection\Honeypot\FormField; |
||
7 | class HoneypotField extends TextField |
||
8 | { |
||
9 | /** |
||
10 | * The number of seconds before you can submit a valid request. |
||
11 | * |
||
12 | * @var int |
||
13 | * @config |
||
14 | */ |
||
15 | private static $time_limit = 5; |
||
|
|||
16 | |||
17 | /** |
||
18 | * Reject the field if the honeypot has been filled or if the form has been submitted to quickly. |
||
19 | * |
||
20 | * @param $validator |
||
21 | * |
||
22 | 6 | * @return bool |
|
23 | */ |
||
24 | 6 | public function validate($validator) |
|
45 | |||
46 | /** |
||
47 | * Since this isn't a hidden field, the title will continue to show in the form. |
||
48 | * This prevents that from happening, since a hidden field will not show the validation message. |
||
49 | * |
||
50 | * @codeCoverageIgnore |
||
51 | * |
||
52 | * @return string |
||
53 | */ |
||
54 | public function Title() |
||
58 | |||
59 | /** |
||
60 | * Override the Type to remove the class namespace. |
||
61 | * |
||
62 | * @codeCoverageIgnore |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | public function Type() |
||
70 | |||
71 | /** |
||
72 | * Override the Field to add the Captcha and Timestamp fields. |
||
73 | * |
||
74 | * @codeCoverageIgnore |
||
75 | * |
||
76 | * @param array $properties |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | public function Field($properties = array()) |
||
84 | |||
85 | /** |
||
86 | * Create the Captcha Field. |
||
87 | * |
||
88 | * @codeCoverageIgnore |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | protected function createHoneypotField() |
||
105 | |||
106 | /** |
||
107 | * Create the Timestamp Field. |
||
108 | * |
||
109 | * @codeCoverageIgnore |
||
110 | * |
||
111 | * @return string |
||
112 | */ |
||
113 | protected function createTimestampField() |
||
126 | |||
127 | /** |
||
128 | * Return a configured style rule for the fields, if none is configured use a default display:none rule |
||
129 | * |
||
130 | * @codeCoverageIgnore |
||
131 | * |
||
132 | * @return string |
||
133 | */ |
||
134 | public function getFieldStyle() |
||
144 | } |
||
145 |
This check marks private properties in classes that are never used. Those properties can be removed.