WebOrbiton
v1.0.0.1

StocketBase

74 lines · 4.4 KB
  1. <?php
  2. ​
  3. declare(strict_types=1);
  4. ​
  5. $siteCodeValue = (string) $siteEditing['code'];
  6. $siteFieldHint = static function (string $text): string {
  7. $text = trim($text);
  8. ​
  9. 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>';
  10. };
  11. ​
  12. ?>
  13. <div class="sidebar-box" style="max-width:640px;margin-bottom:20px;">
  14. <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>
  15. <form method="post">
  16. <?= Csrf::field() ?>
  17. <input type="hidden" name="action" value="copy_site">
  18. <input type="hidden" name="code" value="<?= htmlspecialchars($siteCodeValue, ENT_QUOTES) ?>">
  19. <button type="submit" class="dash-btn"><?= Icons::icon('copy', 'icon icon-sm') ?>Copy missing texts from the original</button>
  20. </form>
  21. <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>
  22. </div>
  23. ​
  24. <form method="post" class="settings-section">
  25. <?= Csrf::field() ?>
  26. <input type="hidden" name="action" value="save_site">
  27. <input type="hidden" name="code" value="<?= htmlspecialchars($siteCodeValue, ENT_QUOTES) ?>">
  28. ​
  29. <h2 class="dash-subtitle" style="margin-top:0;"><?= Icons::icon('globe', 'icon icon-sm') ?>Site</h2>
  30. ​
  31. <label>Site name</label>
  32. <input type="text" name="site[title]" value="<?= htmlspecialchars($siteValues['title']) ?>" maxlength="255">
  33. <?= $siteFieldHint($siteOriginals['title']) ?>
  34. ​
  35. <label>Site description</label>
  36. <textarea name="site[excerpt]" rows="2"><?= htmlspecialchars($siteValues['excerpt']) ?></textarea>
  37. <?= $siteFieldHint($siteOriginals['excerpt']) ?>
  38. ​
  39. <label>Homepage SEO title</label>
  40. <input type="text" name="site[seo_title]" value="<?= htmlspecialchars($siteValues['seo_title']) ?>" maxlength="255">
  41. <?= $siteFieldHint($siteOriginals['seo_title']) ?>
  42. ​
  43. <label>Homepage SEO description</label>
  44. <textarea name="site[seo_description]" rows="2" maxlength="500"><?= htmlspecialchars($siteValues['seo_description']) ?></textarea>
  45. <?= $siteFieldHint($siteOriginals['seo_description']) ?>
  46. ​
  47. <?php if (!empty($siteOriginals['nav'])): ?>
  48. <h2 class="dash-subtitle"><?= Icons::icon('menu', 'icon icon-sm') ?>Menu items</h2>
  49. <?php foreach ($siteOriginals['nav'] as $navId => $navLabel): ?>
  50. <label><?= htmlspecialchars($navLabel) ?></label>
  51. <input type="text" name="site[nav][<?= (int) $navId ?>]" value="<?= htmlspecialchars((string) ($siteValues['nav'][$navId] ?? '')) ?>" maxlength="255" placeholder="<?= htmlspecialchars($navLabel, ENT_QUOTES) ?>">
  52. <?php endforeach; ?>
  53. <?php endif; ?>
  54. ​
  55. <?php if (!empty($siteOriginals['footer'])): ?>
  56. <h2 class="dash-subtitle"><?= Icons::icon('footer', 'icon icon-sm') ?>Footer</h2>
  57. <?php foreach ($siteOriginals['footer'] as $columnIndex => $column): ?>
  58. <div class="sidebar-box" style="margin-bottom:12px;">
  59. <label style="margin-top:0;">Column title<?= $column['title'] !== '' ? ': ' . htmlspecialchars($column['title']) : '' ?></label>
  60. <input type="text" name="site[footer][<?= (int) $columnIndex ?>][title]" value="<?= htmlspecialchars((string) ($siteValues['footer'][$columnIndex]['title'] ?? '')) ?>" maxlength="120" placeholder="<?= htmlspecialchars($column['title'], ENT_QUOTES) ?>">
  61. <?php foreach ($column['links'] as $linkIndex => $linkLabel): ?>
  62. <label>Link: <?= htmlspecialchars($linkLabel) ?></label>
  63. <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) ?>">
  64. <?php endforeach; ?>
  65. </div>
  66. <?php endforeach; ?>
  67. <?php endif; ?>
  68. ​
  69. <div class="publish-actions">
  70. <button type="submit" class="dash-btn dash-btn-primary"><?= Icons::icon('check', 'icon icon-sm') ?>Save</button>
  71. <a href="languages.php" class="dash-btn"><?= Icons::icon('x', 'icon icon-sm') ?>Back</a>
  72. </div>
  73. </form>
  74. ​