RegisterSettings.php
62 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Settings\Security\Actions; |
| 4 | |
| 5 | /** |
| 6 | * @since 3.17.0 |
| 7 | */ |
| 8 | class RegisterSettings |
| 9 | { |
| 10 | /** |
| 11 | * @since 3.17.0 |
| 12 | */ |
| 13 | public function __invoke(array $settings): array |
| 14 | { |
| 15 | if ('security' !== give_get_current_setting_section()) { |
| 16 | return $settings; |
| 17 | } |
| 18 | |
| 19 | return $this->getSettings(); |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * @since 3.17.0 |
| 24 | */ |
| 25 | protected function getSettings(): array |
| 26 | { |
| 27 | return [ |
| 28 | [ |
| 29 | 'id' => 'give_title_settings_security_1', |
| 30 | 'type' => 'title', |
| 31 | ], |
| 32 | $this->getHoneypotSettings(), |
| 33 | [ |
| 34 | 'id' => 'give_title_settings_security_1', |
| 35 | 'type' => 'sectionend', |
| 36 | ], |
| 37 | ]; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * @since 3.17.1 enable by default |
| 42 | * @since 3.17.0 |
| 43 | */ |
| 44 | public function getHoneypotSettings(): array |
| 45 | { |
| 46 | return [ |
| 47 | 'name' => __('Enable Honeypot Field', 'give'), |
| 48 | 'desc' => __( |
| 49 | 'If enabled, this option will add a honeypot security measure to all donation forms', |
| 50 | 'give' |
| 51 | ), |
| 52 | 'id' => 'givewp_donation_forms_honeypot_enabled', |
| 53 | 'type' => 'radio_inline', |
| 54 | 'default' => 'enabled', |
| 55 | 'options' => [ |
| 56 | 'enabled' => __('Enabled', 'give'), |
| 57 | 'disabled' => __('Disabled', 'give'), |
| 58 | ], |
| 59 | ]; |
| 60 | } |
| 61 | } |
| 62 |