Make consent checkbox and form note configurable
Add independent admin controls for the consent checkbox and explanatory note. Keep both enabled by default so existing installations retain their current behavior. Render the optional elements conditionally and require consent in server validation only when the checkbox is enabled. Bump the plugin and stable release version to 1.3.4, document the controls, and cover enabled/disabled rendering, validation, and invalid settings in the integration suite. Validation: PHP syntax and NL/EN integration checks passed on Hephaestus, with mail intercepted during tests. Staged whitespace checks passed. No changes to antispam behavior or other website configurations.
This commit is contained in:
1 parent
0cad18c757
commit
e1df255b0b
7 files changed
+25
-7
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
if (!defined('ABSPATH')) exit;
|
||||
function hgcf_defaults() {
|
||||
return ['recipient'=>get_option('admin_email'),'site_name'=>get_bloginfo('name'),'contact_name'=>'','sender_email'=>'','sender_name'=>'','altcha_enabled'=>false,
|
||||
return ['recipient'=>get_option('admin_email'),'site_name'=>get_bloginfo('name'),'contact_name'=>'','sender_email'=>'','sender_name'=>'','altcha_enabled'=>false,'show_consent'=>true,'show_note'=>true,
|
||||
'title_nl'=>'Waarmee kunnen we je helpen?','title_en'=>'How can we help?',
|
||||
'consent_nl'=>'Mijn gegevens mogen worden gebruikt om op dit bericht te reageren.','consent_en'=>'My details may be used to reply to this message.',
|
||||
'note_nl'=>'Je bericht wordt per e-mail verstuurd en niet op deze website opgeslagen. Deel hier geen medische of andere gevoelige gegevens.','note_en'=>'Your message is sent by email and is not stored on this website. Please do not include medical or other sensitive details.',
|
||||
@@ -86,6 +86,7 @@ function hgcf_sanitize_settings($input) {
|
||||
$old=hgcf_settings();if(!is_array($input))return $old;
|
||||
if(($_POST['option_page']??'')==='hgcf'&&($input['_complete']??'')!=='1'){add_settings_error('hgcf_settings','incomplete','Niet alle velden zijn ontvangen. Je instellingen zijn niet gewijzigd.');return $old;}
|
||||
$out=$old;
|
||||
foreach(['show_consent','show_note'] as $key)if(array_key_exists($key,$input)){if(in_array($input[$key],['0','1'],true))$out[$key]=$input[$key]==='1';else add_settings_error('hgcf_settings',$key,'Controleer de weergave-instelling.');}
|
||||
if(array_key_exists('altcha_enabled',$input)) {
|
||||
if(in_array($input['altcha_enabled'],['0','1'],true))$out['altcha_enabled']=$input['altcha_enabled']==='1';
|
||||
else add_settings_error('hgcf_settings','altcha_enabled','Controleer de antispaminstelling.');
|
||||
|
||||
Reference in new issue
Block a user