v2.6.1d (Lyra): Plugin i18n, plugin editor vernieuwd, media invoegen
Plugin internationalisatie: plugins hebben eigen language/ mappen. Systeem plugins volgen admin taal (admin.php), content plugins volgen content taal (site.php). Fallback chain: geselecteerd -> plugin default_language -> CMS default. PluginManager/AdminPluginAPI/CMSAPI uitgebreid met getPluginTranslations()/t(). plugin.json settings ondersteunen label_key/help_key/option_label_key. Plugin uniformiteit: alle 6 plugins hebben uniforme structuur (README.md, assets/.gitkeep, language/nl|en/). plugins/README.md herschreven. guide plugin-development.md (NL+EN) volledig herschreven. Plugin editor vernieuwd: geneste bestandsbrowser zijbalk, nieuw bestand aanmaken, uploaden naar assets/, verwijderen en verplaatsen. Nieuwe routes: plugins-file-upload, plugins-file-delete, plugins-file-move. Path-traversal bescherming + protected plugins geblokkeerd. Media invoegen in editor: nieuw /admin/media-list JSON endpoint + herbruikbare _media-modal.twig include. Plugin-context scant assets/ map. editor-toolbar.js modeMap uitgebreid voor css/scss/js/json. Plugin overzicht knoppen: alleen iconen met title/aria-label. Tests: pentest 30/30, WCAG 2.1 AA 25/25.
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
class GeoIPInfo
|
||||
{
|
||||
private ?CMSAPI $api = null;
|
||||
private ?PluginAPIInterface $api = null;
|
||||
|
||||
public function setAPI(CMSAPI $api): void
|
||||
public function setAPI(PluginAPIInterface $api): void
|
||||
{
|
||||
$this->api = $api;
|
||||
}
|
||||
@@ -23,7 +23,13 @@ class GeoIPInfo
|
||||
public function getAdminMenu(): array
|
||||
{
|
||||
return [
|
||||
['label' => 'GeoIP Info', 'route' => 'geoip-info', 'icon' => 'bi-globe2'],
|
||||
[
|
||||
'plugin' => 'GeoIPInfo',
|
||||
'label' => 'GeoIP Info',
|
||||
'label_key' => 'menu_label',
|
||||
'route' => 'geoip-info',
|
||||
'icon' => 'bi-globe2',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -46,11 +52,16 @@ class GeoIPInfo
|
||||
$country = GeoIP::getCountryName($countryCode);
|
||||
$flag = GeoIP::getCountryFlagEmoji($countryCode);
|
||||
|
||||
echo '<h2 class="mb-4"><i class="bi bi-globe2"></i> GeoIP Info</h2>';
|
||||
$t = $this->api ? $this->api->getPluginTranslations('GeoIPInfo') : [];
|
||||
$tr = function (string $key) use ($t): string {
|
||||
return $t[$key] ?? $key;
|
||||
};
|
||||
|
||||
echo '<h2 class="mb-4"><i class="bi bi-globe2"></i> ' . htmlspecialchars($tr('page_title')) . '</h2>';
|
||||
echo '<div class="card shadow-sm"><div class="card-body">';
|
||||
echo '<table class="table table-sm">';
|
||||
echo '<tr><td>IP adres</td><td><code>' . htmlspecialchars($ip) . '</code></td></tr>';
|
||||
echo '<tr><td>Land</td><td>' . $flag . ' ' . htmlspecialchars($country) . '</td></tr>';
|
||||
echo '<tr><td>' . htmlspecialchars($tr('ip_address')) . '</td><td><code>' . htmlspecialchars($ip) . '</code></td></tr>';
|
||||
echo '<tr><td>' . htmlspecialchars($tr('country')) . '</td><td>' . $flag . ' ' . htmlspecialchars($country) . '</td></tr>';
|
||||
echo '</table>';
|
||||
echo '</div></div>';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# GeoIPInfo Plugin
|
||||
|
||||
Systeem plugin die GeoIP-informatie (IP adres en land) toont op een admin-pagina.
|
||||
|
||||
## Plugin type
|
||||
|
||||
**Systeem** plugin. De plugin-output volgt de geselecteerde **admin taal** (via `AdminPluginAPI::getPluginTranslations()` met `admin.php`).
|
||||
|
||||
## Bestandsstructuur
|
||||
|
||||
```
|
||||
GeoIPInfo/
|
||||
├── GeoIPInfo.php # Hoofd plugin class
|
||||
├── plugin.json # Plugin metadata + instellingen
|
||||
├── README.md # Dit bestand
|
||||
├── assets/ # Optionele CSS/JS (leeg)
|
||||
└── language/ # Vertalingen
|
||||
├── nl/admin.php # Nederlandse admin labels
|
||||
└── en/admin.php # Engelse admin labels
|
||||
```
|
||||
|
||||
## Functies
|
||||
|
||||
- Toont het IP adres van de bezoeker
|
||||
- Toont het land (met vlag-emoji) gebaseerd op GeoIP lookup
|
||||
|
||||
## Instellingen
|
||||
|
||||
Deze plugin heeft geen instelbare configuratie (`hasConfig: false`).
|
||||
|
||||
## Taal support
|
||||
|
||||
De plugin gebruikt `AdminPluginAPI::getPluginTranslations('GeoIPInfo')` om labels op te halen. Fallback chain:
|
||||
1. Geselecteerde admin taal
|
||||
2. Plugin `default_language` (`nl`)
|
||||
3. Lege array (sleutel wordt ongewijzigd getoond)
|
||||
|
||||
Beschikbare sleutels staan in `language/<lang>/admin.php`. Het admin-menu label wordt vertaald via `label_key: 'menu_label'` in `getAdminMenu()`.
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
return [
|
||||
// Menu
|
||||
'menu_label' => 'GeoIP Info',
|
||||
|
||||
// Page
|
||||
'page_title' => 'GeoIP Info',
|
||||
'ip_address' => 'IP address',
|
||||
'country' => 'Country',
|
||||
];
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
return [
|
||||
// Menu
|
||||
'menu_label' => 'GeoIP Info',
|
||||
|
||||
// Page
|
||||
'page_title' => 'GeoIP Info',
|
||||
'ip_address' => 'IP adres',
|
||||
'country' => 'Land',
|
||||
];
|
||||
@@ -3,5 +3,9 @@
|
||||
"version": "1.0.0",
|
||||
"author": "CodePress",
|
||||
"description": "Systeem plugin voor GeoIP informatie in admin",
|
||||
"type": "system"
|
||||
"type": "system",
|
||||
"essential": false,
|
||||
"hasConfig": false,
|
||||
"default_language": "nl",
|
||||
"settings": []
|
||||
}
|
||||
Reference in New Issue
Block a user