v1.0.0.1
StocketBase
- <?php
-
- declare(strict_types=1);
-
- $siteCodeValue = (string) $siteEditing['code'];
- $siteFieldHint = static function (string $text): string {
- $text = trim($text);
-
- return $text === '' ? '' : '<p style="font-size:12px;color:var(--muted-dim);margin:4px 0 0;">Original: ' . htmlspecialchars(mb_strlen($text) > 200 ? mb_substr($text, 0, 199) . '…' : $text) . '</p>';
- };
-
- ?>
- <div class="sidebar-box" style="max-width:640px;margin-bottom:20px;">
- <p style="margin:0 0 12px;">Site name, description, homepage SEO, menu labels and footer links for <strong><?= htmlspecialchars($siteEditing['name']) ?></strong>. Every field is optional: an empty field shows the original text.</p>
- <form method="post">
- <?= Csrf::field() ?>
- <input type="hidden" name="action" value="copy_site">
- <input type="hidden" name="code" value="<?= htmlspecialchars($siteCodeValue, ENT_QUOTES) ?>">
- <button type="submit" class="dash-btn"><?= Icons::icon('copy', 'icon icon-sm') ?>Copy missing texts from the original</button>
- </form>
- <p style="font-size:12.5px;color:var(--muted);margin:10px 0 0;">Only empty fields are filled in. Texts you already translated are never overwritten.</p>
- </div>
-
- <form method="post" class="settings-section">
- <?= Csrf::field() ?>
- <input type="hidden" name="action" value="save_site">
- <input type="hidden" name="code" value="<?= htmlspecialchars($siteCodeValue, ENT_QUOTES) ?>">
-
- <h2 class="dash-subtitle" style="margin-top:0;"><?= Icons::icon('globe', 'icon icon-sm') ?>Site</h2>
-
- <label>Site name</label>
- <input type="text" name="site[title]" value="<?= htmlspecialchars($siteValues['title']) ?>" maxlength="255">
- <?= $siteFieldHint($siteOriginals['title']) ?>
-
- <label>Site description</label>
- <textarea name="site[excerpt]" rows="2"><?= htmlspecialchars($siteValues['excerpt']) ?></textarea>
- <?= $siteFieldHint($siteOriginals['excerpt']) ?>
-
- <label>Homepage SEO title</label>
- <input type="text" name="site[seo_title]" value="<?= htmlspecialchars($siteValues['seo_title']) ?>" maxlength="255">
- <?= $siteFieldHint($siteOriginals['seo_title']) ?>
-
- <label>Homepage SEO description</label>
- <textarea name="site[seo_description]" rows="2" maxlength="500"><?= htmlspecialchars($siteValues['seo_description']) ?></textarea>
- <?= $siteFieldHint($siteOriginals['seo_description']) ?>
-
- <?php if (!empty($siteOriginals['nav'])): ?>
- <h2 class="dash-subtitle"><?= Icons::icon('menu', 'icon icon-sm') ?>Menu items</h2>
- <?php foreach ($siteOriginals['nav'] as $navId => $navLabel): ?>
- <label><?= htmlspecialchars($navLabel) ?></label>
- <input type="text" name="site[nav][<?= (int) $navId ?>]" value="<?= htmlspecialchars((string) ($siteValues['nav'][$navId] ?? '')) ?>" maxlength="255" placeholder="<?= htmlspecialchars($navLabel, ENT_QUOTES) ?>">
- <?php endforeach; ?>
- <?php endif; ?>
-
- <?php if (!empty($siteOriginals['footer'])): ?>
- <h2 class="dash-subtitle"><?= Icons::icon('footer', 'icon icon-sm') ?>Footer</h2>
- <?php foreach ($siteOriginals['footer'] as $columnIndex => $column): ?>
- <div class="sidebar-box" style="margin-bottom:12px;">
- <label style="margin-top:0;">Column title<?= $column['title'] !== '' ? ': ' . htmlspecialchars($column['title']) : '' ?></label>
- <input type="text" name="site[footer][<?= (int) $columnIndex ?>][title]" value="<?= htmlspecialchars((string) ($siteValues['footer'][$columnIndex]['title'] ?? '')) ?>" maxlength="120" placeholder="<?= htmlspecialchars($column['title'], ENT_QUOTES) ?>">
- <?php foreach ($column['links'] as $linkIndex => $linkLabel): ?>
- <label>Link: <?= htmlspecialchars($linkLabel) ?></label>
- <input type="text" name="site[footer][<?= (int) $columnIndex ?>][links][<?= (int) $linkIndex ?>]" value="<?= htmlspecialchars((string) ($siteValues['footer'][$columnIndex]['links'][$linkIndex] ?? '')) ?>" maxlength="120" placeholder="<?= htmlspecialchars($linkLabel, ENT_QUOTES) ?>">
- <?php endforeach; ?>
- </div>
- <?php endforeach; ?>
- <?php endif; ?>
-
- <div class="publish-actions">
- <button type="submit" class="dash-btn dash-btn-primary"><?= Icons::icon('check', 'icon icon-sm') ?>Save</button>
- <a href="languages.php" class="dash-btn"><?= Icons::icon('x', 'icon icon-sm') ?>Back</a>
- </div>
- </form>
-