1<?php
2
3if (!defined('ACP_ROOT')) {
4 http_response_code(403);
5 die('Direct access denied.');
6}
7
8$theme = $themes[$optionTheme];
9$isActive = ($optionTheme === $active);
10$backUrl = acp_url('layouts');
11?>
12
13<div class="acp-toolbar">
14 <div>
15 <a class="acp-btn acp-btn--ghost" href="<?= h($backUrl) ?>">
16 <i class="fa fa-angle-left"></i> <?= t('acp.layopt.back') ?>
17 </a>
18 </div>
19 <div class="acp-actions is-tight">
20 <?php if (!$isActive): ?>
21 <form class="acp-inline-form" method="post">
22 <?= acp_csrf_field() ?>
23 <input type="hidden" name="activate" value="<?= h($optionTheme) ?>">
24 <button class="acp-btn" type="submit"><i class="fa fa-check"></i> <?= t('acp.layopt.activate') ?></button>
25 </form>
26 <?php else: ?>
27 <a class="acp-btn acp-btn--ghost" href="<?= h(acp_site()) ?>" target="_blank" rel="noopener">
28 <i class="fa fa-external-link"></i> <?= t('acp.layopt.view_site') ?>
29 </a>
30 <?php endif; ?>
31 </div>
32</div>
33
34<section class="acp-card">
35 <header class="acp-card-head">
36 <h2>
37 <?= h($theme['name']) ?> — <?= t('acp.layopt.options_suffix') ?>
38 <?php if ($isActive): ?><span class="acp-pill acp-pill--green"><?= t('acp.layopt.active') ?></span><?php endif; ?>
39 </h2>
40 <p>
41 <code><?= h('layouts/' . $optionTheme . '/') ?></code>
42 <?php if ($theme['author'] !== ''): ?>· <?= t('acp.layopt.by_author', ['author' => h($theme['author'])]) ?><?php endif; ?>
43 <?php if ($theme['version'] !== ''): ?>· v<?= h($theme['version']) ?><?php endif; ?>
44 </p>
45 </header>
46
47 <div class="acp-card-body">
48 <p class="acp-hint">
49 <?= t('acp.layopt.saved_hint') ?>
50 </p>
51
52 <form method="post" enctype="multipart/form-data">
53 <?= acp_csrf_field() ?>
54 <input type="hidden" name="theme_options" value="<?= h($optionTheme) ?>">
55
56 <?php foreach ($optionList as $optKey => $opt):
57 $stored = function_exists('setting') ? setting(theme_option_key($optionTheme, $optKey), null) : null;
58 $value = ($stored !== null) ? $stored : theme_option($optKey, '', $optionTheme);
59 ?>
60 <div class="acp-field">
61 <label class="acp-label" for="opt_<?= h($optKey) ?>"><?= h($opt['label']) ?></label>
62
63 <?php if ($opt['type'] === 'textarea'): ?>
64 <textarea class="acp-textarea" id="opt_<?= h($optKey) ?>" name="opt[<?= h($optKey) ?>]" rows="3"><?= h($value) ?></textarea>
65 <?php elseif ($opt['type'] === 'checkbox'): ?>
66 <label style="display:flex;align-items:center;gap:8px;font-weight:400;">
67 <input type="checkbox" id="opt_<?= h($optKey) ?>" name="opt[<?= h($optKey) ?>]" value="1" <?= $value !== '' ? 'checked' : '' ?>>
68 <span class="is-muted"><?= t('acp.layopt.enabled') ?></span>
69 </label>
70 <?php elseif ($opt['type'] === 'image'): ?>
71 <?php $shown = ($value !== '') ? $value : $opt['default']; ?>
72 <?php if ($shown !== ''): ?>
73 <p style="margin:0 0 8px;">
74 <img src="<?= h(acp_site($shown)) ?>" alt=""
75 style="max-width:260px;max-height:110px;border:1px solid var(--acp-line);background:#0b0d10;">
76 </p>
77 <?php endif; ?>
78 <input class="acp-input" id="opt_<?= h($optKey) ?>" name="opt[<?= h($optKey) ?>]"
79 type="text" value="<?= h($value) ?>"
80 placeholder="<?= h($opt['default'] !== '' ? $opt['default'] : t('acp.layopt.image_placeholder')) ?>">
81 <p class="acp-hint" style="margin:6px 0 4px;"><?= t('acp.layopt.upload_hint') ?></p>
82 <input class="acp-input" type="file" name="optfile[<?= h($optKey) ?>]" accept="image/png,image/jpeg,image/gif,image/webp,image/x-icon,image/vnd.microsoft.icon">
83 <?php else: ?>
84 <input class="acp-input" id="opt_<?= h($optKey) ?>" name="opt[<?= h($optKey) ?>]"
85 type="<?= in_array($opt['type'], array('url', 'datetime-local'), true) ? h($opt['type']) : 'text' ?>"
86 value="<?= h($value) ?>"
87 placeholder="<?= h($opt['default']) ?>">
88 <?php endif; ?>
89
90 <?php if ($opt['help'] !== ''): ?>
91 <p class="acp-hint"><?= h($opt['help']) ?></p>
92 <?php endif; ?>
93 </div>
94 <?php endforeach; ?>
95
96 <div class="acp-actions">
97 <button class="acp-btn acp-btn--green" type="submit"><i class="fa fa-check"></i> <?= t('acp.layopt.save_btn') ?></button>
98 <a class="acp-btn acp-btn--ghost" href="<?= h($backUrl) ?>"><?= t('acp.layopt.back') ?></a>
99 </div>
100 </form>
101 </div>
102</section>
103