Code
Publisium
A modern, fast CMS for building article and blog websites.
Version history
Version 2.0.0.7 2026-11-07
Browse filesFiles changed12
Lines added+101
Lines removed-32
.htaccess
⋮ 41 unchanged lines ⋮ RewriteRule ^([^.]+)$ article.php?slug=$1 [L,QSA] </IfModule> + <IfModule mod_expires.c> + ExpiresActive On + ExpiresByType image/png "access plus 30 days" + ExpiresByType image/jpeg "access plus 30 days" + ExpiresByType image/webp "access plus 30 days" + ExpiresByType image/gif "access plus 30 days" + ExpiresByType image/svg+xml "access plus 30 days" + ExpiresByType image/x-icon "access plus 30 days" + ExpiresByType image/vnd.microsoft.icon "access plus 30 days" + ExpiresByType font/woff2 "access plus 1 year" + ExpiresByType font/woff "access plus 1 year" + ExpiresByType font/ttf "access plus 1 year" + </IfModule> + + <IfModule mod_headers.c> + <FilesMatch "(?i)\.(png|jpe?g|webp|gif|svg|ico|avif)$"> + Header set Cache-Control "public, max-age=2592000" + </FilesMatch> + <FilesMatch "(?i)\.(woff2?|ttf|otf)$"> + Header set Cache-Control "public, max-age=31536000, immutable" + </FilesMatch> + </IfModule> +
article.php
⋮ 212 unchanged lines ⋮ <?php endif; ?> </div> + <?php $commentsJump = ($settings['comments_enabled'] ?? '0') === '1' && ($settings['comments_jump_link'] ?? '0') === '1' && !$isLocked; ?> + <?php if ($commentsJump): ?> + <div class="article-actions"> + <?= SiteFront::renderShareControl($article) ?> + <a href="#article-comments" class="share-toggle-btn comments-jump-btn"><svg class="icon icon-sm" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg><span><?= htmlspecialchars(Language::get('article_comments_title', 'Comments')) ?></span></a> + </div> + <?php else: ?> <?= SiteFront::renderShareControl($article) ?> + <?php endif; ?> <?= SiteFront::renderAds('article-top') ?> ⋮ 169 unchanged lines ⋮ <?php endif; ?> <?php if ($settings['comments_enabled'] === '1' && !$isLocked): ?> - <section class="comments-section"> + <section class="comments-section" id="article-comments"> <h2><?= htmlspecialchars(Language::get('article_comments_title', 'Comments')) ?></h2> <?= Comments::render($settings, $article) ?> ⋮ 4 unchanged lines ⋮
assets/site.css
Not shown (binary file or too large to diff).
assets/site.js
⋮ 4 unchanged lines ⋮ function applyTheme(theme) { document.body.setAttribute('data-theme', theme); + document.documentElement.setAttribute('data-theme', theme); + document.documentElement.style.colorScheme = theme; } function initTheme() { ⋮ 13 unchanged lines ⋮ function toggleTheme() { var current = document.body.getAttribute('data-theme') || 'light'; var next = current === 'dark' ? 'light' : 'dark'; + document.documentElement.classList.add('theme-switching'); applyTheme(next); + setTimeout(function () { + document.documentElement.classList.remove('theme-switching'); + }, 300); try { localStorage.setItem(THEME_KEY, next); } catch (error) { ⋮ 744 unchanged lines ⋮
dashboard-actions/save-settings.php
⋮ 122 unchanged lines ⋮ 'article_views_enabled' => isset($_POST['article_views_enabled']) ? '1' : '0', 'article_time_enabled' => isset($_POST['article_time_enabled']) ? '1' : '0', 'article_time_format' => ($_POST['article_time_format'] ?? '24') === '12' ? '12' : '24', + 'article_timezone' => in_array((string) ($_POST['article_timezone'] ?? ''), DateTimeZone::listIdentifiers(), true) ? (string) $_POST['article_timezone'] : '', 'back_to_top_enabled' => isset($_POST['back_to_top_enabled']) ? '1' : '0', 'back_to_top_progress_enabled' => isset($_POST['back_to_top_progress_enabled']) ? '1' : '0', 'toc_enabled' => isset($_POST['toc_enabled']) ? '1' : '0', ⋮ 130 unchanged lines ⋮
includes/block-editor.php
⋮ 235 unchanged lines ⋮ $html .= $dom->saveHTML($child); } - return $html; + return self::decodeTextEntities($html); + } + + private static function decodeTextEntities(string $html): string + { + return (string) preg_replace_callback('/&(#[0-9]+|#x[0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]*);/', static function (array $match): string { + $char = html_entity_decode($match[0], ENT_QUOTES | ENT_HTML5, 'UTF-8'); + if ($char === $match[0] || $char === "\u{00A0}" || mb_strlen($char, 'UTF-8') !== 1 || ord($char[0]) < 128) { + return $match[0]; + } + + return $char; + }, $html); } private static function sanitizeNode(\DOMDocument $dom, \DOMNode $node, array $allowedTags, string $allowedColors): void ⋮ 317 unchanged lines ⋮
includes/comments.php
⋮ 52 unchanged lines ⋮ return [ 'comments_enabled' => isset($post['comments_enabled']) ? '1' : '0', + 'comments_jump_link' => isset($post['comments_jump_link']) ? '1' : '0', 'comments_provider' => $provider, 'comments_shortname' => $match(strtolower($text('comments_shortname', 64)), '/^[a-z0-9-]{1,64}$/'), 'comments_server_url' => self::cleanServerUrl($text('comments_server_url', 255)), ⋮ 169 unchanged lines ⋮
includes/front-header.php
⋮ 23 unchanged lines ⋮ <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> + <script> + (function() { + var t = 'light'; + try { + var s = localStorage.getItem('publisium_theme'); + if (s === 'dark' || s === 'light') { + t = s; + } else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + t = 'dark'; + } + } catch (e) {} + document.documentElement.setAttribute('data-theme', t); + document.documentElement.style.colorScheme = t; + })(); + </script> <title><?= htmlspecialchars($resolvedPageTitle) ?></title> <?php if (!empty($resolvedPageDescription)): ?> <meta name="description" content="<?= htmlspecialchars($resolvedPageDescription) ?>"> ⋮ 11 unchanged lines ⋮ <link rel="alternate" type="application/rss+xml" title="<?= htmlspecialchars($resolvedPageTitle, ENT_QUOTES) ?>" href="<?= htmlspecialchars($rssFeedUrl, ENT_QUOTES) ?>"> <?php endif; ?> <?= Asset::favicon() ?> + <?php if (!empty($settings['site_logo_url'])): ?> + <link rel="preload" as="image" href="<?= htmlspecialchars($settings['site_logo_url']) ?>" fetchpriority="high"> + <?php endif; ?> <?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"> ⋮ 16 unchanged lines ⋮ </head> <body class="<?= htmlspecialchars($menuPositionClass) ?>" data-theme="light"> + <script>document.body.setAttribute('data-theme', document.documentElement.getAttribute('data-theme') || 'light');</script> <?= 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"> ⋮ 11 unchanged lines ⋮ ?> <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"> + <img src="<?= htmlspecialchars($settings['site_logo_url']) ?>" alt="<?= htmlspecialchars($settings['site_name']) ?>" class="site-brand-logo" height="34" fetchpriority="high" decoding="sync"> <?php endif; ?> <?php if ($brandShowName): ?> <span class="site-brand-full"><?= htmlspecialchars($settings['site_name']) ?></span> ⋮ 52 unchanged lines ⋮ <?php endif; ?> </header> - <?php if (($settings['banner_enabled'] ?? '1') === '1' && !empty($showBanner) && !empty($latestForBanner ?? null)): ?> - <div class="latest-banner"> + <?php if (($settings['banner_enabled'] ?? '0') === '1' && !empty($showBanner) && !empty($latestForBanner ?? null)): ?> + <div class="latest-banner" style="--ticker-duration: <?= max(20, count($latestForBanner) * 8) ?>s;"> <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 class="latest-banner-viewport"> + <div class="latest-banner-row"> + <?php for ($tickerCopy = 0; $tickerCopy < 2; $tickerCopy++): ?> + <?php foreach ($latestForBanner as $latestItem): ?> + <a href="<?= htmlspecialchars(SiteFront::articleUrl($latestItem['slug'])) ?>" class="latest-banner-item"<?= $tickerCopy === 1 ? ' aria-hidden="true" tabindex="-1"' : '' ?>><?= htmlspecialchars($latestItem['title']) ?></a> + <?php endforeach; ?> + <?php endfor; ?> + </div> </div> </div> <?php endif; ?> ⋮ 5 unchanged lines ⋮
includes/site-front.php
⋮ 103 unchanged lines ⋮ $date = false; if (class_exists('IntlDateFormatter')) { - $formatter = new IntlDateFormatter(str_replace('-', '_', Languages::htmlLang()), IntlDateFormatter::LONG, IntlDateFormatter::NONE, date_default_timezone_get()); + $formatter = new IntlDateFormatter(str_replace('-', '_', Languages::htmlLang()), IntlDateFormatter::LONG, IntlDateFormatter::NONE, self::displayTimezone()->getName()); $date = $formatter->format($timestamp); } if (!is_string($date) || $date === '') { - $date = date('F j, Y', $timestamp); + $date = (new DateTimeImmutable('@' . $timestamp))->setTimezone(self::displayTimezone())->format('F j, Y'); } if (!$withTime) { return $date; } - return $date . ', ' . date(self::settings()['article_time_format'] === '12' ? 'g:i A' : 'H:i', $timestamp); + return $date . ', ' . (new DateTimeImmutable('@' . $timestamp))->setTimezone(self::displayTimezone())->format(self::settings()['article_time_format'] === '12' ? 'g:i A' : 'H:i'); } + public static function displayTimezone(): DateTimeZone + { + $name = (string) (self::settings()['article_timezone'] ?? ''); + if ($name !== '' && in_array($name, DateTimeZone::listIdentifiers(), true)) { + return new DateTimeZone($name); + } + + return new DateTimeZone(date_default_timezone_get()); + } + // The payment link, with the reader's email filled in on Polar and Stripe payment links. // The webhook links a payment to an account by email, so this keeps them matching. public static function subscriptionCheckoutUrl(?string $email = null): string ⋮ 126 unchanged lines ⋮ 'custom_body_html_category' => '0', 'custom_body_html_pages' => '0', 'menu_position' => 'top', - 'banner_enabled' => '1', + 'banner_enabled' => '0', 'featured_banner_enabled' => '0', 'featured_banner_mode' => 'static', 'featured_banner_hide_duplicates' => '0', ⋮ 10 unchanged lines ⋮ 'article_views_enabled' => '0', 'article_time_enabled' => '0', 'article_time_format' => '24', + 'article_timezone' => '', 'back_to_top_enabled' => '0', 'adblock_notice_enabled' => '0', 'adblock_notice_mode' => 'session', ⋮ 11 unchanged lines ⋮ 'sitemap_rss_enabled' => '1', 'rss_category_feeds_enabled' => '0', 'comments_enabled' => '0', + 'comments_jump_link' => '0', 'comments_provider' => 'disqus', 'comments_shortname' => '', 'comments_server_url' => '', ⋮ 961 unchanged lines ⋮
install.php
⋮ 536 unchanged lines ⋮ 'site_description' => $siteDescription, 'clean_article_urls' => '0', 'menu_position' => 'top', - 'banner_enabled' => '1', + 'banner_enabled' => '0', 'featured_banner_enabled' => '0', 'featured_banner_mode' => 'static', 'featured_banner_hide_duplicates' => '0', ⋮ 547 unchanged lines ⋮
settings.php
Not shown (binary file or too large to diff).
version.txt
- 2.0.0.4 + 2.0.0.7