From 0cad18c7573bd58f504dee5bc4e39aeab2605a07 Mon Sep 17 00:00:00 2001 From: Peter van Arkel Date: Tue, 13 Oct 2026 00:44:12 +0200 Subject: [PATCH] Group HG plugins under a shared branded admin menu --- README.md | 8 ++++++ assets/hg-admin-menu.css | 11 ++++++++ hg-contactform.php | 5 ++-- includes/admin.php | 2 +- includes/hg-admin-menu.php | 52 ++++++++++++++++++++++++++++++++++++++ includes/settings.php | 2 +- readme.txt | 7 +++-- 7 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 assets/hg-admin-menu.css create mode 100644 includes/hg-admin-menu.php diff --git a/README.md b/README.md index e8c9009..0699b3f 100644 --- a/README.md +++ b/README.md @@ -70,3 +70,11 @@ De checks injecteren tijdelijke instellingen via filters en onderscheppen e-mail ## Uitrollen Maak een nieuw ZIP vanuit een geteste commit. Bewaar vóór vervanging de bestaande plugin en instellingen van de doelwebsite. Upload en activeer alleen binnen die website; stel per installatie het ontvangstadres en de teksten in. Draai deze plugin niet gelijktijdig met de oude klantplugin omdat beide dezelfde compatibiliteitsshortcode registreren. Bij de bestaande website zijn de klantinstellingen expliciet overgenomen bij de overstap. + +## HG-beheernavigatie + + Beide plugins bundelen dezelfde includes/hg-admin-menu.php en assets/hg-admin-menu.css (component 1.0.0). + Werk deze kopieën samen bij. De class wordt éénmaal geladen; iedere plugin meldt zijn eigen scherm aan. + Eén HG Plugins-menu met overzicht, accentkleur en alleen de actieve modules. Geen aparte kernplugin nodig. + Bestaande admin.php?page=hg-contactform / hg-registrations-links blijven geldig. + Plugin-assets gebruiken de geregistreerde submenu-hook; alleen beheerders hebben toegang. diff --git a/assets/hg-admin-menu.css b/assets/hg-admin-menu.css new file mode 100644 index 0000000..0674c09 --- /dev/null +++ b/assets/hg-admin-menu.css @@ -0,0 +1,11 @@ +/* HG navigation only; leave the rest of the WordPress admin color scheme intact. */ +#adminmenu #toplevel_page_hg-plugins>a.menu-top{background:#173b37;color:#d8fff3;box-shadow:inset 3px 0 #56d5bb} +#adminmenu #toplevel_page_hg-plugins .wp-menu-image::before{color:#80e9d1} +#adminmenu #toplevel_page_hg-plugins:hover>a.menu-top,#adminmenu #toplevel_page_hg-plugins>a.menu-top:focus{background:#20574e;color:#fff} +#adminmenu #toplevel_page_hg-plugins.wp-has-current-submenu>a.menu-top,#adminmenu #toplevel_page_hg-plugins.current>a.menu-top{background:#126151;color:#fff} +#adminmenu #toplevel_page_hg-plugins .wp-submenu{background:#16332f} +#adminmenu #toplevel_page_hg-plugins .wp-submenu a{color:#d0e6de} +#adminmenu #toplevel_page_hg-plugins .wp-submenu a:hover,#adminmenu #toplevel_page_hg-plugins .wp-submenu a:focus{color:#fff;background:#24584e} +#adminmenu #toplevel_page_hg-plugins .wp-submenu li.current a{color:#fff;font-weight:600;background:#205147} +#adminmenu #toplevel_page_hg-plugins .wp-submenu .wp-submenu-head{color:#fff;background:#126151} +.hg-suite{max-width:1100px}.hg-suite-header{display:flex;align-items:center;gap:18px;margin:28px 0}.hg-suite-header h1{padding:0;font-size:26px}.hg-suite-header p{margin:7px 0 0;color:#50575e}.hg-suite-mark{display:grid;place-items:center;width:58px;height:58px;background:#126151;color:#fff;border-radius:10px;font-weight:750;font-size:21px;letter-spacing:-1px}.hg-suite-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px}.hg-suite-card{background:#fff;border:1px solid #dcdcde;border-radius:8px;padding:26px}.hg-suite-card h2{margin:12px 0;font-size:20px}.hg-suite-card p{color:#50575e;font-size:14px;line-height:1.7;min-height:48px}.hg-suite-version{display:inline-block;padding:4px 9px;border-radius:5px;color:#145c4c;background:#e9f5ee;font-size:12px}.hg-suite-card .button{margin-top:12px}@media(max-width:782px){.hg-suite-grid{grid-template-columns:1fr}.hg-suite-header{gap:14px}.hg-suite-card{padding:22px}} diff --git a/hg-contactform.php b/hg-contactform.php index 5bc675f..cc8534a 100644 --- a/hg-contactform.php +++ b/hg-contactform.php @@ -2,14 +2,15 @@ /** * Plugin Name: HG Contactformulier * Description: Configureerbaar contactformulier met workflows en talen vanuit de website, zonder inzendingen op te slaan. - * Version: 1.3.2 + * Version: 1.3.3 * Requires at least: 6.5 * Requires PHP: 8.1 * Text Domain: hg-contactform */ if (!defined('ABSPATH')) { exit; } -define('HGCF_VERSION','1.3.2'); +define('HGCF_VERSION','1.3.3'); define('HGCF_FILE',__FILE__); +require_once __DIR__.'/includes/hg-admin-menu.php'; require_once __DIR__.'/includes/settings.php'; require_once __DIR__.'/includes/language.php'; require_once __DIR__.'/includes/form.php'; diff --git a/includes/admin.php b/includes/admin.php index 45c1773..f278607 100644 --- a/includes/admin.php +++ b/includes/admin.php @@ -31,7 +31,7 @@ function hgcf_workflow_card($flow,$index,$languages,$template=false) { is_string($manifest[$key]['version']??null)?$manifest[$key]['version']:'Niet beschikbaar'; diff --git a/includes/hg-admin-menu.php b/includes/hg-admin-menu.php new file mode 100644 index 0000000..d8a66af --- /dev/null +++ b/includes/hg-admin-menu.php @@ -0,0 +1,52 @@ + strcasecmp($a['label'], $b['label'])); + foreach (self::$plugins as $slug => $plugin) { + self::$hooks[$slug] = (string) add_submenu_page('hg-plugins', $plugin['title'], $plugin['label'], 'manage_options', $slug, $plugin['callback']); + } + } + + public static function styles(): void { + if (!self::$plugins || !current_user_can('manage_options')) return; + wp_enqueue_style('hg-admin-menu', plugins_url('../assets/hg-admin-menu.css', __FILE__), [], '1.0.0'); + } + + public static function overview(): void { + if (!current_user_can('manage_options')) wp_die('Geen toegang.', '', ['response' => 403]); + ?> +
+

