-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlugin.php
More file actions
60 lines (54 loc) · 1.5 KB
/
Copy pathPlugin.php
File metadata and controls
60 lines (54 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php declare(strict_types=1);
namespace RegularJogger\MagicFormsHoneypot;
use System\Classes\PluginBase;
use Event;
use RegularJogger\MagicFormsHoneypot\Classes\Events\FormSubmissionHandler;
use RegularJogger\MagicFormsHoneypot\Components\HoneypotField;
/**
* Plugin Information File
*
* @link https://docs.octobercms.com/4.x/extend/system/plugins.html
*/
class Plugin extends PluginBase
{
/**
* compatible plugins
*/
protected array $compatiblePlugins = [
'martin.forms',
'blakejones.magicforms',
'publipresse.forms',
'webbook.forms',
];
/**
* pluginDetails about this plugin.
*/
public function pluginDetails(): array
{
return [
'name' => 'Magic Forms Honeypot',
'description' => 'Dismisses bot submissions to Magic Forms using the honeypot technique.',
'author' => 'RegularJogger',
'icon' => 'icon-bolt',
'homepage' => 'https://github.com/regularjogger/magicformshoneypot-plugin',
];
}
/**
* boot method, called right before the request route.
*/
public function boot(): void
{
foreach ($this->compatiblePlugins as $plugin) {
Event::listen($plugin . '.beforeSaveRecord', FormSubmissionHandler::class);
}
}
/**
* registerComponents used by the frontend
*/
public function registerComponents(): array
{
return [
HoneypotField::class => 'honeypotField',
];
}
}