Move technical details into plugin information tab

This commit is contained in:
parkel committed 2026-10-12 14:15:23 +02:00
1 parent 2a2f1d5878
commit b9e7d0fdce
6 files changed
+30 -8

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@ Polylang wordt gebruikt voor automatische taalkeuze wanneer beschikbaar; anders
## Instellingen
Het beheer bestaat uit drie tabbladen: **Algemeen**, **Workflows** en **Teksten**.
Het beheer bestaat uit **Algemeen**, **Workflows**, **Teksten** en **Over deze plugin**. Het laatste tabblad toont de gebruikte techniek, de actuele versies en informatie over onderhoud.
- Ontvangstadres en naam voor het e-mailonderwerp.
- Optioneel afzenderadres en afzendernaam voor uitsluitend formuliermails. Een leeg adres behoudt de bestaande standaardafzender. Reply-To is altijd het bezoekersadres. Kies een adres op een domein waarvoor de mailserver via SPF/DKIM mag versturen. Het technische envelope/Return-Path-adres wordt niet door deze instelling aangepast; een mailserver of SMTP-plugin kan de uiteindelijke afzender overschrijven.
+3 -1
View File
@@ -1 +1,3 @@
.hgcf-admin{max-width:1160px}.hgcf-admin-header,.hgcf-panel-heading{display:flex;justify-content:space-between;align-items:center;gap:20px;margin:24px 0}.hgcf-admin-header h1{font-size:25px}.hgcf-admin-header p,.hgcf-panel-heading p{margin:8px 0;color:#50575e}.hgcf-language-status{background:#e8eef4;border:1px solid #d3dee9;padding:8px 13px;border-radius:20px;white-space:nowrap}.hgcf-admin-tabs{display:flex;gap:5px;border-bottom:1px solid #c3c4c7;margin-bottom:24px}.hgcf-admin-tabs a{color:#50575e;text-decoration:none;padding:14px 22px;font-size:15px;font-weight:600;border-bottom:3px solid transparent}.hgcf-admin-tabs a.is-active{color:#135e96;border-color:#2271b1}.hgcf-admin-tabs span{background:#e2e4e7;border-radius:15px;padding:2px 7px;margin-left:6px}.hgcf-admin-panel[hidden]{display:none}.hgcf-admin-card,.hgcf-workflow{background:#fff;border:1px solid #dcdcde;border-radius:8px;margin:0 0 20px}.hgcf-admin-card{padding:24px 28px}.hgcf-admin-card h2{margin-top:0}.hgcf-admin-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px 26px}.hgcf-admin-field{display:flex;flex-direction:column;gap:7px;margin:14px 0}.hgcf-admin-field>span,.hgcf-field-matrix label>span{font-weight:600;color:#1d2327}.hgcf-admin-field input,.hgcf-admin-field textarea{width:100%;max-width:none;min-height:38px}.hgcf-admin-field small{font-weight:400;color:#646970;line-height:1.6}.hgcf-admin-note{padding:15px 18px;background:#f0f6fc;border-left:3px solid #72aee6;margin-top:24px}.hgcf-workflow>summary{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 24px;cursor:pointer;font-size:16px;font-weight:600;list-style:none}.hgcf-workflow>summary::before{content:'›';font-size:24px;margin-right:5px}.hgcf-workflow[open]>summary::before{transform:rotate(90deg)}.hgcf-workflow-name{flex:1}.hgcf-workflow-badge{font-size:12px;background:#edf6ef;color:#245c31;padding:4px 9px;border-radius:15px}.hgcf-workflow-body{padding:0 24px 24px;border-top:1px solid #e8e8ea}.hgcf-workflow-toolbar{display:flex;justify-content:space-between;gap:20px;padding:20px 0}.hgcf-field-matrix{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}.hgcf-field-matrix label{display:flex;flex-direction:column;gap:8px}.hgcf-field-matrix select{max-width:none;width:100%;min-height:36px}.hgcf-checkbox{display:block;margin-top:20px}.hgcf-flow-services,.hgcf-flow-times{border-top:1px solid #e8e8ea;margin-top:24px;padding-top:6px}.hgcf-service-row{display:flex;align-items:center;gap:16px}.hgcf-service-row .hgcf-admin-field{flex:1;min-width:0}.hgcf-service-row button{white-space:nowrap;margin-top:18px}.hgcf-workflow-texts{margin-top:24px;border-top:1px solid #e8e8ea;padding-top:18px}.hgcf-workflow-texts summary{cursor:pointer;font-weight:600}.hgcf-save-bar{position:sticky;bottom:0;display:flex;align-items:center;gap:18px;background:#fff;border:1px solid #dcdcde;border-radius:8px;padding:16px 24px;margin-top:25px;z-index:5;box-shadow:0 -2px 8px #00000008}.hgcf-save-bar span{color:#646970}.hgcf-admin [hidden]{display:none!important}@media(max-width:782px){.hgcf-admin-header,.hgcf-panel-heading{align-items:flex-start;flex-direction:column}.hgcf-admin-grid{grid-template-columns:1fr}.hgcf-field-matrix{grid-template-columns:1fr 1fr}.hgcf-admin-card{padding:20px}.hgcf-service-row{flex-wrap:wrap}.hgcf-admin-tabs a{padding:12px}.hgcf-save-bar{flex-wrap:wrap}.hgcf-language-status{white-space:normal}}
.hgcf-admin{max-width:1160px}.hgcf-admin-header,.hgcf-panel-heading{display:flex;justify-content:space-between;align-items:center;gap:20px;margin:24px 0}.hgcf-admin-header h1{font-size:25px}.hgcf-admin-header p,.hgcf-panel-heading p{margin:8px 0;color:#50575e}.hgcf-language-status{background:#e8eef4;border:1px solid #d3dee9;padding:8px 13px;border-radius:20px;white-space:nowrap}.hgcf-admin-tabs{display:flex;flex-wrap:wrap;gap:5px;border-bottom:1px solid #c3c4c7;margin-bottom:24px}.hgcf-admin-tabs a{color:#50575e;text-decoration:none;padding:14px 22px;font-size:15px;font-weight:600;border-bottom:3px solid transparent}.hgcf-admin-tabs a.is-active{color:#135e96;border-color:#2271b1}.hgcf-admin-tabs span{background:#e2e4e7;border-radius:15px;padding:2px 7px;margin-left:6px}.hgcf-admin-panel[hidden]{display:none}.hgcf-admin-card,.hgcf-workflow{background:#fff;border:1px solid #dcdcde;border-radius:8px;margin:0 0 20px}.hgcf-admin-card{padding:24px 28px}.hgcf-admin-card h2{margin-top:0}.hgcf-admin-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px 26px}.hgcf-admin-field{display:flex;flex-direction:column;gap:7px;margin:14px 0}.hgcf-admin-field>span,.hgcf-field-matrix label>span{font-weight:600;color:#1d2327}.hgcf-admin-field input,.hgcf-admin-field textarea{width:100%;max-width:none;min-height:38px}.hgcf-admin-field small{font-weight:400;color:#646970;line-height:1.6}.hgcf-admin-note{padding:15px 18px;background:#f0f6fc;border-left:3px solid #72aee6;margin-top:24px}.hgcf-workflow>summary{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 24px;cursor:pointer;font-size:16px;font-weight:600;list-style:none}.hgcf-workflow>summary::before{content:'›';font-size:24px;margin-right:5px}.hgcf-workflow[open]>summary::before{transform:rotate(90deg)}.hgcf-workflow-name{flex:1}.hgcf-workflow-badge{font-size:12px;background:#edf6ef;color:#245c31;padding:4px 9px;border-radius:15px}.hgcf-workflow-body{padding:0 24px 24px;border-top:1px solid #e8e8ea}.hgcf-workflow-toolbar{display:flex;justify-content:space-between;gap:20px;padding:20px 0}.hgcf-field-matrix{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}.hgcf-field-matrix label{display:flex;flex-direction:column;gap:8px}.hgcf-field-matrix select{max-width:none;width:100%;min-height:36px}.hgcf-checkbox{display:block;margin-top:20px}.hgcf-flow-services,.hgcf-flow-times{border-top:1px solid #e8e8ea;margin-top:24px;padding-top:6px}.hgcf-service-row{display:flex;align-items:center;gap:16px}.hgcf-service-row .hgcf-admin-field{flex:1;min-width:0}.hgcf-service-row button{white-space:nowrap;margin-top:18px}.hgcf-workflow-texts{margin-top:24px;border-top:1px solid #e8e8ea;padding-top:18px}.hgcf-workflow-texts summary{cursor:pointer;font-weight:600}.hgcf-save-bar{position:sticky;bottom:0;display:flex;align-items:center;gap:18px;background:#fff;border:1px solid #dcdcde;border-radius:8px;padding:16px 24px;margin-top:25px;z-index:5;box-shadow:0 -2px 8px #00000008}.hgcf-save-bar span{color:#646970}.hgcf-admin [hidden]{display:none!important}@media(max-width:782px){.hgcf-admin-header,.hgcf-panel-heading{align-items:flex-start;flex-direction:column}.hgcf-admin-grid{grid-template-columns:1fr}.hgcf-field-matrix{grid-template-columns:1fr 1fr}.hgcf-admin-card{padding:20px}.hgcf-service-row{flex-wrap:wrap}.hgcf-admin-tabs a{padding:12px}.hgcf-save-bar{flex-wrap:wrap}.hgcf-language-status{white-space:normal}}
.hgcf-tech-table{overflow-x:auto}.hgcf-tech-table th,.hgcf-tech-table td{padding:12px 14px}.hgcf-tech-table td:first-child{font-weight:600}
+1 -1
View File
@@ -1,7 +1,7 @@
(() => {
const app=document.querySelector('.hgcf-admin');if(!app)return;
const panels=[...app.querySelectorAll('.hgcf-admin-panel')];const tabs=[...app.querySelectorAll('.hgcf-admin-tabs a')];
function selectTab(id){if(!panels.some(p=>p.id===id))id='hgcf-general';panels.forEach(p=>p.hidden=p.id!==id);tabs.forEach(t=>{const active=t.hash==='#'+id;t.classList.toggle('is-active',active);if(active)t.setAttribute('aria-current','page');else t.removeAttribute('aria-current');});}
function selectTab(id){if(!panels.some(p=>p.id===id))id='hgcf-general';panels.forEach(p=>p.hidden=p.id!==id);const saveBar=app.querySelector('.hgcf-save-bar');if(saveBar)saveBar.hidden=id==='hgcf-info';tabs.forEach(t=>{const active=t.hash==='#'+id;t.classList.toggle('is-active',active);if(active)t.setAttribute('aria-current','page');else t.removeAttribute('aria-current');});}
tabs.forEach(tab=>tab.addEventListener('click',()=>selectTab(tab.hash.slice(1))));selectTab(location.hash.slice(1));window.addEventListener('hashchange',()=>selectTab(location.hash.slice(1)));
let sequence=0;const unique=prefix=>prefix+Date.now().toString(36)+(++sequence).toString(36);
function initCard(card){
+2 -2
View File
@@ -2,13 +2,13 @@
/**
* Plugin Name: HG Contactformulier
* Description: Configureerbaar contactformulier met workflows en talen vanuit de website, zonder inzendingen op te slaan.
* Version: 1.3.0
* Version: 1.3.1
* Requires at least: 6.5
* Requires PHP: 8.1
* Text Domain: hg-contactform
*/
if (!defined('ABSPATH')) { exit; }
define('HGCF_VERSION','1.3.0');
define('HGCF_VERSION','1.3.1');
define('HGCF_FILE',__FILE__);
require_once __DIR__.'/includes/settings.php';
require_once __DIR__.'/includes/language.php';
+20 -2
View File
@@ -32,17 +32,34 @@ function hgcf_workflow_card($flow,$index,$languages,$template=false) {
<?php
}
add_action('admin_enqueue_scripts',function($hook){if($hook!=='toplevel_page_hg-contactform')return;wp_enqueue_style('hgcf-admin',plugins_url('assets/admin.css',HGCF_FILE),[],HGCF_VERSION);wp_enqueue_script('hgcf-admin',plugins_url('assets/admin.js',HGCF_FILE),[],HGCF_VERSION,true);});
function hgcf_admin_info() {
$manifest=json_decode(file_get_contents(__DIR__.'/vendor/altcha/versions.json'),true);
$version=fn($key)=>is_string($manifest[$key]['version']??null)?$manifest[$key]['version']:'Niet beschikbaar';
$polylang=function_exists('pll_languages_list')?(defined('POLYLANG_VERSION')?POLYLANG_VERSION:'Actief; versie niet beschikbaar'):'Niet actief';
$rows=[
['HG Contactformulier',HGCF_VERSION,'Formulier, workflows en beheer'],
['WordPress',get_bloginfo('version'),'Website en verzending via wp_mail'],
['PHP',PHP_VERSION,'Uitvoering op de server'],
['Polylang',$polylang,'Taalkeuze en vertalingen'],
['ALTCHA-widget',$version('widget'),'Antispamcontrole in de browser'],
['ALTCHA PHP-library',$version('php'),'Controle van het antwoord op de server'],
]; ?>
<section id="hgcf-info" class="hgcf-admin-panel"><div class="hgcf-admin-card"><h2>Over deze plugin</h2><p>Gebruikte onderdelen en hun versies op deze website.</p><div class="hgcf-tech-table"><table class="widefat striped"><thead><tr><th scope="col">Onderdeel</th><th scope="col">Versie</th><th scope="col">Functie</th></tr></thead><tbody><?php foreach($rows as $row): ?><tr><?php foreach($row as $value): ?><td><?php echo esc_html($value); ?></td><?php endforeach; ?></tr><?php endforeach; ?></tbody></table></div></div>
<div class="hgcf-admin-card"><h2>Antispam en verzending</h2><p>ALTCHA is lokaal gebundeld. De browser haalt een uitdaging op bij deze website; de server controleert het antwoord voordat er mail wordt verstuurd. Hiervoor worden geen externe verificatiediensten gebruikt.</p><p>De basisbescherming bestaat uit een verborgen botveld, een ondertekende tijdcontrole, formuliertokens en een verzendlimiet. Met ALTCHA worden ook verlopen en eerder gebruikte antwoorden geweigerd.</p><p>Berichten worden verstuurd via de bestaande mailvoorziening van WordPress en niet als inzendingen opgeslagen. Voor antispam worden tijdelijk technische limiet- en verificatiegegevens bewaard.</p></div>
<div class="hgcf-admin-card"><h2>Onderhoud</h2><p>ALTCHA wordt bijgewerkt als onderdeel van een nieuwe versie van HG Contactformulier. Er worden geen nieuwe versies automatisch van een CDN geladen.</p><p class="description">Voor ontwikkelaars: de repository bevat <code>scripts/update_altcha.py</code> voor versiecontrole en het bijwerken van de gebundelde onderdelen. Test een update voordat je de nieuwe pluginversie uitrolt.</p></div></section>
<?php
}
function hgcf_admin_page() {
if(!current_user_can('manage_options'))wp_die('Geen toegang.', '', ['response'=>403]);
$s=hgcf_settings();$languages=hgcf_languages();$flows=$s['workflows'];?>
<div class="wrap hgcf-admin"><header class="hgcf-admin-header"><div><h1>HG Contactformulier</h1><p>Beheer je mailinstellingen, bezoekersroutes en formulierteksten.</p></div><span class="hgcf-language-status"><?php echo count($languages)>1?'Meertalig via Polylang':'Eén website-taal'; ?> · <?php echo esc_html(implode(' / ',$languages)); ?></span></header>
<?php settings_errors('hgcf_settings'); ?>
<form action="options.php" method="post"><?php settings_fields('hgcf'); ?>
<nav class="hgcf-admin-tabs" aria-label="Instellingengroepen"><a class="is-active" href="#hgcf-general">Algemeen</a><a href="#hgcf-workflows">Workflows <span><?php echo count($flows); ?></span></a><a href="#hgcf-texts">Teksten<?php if(count($languages)>1)echo ' & talen'; ?></a></nav>
<nav class="hgcf-admin-tabs" aria-label="Instellingengroepen"><a class="is-active" href="#hgcf-general">Algemeen</a><a href="#hgcf-workflows">Workflows <span><?php echo count($flows); ?></span></a><a href="#hgcf-texts">Teksten<?php if(count($languages)>1)echo ' & talen'; ?></a><a href="#hgcf-info">Over deze plugin</a></nav>
<section id="hgcf-general" class="hgcf-admin-panel"><div class="hgcf-admin-card"><h2>E-mail</h2><p>Dit zijn de standaardinstellingen voor alle workflows.</p><div class="hgcf-admin-grid">
<?php foreach(['recipient'=>['Ontvangstadres','email','Hier komen de formulierberichten binnen.'],'sender_email'=>['Afzenderadres','email','Gebruik een adres op een domein waarvoor je mailserver mag versturen. Leeg behoudt de standaard.'],'sender_name'=>['Afzendernaam','text','De naam die de ontvanger bij je mail ziet.'],'site_name'=>['Naam in e-mailonderwerp','text','Wordt vóór het onderwerp van de gekozen workflow geplaatst.'],'contact_name'=>['Contactnaam','text','Beschikbaar als {contact_name} in formulierteksten.']] as $key=>$field)hgcf_admin_input($field[0],'hgcf_settings['.$key.']',$s[$key],$field[1],$field[2]); ?>
</div><p class="hgcf-admin-note">Reply-To blijft het bezoekersadres. Het technische retouradres en de uiteindelijke aflevering worden door de mailvoorziening bepaald.</p></div>
<div class="hgcf-admin-card"><h2>Antispam</h2><input type="hidden" name="hgcf_settings[altcha_enabled]" value="0"><label class="hgcf-checkbox"><input type="checkbox" name="hgcf_settings[altcha_enabled]" value="1" <?php checked($s['altcha_enabled']); ?>> Antispamcontrole inschakelen (ALTCHA)</label><p>Gratis, lokaal en zonder account of API-sleutels. De browser voert een korte controle uit voordat een bericht kan worden verstuurd. De bestaande honeypot en verzendlimiet blijven actief.</p><p class="description">JavaScript is hiervoor nodig. Scripts en verificatie blijven op deze website; er wordt geen externe dienst aangeroepen.</p></div>
<div class="hgcf-admin-card"><h2>Antispam</h2><input type="hidden" name="hgcf_settings[altcha_enabled]" value="0"><label class="hgcf-checkbox"><input type="checkbox" name="hgcf_settings[altcha_enabled]" value="1" <?php checked($s['altcha_enabled']); ?>> Antispamcontrole inschakelen</label><p>Helpt ongewenste berichten tegen te houden. Bezoekers doorlopen een korte controle voordat ze het formulier kunnen versturen.</p></div>
<div class="hgcf-admin-card"><h2>Op een pagina plaatsen</h2><p>Plaats <code>[hg_contactform]</code> in een shortcodeblok. De taal volgt de website<?php if(count($languages)>1)echo ' en Polylang'; ?>.</p><p>Naam, e-mailadres, bericht en toestemming vormen de basis. Via Workflows geef je bezoekers aanvullende routes, zoals een vraag of een afspraakaanvraag.</p></div></section>
<section id="hgcf-workflows" class="hgcf-admin-panel"><div class="hgcf-panel-heading"><div><h2>Workflows</h2><p>Eén workflow is één keuze voor de bezoeker. Klap een kaart open om de velden aan te passen.</p></div><button type="button" class="button button-secondary" id="hgcf-add-workflow">Workflow toevoegen</button></div>
<div id="hgcf-workflow-list" data-next-index="<?php echo count($flows); ?>"><?php $i=0;foreach($flows as $flow)hgcf_workflow_card($flow,$i++,$languages); ?></div>
@@ -50,6 +67,7 @@ function hgcf_admin_page() {
<p class="description">Er moet minimaal één actieve workflow zijn. Een aanvraag wordt niet automatisch een bevestigde afspraak.</p></section>
<section id="hgcf-texts" class="hgcf-admin-panel"><div class="hgcf-panel-heading"><div><h2>Formulierteksten</h2><p><?php echo count($languages)>1?'De talen volgen de actieve Polylang-configuratie.':'Alleen de ingestelde WordPress-taal wordt getoond. Een taalplugin is niet nodig.'; ?> Niet-actieve vertalingen blijven bewaard.</p></div></div>
<?php foreach($languages as $lang=>$name): ?><div class="hgcf-admin-card"><h3><?php echo esc_html($name); ?></h3><?php foreach(['title'=>'Formuliertitel','consent'=>'Toestemmingstekst','note'=>'Toelichting onder het formulier','success'=>'Bevestiging na verzending'] as $key=>$label): ?><label class="hgcf-admin-field"><span><?php echo esc_html($label); ?></span><textarea rows="<?php echo $key==='title'?1:3; ?>" maxlength="1500" name="<?php echo esc_attr('hgcf_settings['.$key.'_'.$lang.']'); ?>"><?php echo esc_textarea(hgcf_raw_local_setting($key,$lang)); ?></textarea></label><?php endforeach; ?><p class="description">Je kunt <code>{contact_name}</code> gebruiken. Labels voor afzonderlijke workflows vind je op hun eigen kaart.</p></div><?php endforeach; ?></section>
<?php hgcf_admin_info(); ?>
<input type="hidden" name="hgcf_settings[_complete]" value="1"><div class="hgcf-save-bar"><?php submit_button('Wijzigingen opslaan','primary','submit',false); ?><span>Wijzigingen worden pas actief na opslaan.</span></div>
</form></div>
<?php
+3 -1
View File
@@ -1,7 +1,7 @@
=== HG Contactformulier ===
Requires at least: 6.5
Requires PHP: 8.1
Stable tag: 1.3.0
Stable tag: 1.3.1
License: GPLv2 or later
Contactformulier met workflows, talen en optionele lokaal gehoste ALTCHA-antispamcontrole.
@@ -10,6 +10,8 @@ Contactformulier met workflows, talen en optionele lokaal gehoste ALTCHA-antispa
Upload en activeer de plugin. Stel Contactformulier in de beheerzijbalk in en plaats [hg_contactform] op een pagina.
== Changelog ==
= 1.3.1 =
Beknopte antispaminstelling en een apart informatietabblad met gebruikte techniek en actuele versies.
= 1.3.0 =
Optionele lokale ALTCHA-controle zonder externe diensten, met verlopen en eenmalige uitdagingen. PHP 8.1 of hoger vereist.
= 1.2.0 =