56 lines
2.7 KiB
PHP
56 lines
2.7 KiB
PHP
|
|
<?php
|
||
|
|
$pageTitle = $title ?? 'Plugins';
|
||
|
|
$plugins = $plugins ?? [];
|
||
|
|
ob_start();
|
||
|
|
?>
|
||
|
|
<section class="admin-card">
|
||
|
|
<div class="badge">Plugins</div>
|
||
|
|
<div style="display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top:16px;">
|
||
|
|
<div>
|
||
|
|
<h1 style="font-size:28px; margin:0;">Plugins</h1>
|
||
|
|
<p style="color: var(--muted); margin-top:6px;">Enable or disable optional features.</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<?php if (!$plugins): ?>
|
||
|
|
<div style="margin-top:18px; color: var(--muted); font-size:13px;">No plugins found in <code>/dev/plugins</code>.</div>
|
||
|
|
<?php else: ?>
|
||
|
|
<div style="margin-top:18px; display:grid; gap:12px;">
|
||
|
|
<?php foreach ($plugins as $plugin): ?>
|
||
|
|
<div class="admin-card" style="padding:16px; display:grid; gap:10px;">
|
||
|
|
<div style="display:flex; align-items:flex-start; justify-content:space-between; gap:16px;">
|
||
|
|
<div>
|
||
|
|
<div style="font-size:18px; font-weight:600;">
|
||
|
|
<?= htmlspecialchars((string)($plugin['name'] ?? ''), ENT_QUOTES, 'UTF-8') ?>
|
||
|
|
</div>
|
||
|
|
<div style="font-size:12px; color: var(--muted); margin-top:4px;">
|
||
|
|
<?= htmlspecialchars((string)($plugin['description'] ?? ''), ENT_QUOTES, 'UTF-8') ?>
|
||
|
|
</div>
|
||
|
|
<div style="margin-top:8px; font-size:12px; color: var(--muted); display:flex; gap:14px; flex-wrap:wrap;">
|
||
|
|
<span>Slug: <?= htmlspecialchars((string)($plugin['slug'] ?? ''), ENT_QUOTES, 'UTF-8') ?></span>
|
||
|
|
<span>Version: <?= htmlspecialchars((string)($plugin['version'] ?? ''), ENT_QUOTES, 'UTF-8') ?></span>
|
||
|
|
<?php if (!empty($plugin['author'])): ?>
|
||
|
|
<span>Author: <?= htmlspecialchars((string)$plugin['author'], ENT_QUOTES, 'UTF-8') ?></span>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<form method="post" action="/admin/plugins/toggle" style="display:flex; align-items:center; gap:10px;">
|
||
|
|
<input type="hidden" name="slug" value="<?= htmlspecialchars((string)($plugin['slug'] ?? ''), ENT_QUOTES, 'UTF-8') ?>">
|
||
|
|
<?php if (!empty($plugin['is_enabled'])): ?>
|
||
|
|
<input type="hidden" name="enabled" value="0">
|
||
|
|
<button type="submit" class="btn outline small">Disable</button>
|
||
|
|
<?php else: ?>
|
||
|
|
<input type="hidden" name="enabled" value="1">
|
||
|
|
<button type="submit" class="btn small">Enable</button>
|
||
|
|
<?php endif; ?>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</div>
|
||
|
|
<?php endif; ?>
|
||
|
|
</section>
|
||
|
|
<?php
|
||
|
|
$content = ob_get_clean();
|
||
|
|
require __DIR__ . '/../../../admin/views/layout.php';
|