v2.0.0.1
Publisium
- <?php
-
- declare(strict_types=1);
-
- require_once __DIR__ . '/icons.php';
- require_once __DIR__ . '/asset.php';
-
- if (Languages::current() !== '') {
- ob_start([Languages::class, 'absolutizeUrls']);
- }
-
- $navItems = SiteFront::navItems();
-
- $menuPositionClass = 'site-menu-' . ($settings['menu_position'] ?? 'top');
-
- $resolvedPageTitle = $pageTitle ?? $settings['site_name'];
- $resolvedPageDescription = $pageDescription ?? '';
- $isHomepage = ($_SERVER['REQUEST_URI'] ?? '') === '/' || basename((string) ($_SERVER['SCRIPT_NAME'] ?? '')) === 'index.php';
-
- ?>
- <!DOCTYPE html>
- <html lang="<?= htmlspecialchars(Languages::htmlLang(), ENT_QUOTES) ?>">
-
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title><?= htmlspecialchars($resolvedPageTitle) ?></title>
- <?php if (!empty($resolvedPageDescription)): ?>
- <meta name="description" content="<?= htmlspecialchars($resolvedPageDescription) ?>">
- <?php endif; ?>
- <?= SiteFront::renderSeoMeta(!empty($pageNoindex)) ?>
- <?= Languages::renderAlternates() ?>
- <?= SiteFront::renderOpenGraph($resolvedPageTitle, $resolvedPageDescription, $ogType ?? 'website', $ogImagePath ?? null, $ogArticleMeta ?? null) ?>
- <?php if ($isHomepage): ?>
- <?= SiteFront::renderOrganizationSchema() ?>
- <?php endif; ?>
- <?php if (!empty($pageSchema)): ?>
- <?= $pageSchema ?>
- <?php endif; ?>
- <?php if (!empty($rssFeedUrl)): ?>
- <link rel="alternate" type="application/rss+xml" title="<?= htmlspecialchars($resolvedPageTitle, ENT_QUOTES) ?>" href="<?= htmlspecialchars($rssFeedUrl, ENT_QUOTES) ?>">
- <?php endif; ?>
- <?= Asset::favicon() ?>
- <?php if (($settings['pwa_enabled'] ?? '0') === '1'): ?>
- <?php $pwaIconUrl = !empty($settings['pwa_icon_url']) ? $settings['pwa_icon_url'] : ($settings['site_logo_url'] ?? ''); ?>
- <link rel="manifest" href="<?= htmlspecialchars(rtrim(Config::get('APP_BASE_PATH', ''), '/')) ?>/manifest.json">
- <meta name="theme-color" content="<?= htmlspecialchars($settings['pwa_theme_color'] ?: '#ffffff') ?>">
- <?php if (!empty($pwaIconUrl)): ?>
- <link rel="apple-touch-icon" href="<?= htmlspecialchars($pwaIconUrl) ?>">
- <?php endif; ?>
- <?php endif; ?>
- <?= Asset::css('assets/site.css') ?>
- <style>
- <?= SiteFront::renderFontFaces() ?><?= SiteFront::fontVariablesCss() ?>
- </style>
- <?php if (!empty($settings['custom_css'])): ?>
- <style>
- <?= $settings['custom_css'] ?>
- </style>
- <?php endif; ?>
- <?= SiteFront::renderCustomHeadHtml($pageType ?? null) ?>
- <?= SiteFront::renderAnalyticsScripts('head') ?>
- </head>
-
- <body class="<?= htmlspecialchars($menuPositionClass) ?>" data-theme="light">
- <?= SiteFront::renderAnalyticsScripts('body_start') ?>
- <script>
- (function() {
- try {
- var t = localStorage.getItem('publisium_theme');
- if (t === 'dark' || t === 'light') {
- document.body.setAttribute('data-theme', t);
- } else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
- document.body.setAttribute('data-theme', 'dark');
- }
- } catch (e) {}
- })();
- </script>
- <?= Icons::sprite() ?>
- <div class="site-shell">
-
- <?php
- $hasAuthLinks = UserAuth::check() || ($settings['login_enabled'] ?? '1') !== '0';
- $centerSearchHtml = $hasAuthLinks ? '' : SiteFront::renderSearchControl('nav');
- ?>
- <header class="site-header<?= $hasAuthLinks ? '' : ' site-header-no-auth' ?><?= $centerSearchHtml !== '' ? ' site-header-center-search' : '' ?>">
- <div class="site-header-row">
- <?php
- $brandHasLogo = !empty($settings['site_logo_url']);
- $brandShowName = !$brandHasLogo || ($settings['site_show_name_with_logo'] ?? '0') === '1';
- $brandShortName = trim((string) ($settings['site_short_name'] ?? ''));
- $brandUseShort = $brandShowName && ($settings['site_short_name_enabled'] ?? '0') === '1' && $brandShortName !== '';
- ?>
- <a href="<?= htmlspecialchars(SiteFront::homeUrl(), ENT_QUOTES) ?>" class="site-brand"<?= $brandUseShort ? ' data-short-name="1"' : '' ?>>
- <?php if ($brandHasLogo): ?>
- <img src="<?= htmlspecialchars($settings['site_logo_url']) ?>" alt="<?= htmlspecialchars($settings['site_name']) ?>" class="site-brand-logo">
- <?php endif; ?>
- <?php if ($brandShowName): ?>
- <span class="site-brand-full"><?= htmlspecialchars($settings['site_name']) ?></span>
- <?php if ($brandUseShort): ?>
- <span class="site-brand-short"><?= htmlspecialchars($brandShortName) ?></span>
- <?php endif; ?>
- <?php endif; ?>
- </a>
-
- <button type="button" class="site-menu-toggle" id="site-menu-toggle" aria-label="<?= htmlspecialchars(Language::get('nav_menu_toggle', 'Open menu'), ENT_QUOTES) ?>" aria-expanded="false">
- <?= Icons::icon('menu', 'icon icon-sm site-menu-toggle-icon-open') ?>
- <?= Icons::icon('x', 'icon icon-sm site-menu-toggle-icon-close') ?>
- </button>
-
- </div>
-
- <?php if ($centerSearchHtml !== ''): ?>
- <div class="site-search-center"><?= $centerSearchHtml ?></div>
- <?php endif; ?>
-
- <div class="site-nav-backdrop" id="site-nav-backdrop"></div>
-
- <nav class="site-nav" id="site-nav">
- <?php foreach ($navItems as $navItem): ?>
- <a href="<?= htmlspecialchars($navItem['url'], ENT_QUOTES) ?>" target="<?= htmlspecialchars($navItem['target'], ENT_QUOTES) ?>" <?= $navItem['target'] === '_blank' ? ' rel="noopener noreferrer"' : '' ?>><?= $navItem['icon_html'] ?? '' ?><?= htmlspecialchars($navItem['label']) ?></a>
- <?php endforeach; ?>
- <?= SiteFront::renderSearchControl('nav') ?>
-
- <?php if ($hasAuthLinks): ?>
- <div class="site-auth-links site-auth-links-mobile">
- <?php if (UserAuth::check()): ?>
- <a href="account.php"><?= htmlspecialchars(Language::get('nav_account', 'My account')) ?></a>
- <a href="user-login.php?logout=1"><?= htmlspecialchars(Language::get('nav_logout', 'Log out')) ?></a>
- <?php else: ?>
- <a href="user-login.php?mode=login"><?= htmlspecialchars(Language::get('nav_login', 'Log in')) ?></a>
- <?php if (($settings['registration_enabled'] ?? '1') === '1'): ?>
- <a href="user-login.php?mode=register" class="site-auth-cta"><?= htmlspecialchars(Language::get('nav_register', 'Sign up')) ?></a>
- <?php endif; ?>
- <?php endif; ?>
- </div>
- <?php endif; ?>
- </nav>
-
- <?php if ($hasAuthLinks): ?>
- <div class="site-auth-links site-auth-links-desktop">
- <?php if (UserAuth::check()): ?>
- <a href="account.php"><?= htmlspecialchars(Language::get('nav_account', 'My account')) ?></a>
- <a href="user-login.php?logout=1"><?= htmlspecialchars(Language::get('nav_logout', 'Log out')) ?></a>
- <?php else: ?>
- <a href="user-login.php?mode=login"><?= htmlspecialchars(Language::get('nav_login', 'Log in')) ?></a>
- <?php if (($settings['registration_enabled'] ?? '1') === '1'): ?>
- <a href="user-login.php?mode=register" class="site-auth-cta"><?= htmlspecialchars(Language::get('nav_register', 'Sign up')) ?></a>
- <?php endif; ?>
- <?php endif; ?>
- </div>
- <?php endif; ?>
- </header>
-
- <?php if (($settings['banner_enabled'] ?? '1') === '1' && !empty($showBanner) && !empty($latestForBanner ?? null)): ?>
- <div class="latest-banner">
- <h2><?= htmlspecialchars(Language::get('home_latest', 'Latest')) ?></h2>
- <div class="latest-banner-row">
- <?php foreach ($latestForBanner as $latestItem): ?>
- <a href="<?= htmlspecialchars(SiteFront::articleUrl($latestItem['slug'])) ?>" class="latest-banner-item">
- <?php if (!empty($latestItem['cover_image_path'])): ?>
- <img src="<?= htmlspecialchars($latestItem['cover_image_path']) ?>" alt="">
- <?php endif; ?>
- <?= htmlspecialchars($latestItem['title']) ?>
- </a>
- <?php endforeach; ?>
- </div>
- </div>
- <?php endif; ?>
-
- <main class="site-main">
- <?php foreach (SiteFront::activeAds('header') as $headerAd): ?>
- <?= SiteFront::renderAd($headerAd) ?>
- <?php endforeach; ?>