1 | <?php |
||
16 | class FormSpamProtectionExtension extends Extension |
||
17 | { |
||
18 | use Configurable; |
||
19 | |||
20 | /** |
||
21 | * @config |
||
22 | * |
||
23 | * The default spam protector class name to use. Class should implement the |
||
24 | * {@link SpamProtector} interface. |
||
25 | * |
||
26 | * @var string $spam_protector |
||
27 | */ |
||
28 | private static $default_spam_protector; |
||
29 | |||
30 | /** |
||
31 | * @config |
||
32 | * |
||
33 | * The {@link enableSpamProtection} method will define which of the form |
||
34 | * values correlates to this form mapped fields list. Totally custom forms |
||
35 | * and subclassed SpamProtector instances are define their own mapping |
||
36 | * |
||
37 | * @var array $mappable_fields |
||
38 | */ |
||
39 | private static $mappable_fields = array( |
||
40 | 'id', |
||
41 | 'title', |
||
42 | 'body', |
||
43 | 'contextUrl', |
||
44 | 'contextTitle', |
||
45 | 'authorName', |
||
46 | 'authorMail', |
||
47 | 'authorUrl', |
||
48 | 'authorIp', |
||
49 | 'authorId' |
||
50 | ); |
||
51 | |||
52 | /** |
||
53 | * @config |
||
54 | * |
||
55 | * The field name to use for the {@link SpamProtector} {@link FormField} |
||
56 | * |
||
57 | * @var string $spam_protector |
||
58 | */ |
||
59 | private static $field_name = "Captcha"; |
||
60 | |||
61 | /** |
||
62 | * Instantiate a SpamProtector instance |
||
63 | * |
||
64 | * @param array $options Configuration options |
||
65 | * @return SpamProtector|null |
||
66 | */ |
||
67 | public static function get_protector($options = null) |
||
82 | |||
83 | /** |
||
84 | * Activates the spam protection module. |
||
85 | * |
||
86 | * @param array $options |
||
87 | * @return Object |
||
88 | */ |
||
89 | public function enableSpamProtection($options = array()) |
||
132 | } |
||
133 |