HG Plugins

De Hippogrief-modules op deze website.

+
+ $plugin): ?> +
Versie

Beheren
+ +
+
+ 'hg-contactform','title'=>'HG Contactformulier','label'=>'Contactformulier','callback'=>'hgcf_admin_page','version'=>HGCF_VERSION,'description'=>'Contactformulieren, workflows en e-mailinstellingen beheren.']); add_action('admin_init',function(){register_setting('hgcf','hgcf_settings',['type'=>'array','sanitize_callback'=>'hgcf_sanitize_settings']);}); require_once __DIR__.'/admin.php'; diff --git a/readme.txt b/readme.txt index d731fb7..cbfe088 100644 --- a/readme.txt +++ b/readme.txt @@ -1,15 +1,18 @@ === HG Contactformulier === Requires at least: 6.5 Requires PHP: 8.1 -Stable tag: 1.3.2 +Stable tag: 1.3.3 License: GPLv2 or later Contactformulier met workflows, talen en optionele lokaal gehoste ALTCHA-antispamcontrole. == Installation == -Upload en activeer de plugin. Stel Contactformulier in de beheerzijbalk in en plaats [hg_contactform] op een pagina. +Upload en activeer de plugin. Stel HG Plugins → Contactformulier in de beheerzijbalk in en plaats [hg_contactform] op een pagina. == Changelog == += 1.3.3 = +HG Plugins-menu met herkenbare zijbalkkleur, gedeeld overzicht en behoud van bestaande beheerlinks. + = 1.3.2 = Gebruik de effectieve WordPress-sitetaal, ook wanneer de WPLANG-optie ontbreekt of afwijkt van de ingestelde locale. = 1.3.1 =