v2.6.0: Content backup/git versioning, plugin type system, docs update
New features: - ContentBackup class with ZIP backup/restore and git versioning - Admin backup & restore page (content-backup.twig) with git init/commit/log/restore - Plugin type system: system (blue) vs content (green) with visual badges - PluginAPIInterface + AdminPluginAPI for plugin architecture - Essential plugin flag (cannot edit/deactivate/delete) Improvements: - Consolidated enabled_plugins config (removed plugins.enabled) - Removed Analytics/Logging toggles from admin config page - Fixed Dashboard plugin Twig comments rendered as text - Updated 20 guide files (NL+EN): configuratie, plugins, plugin-development, core-classes, theme-json, layouts, scss-styling, admin-beheerder, nieuw-thema, architectuur - Improved accessibility test script (grep -E, min/max checks) Cleanup: - Removed unused classes: ARIAComponents, AccessibilityManager, ContentSecurityPolicy, etc. - Removed vendor packages: mustache/mustache, php-mqtt/client - Removed old templates: logs.twig, statistics.twig (now plugins) - Moved language files to language/ directory Tests: - Pentest: 30/30 passed, 0 vulnerabilities - WCAG 2.1 AA: 25/25 passed, 100% compliance
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Lightweight API wrapper for plugins in the admin context.
|
||||
* Provides read-only access to the site config (no CMS instance needed).
|
||||
*/
|
||||
class AdminPluginAPI implements PluginAPIInterface
|
||||
{
|
||||
private array $config;
|
||||
private string $projectRoot;
|
||||
|
||||
public function __construct(array $siteConfig, string $projectRoot = '')
|
||||
{
|
||||
$this->config = $siteConfig;
|
||||
$this->projectRoot = $projectRoot !== '' ? $projectRoot : dirname(__DIR__, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get configuration value using dot notation.
|
||||
*/
|
||||
public function getConfig(string $key, $default = null)
|
||||
{
|
||||
$keys = explode('.', $key);
|
||||
$value = $this->config;
|
||||
|
||||
foreach ($keys as $k) {
|
||||
if (!is_array($value) || !isset($value[$k])) {
|
||||
return $default;
|
||||
}
|
||||
$value = $value[$k];
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the project root directory.
|
||||
*/
|
||||
public function getProjectRoot(): string
|
||||
{
|
||||
return $this->projectRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the content directory path.
|
||||
*/
|
||||
public function getContentDir(): string
|
||||
{
|
||||
return $this->config['content_dir'] ?? ($this->projectRoot . '/content');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plugins directory path.
|
||||
*/
|
||||
public function getPluginsDir(): string
|
||||
{
|
||||
return $this->projectRoot . '/plugins';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of enabled plugins.
|
||||
*/
|
||||
public function getEnabledPlugins(): array
|
||||
{
|
||||
return $this->config['enabled_plugins'] ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the version info from version.php.
|
||||
*/
|
||||
public function getVersionInfo(): array
|
||||
{
|
||||
$versionFile = $this->projectRoot . '/version.php';
|
||||
if (file_exists($versionFile)) {
|
||||
$data = include $versionFile;
|
||||
if (is_array($data)) {
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
return ['version' => '0.0.0'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user