Group HG plugins under a shared branded admin menu
This commit is contained in:
1 parent
9e9133c93e
commit
0cad18c757
7 files changed
+81
-6
No files matched your search
@@ -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.
|
||||
@@ -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}}
|
||||
+3
-2
@@ -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';
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ function hgcf_workflow_card($flow,$index,$languages,$template=false) {
|
||||
</div></details>
|
||||
<?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);});
|
||||
add_action('admin_enqueue_scripts',function($hook){if($hook!==HG_Plugin_Admin::hook('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';
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* HG admin navigation, bundled identically in each standalone HG plugin.
|
||||
* Shared component version: 1.0.0. Update both copies together.
|
||||
*/
|
||||
if (!defined('ABSPATH')) exit;
|
||||
if (!class_exists('HG_Plugin_Admin', false)) {
|
||||
|
||||
final class HG_Plugin_Admin {
|
||||
private static array $plugins = [];
|
||||
private static array $hooks = [];
|
||||
|
||||
public static function register(array $plugin): void {
|
||||
self::$plugins[$plugin['slug']] = $plugin;
|
||||
}
|
||||
|
||||
public static function hook(string $slug): string {
|
||||
return self::$hooks[$slug] ?? '';
|
||||
}
|
||||
|
||||
public static function menu(): void {
|
||||
if (!self::$plugins) return;
|
||||
add_menu_page('HG Plugins', 'HG Plugins', 'manage_options', 'hg-plugins', [self::class, 'overview'], 'dashicons-screenoptions', 58);
|
||||
add_submenu_page('hg-plugins', 'HG Plugins', 'Overzicht', 'manage_options', 'hg-plugins', [self::class, 'overview']);
|
||||
uasort(self::$plugins, fn($a, $b) => 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]);
|
||||
?>
|
||||
<div class="wrap hg-suite">
|
||||
<header class="hg-suite-header"><span class="hg-suite-mark" aria-hidden="true">HG</span><div><h1>HG Plugins</h1><p>De Hippogrief-modules op deze website.</p></div></header>
|
||||
<div class="hg-suite-grid">
|
||||
<?php foreach (self::$plugins as $slug => $plugin): ?>
|
||||
<section class="hg-suite-card"><span class="hg-suite-version">Versie <?php echo esc_html($plugin['version']); ?></span><h2><?php echo esc_html($plugin['title']); ?></h2><p><?php echo esc_html($plugin['description']); ?></p><a class="button button-primary" href="<?php echo esc_url(add_query_arg('page', $slug, admin_url('admin.php'))); ?>">Beheren</a></section>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
add_action('admin_menu', [HG_Plugin_Admin::class, 'menu'], 20);
|
||||
add_action('admin_enqueue_scripts', [HG_Plugin_Admin::class, 'styles']);
|
||||
}
|
||||
@@ -102,6 +102,6 @@ function hgcf_sanitize_settings($input) {
|
||||
$out['schema_version']=2;
|
||||
return $out;
|
||||
}
|
||||
add_action('admin_menu',function(){add_menu_page('HG Contactformulier','Contactformulier','manage_options','hg-contactform','hgcf_admin_page','dashicons-email-alt',58);});
|
||||
HG_Plugin_Admin::register(['slug'=>'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';
|
||||
+5
-2
@@ -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 =
|
||||
|
||||
Reference in new issue
Block a user