This file is part of a Moko Consulting project. SPDX-License-Identifier: GPL-3.0-or-later # FILE INFORMATION DEFGROUP: Joomla.Template.Site INGROUP: MokoCassiopeia REPO: https://github.com/mokoconsulting-tech/MokoCassiopeia PATH: ./templates/mokocassiopeia/offline.php VERSION: 03.06.02 BRIEF: Offline page template file for MokoCassiopeia */ declare(strict_types=1); defined('_JEXEC') or die; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; use Joomla\CMS\Uri\Uri; /** * @var \Joomla\CMS\Document\HtmlDocument $this * @var \Joomla\Registry\Registry $this->params * @var string $this->language * @var string $this->direction */ $app = Factory::getApplication(); $doc = Factory::getDocument(); $params = $this->params ?: $app->getTemplate(true)->params; $direction = $this->direction ?: 'ltr'; /* ----------------------- Load ONLY template.css + theme palettes (with min toggle) ------------------------ */ $useMin = !((int) $params->get('development_mode', 0) === 1); $assetSuffix = $useMin ? '.min' : ''; $base = rtrim(Uri::root(true), '/') . '/templates/' . $this->template . '/css/'; $jsBase = rtrim(Uri::root(true), '/') . '/templates/' . $this->template . '/js/'; $doc->addStyleSheet($base . 'template' . $assetSuffix . '.css', ['version' => 'auto'], ['id' => 'moko-template']); /* Load theme palettes */ $doc->addStyleSheet($base . 'theme/light.standard' . $assetSuffix . '.css', ['version' => 'auto'], ['id' => 'moko-light-standard']); $doc->addStyleSheet($base . 'theme/dark.standard' . $assetSuffix . '.css', ['version' => 'auto'], ['id' => 'moko-dark-standard']); /* Load custom palettes only if selected in template configuration AND files exist */ $params_LightColorName = (string) $params->get('colorLightName', 'standard'); $params_DarkColorName = (string) $params->get('colorDarkName', 'standard'); if ($params_LightColorName === 'custom' && file_exists(JPATH_ROOT . '/media/templates/site/mokocassiopeia/css/theme/light.custom.css')) { $doc->addStyleSheet($base . 'theme/light.custom' . $assetSuffix . '.css', ['version' => 'auto'], ['id' => 'moko-light-custom']); } if ($params_DarkColorName === 'custom' && file_exists(JPATH_ROOT . '/media/templates/site/mokocassiopeia/css/theme/dark.custom.css')) { $doc->addStyleSheet($base . 'theme/dark.custom' . $assetSuffix . '.css', ['version' => 'auto'], ['id' => 'moko-dark-custom']); } /* Load user assets last (after all other styles and scripts) */ $doc->addStyleSheet($base . 'user' . $assetSuffix . '.css', ['version' => 'auto'], ['id' => 'moko-user']); /* Bootstrap CSS/JS for accordion behavior; safe to keep. */ HTMLHelper::_('bootstrap.loadCss', true, $doc); HTMLHelper::_('bootstrap.framework'); /* Load template.js for theme switcher and other functionality */ $doc->addScript($jsBase . 'template' . $assetSuffix . '.js', ['version' => 'auto', 'defer' => true], ['id' => 'moko-template-js']); /* Load user.js last for custom user scripts */ $doc->addScript($jsBase . 'user' . $assetSuffix . '.js', ['version' => 'auto', 'defer' => true], ['id' => 'moko-user-js']); /* ----------------------- Title + Meta (Include Site Name in Page Titles) ------------------------ */ $sitename = (string) $app->get('sitename'); $baseTitle = Text::_('JGLOBAL_OFFLINE') ?: 'Offline'; $snSetting = (int) $app->get('sitename_pagetitles', 0); // 0=no, 1=before, 2=after if ($snSetting === 1) { $doc->setTitle(Text::sprintf('JPAGETITLE', $sitename, $baseTitle)); // Site Name BEFORE } elseif ($snSetting === 2) { $doc->setTitle(Text::sprintf('JPAGETITLE', $baseTitle, $sitename)); // Site Name AFTER } else { $doc->setTitle($baseTitle); } $doc->setMetaData('robots', 'noindex, nofollow'); /* ----------------------- Offline content from Global Config ------------------------ */ $displayOfflineMessage = (int) $app->get('display_offline_message', 1); // 0|1|2 $offlineMessage = trim((string) $app->get('offline_message', '')); /* ----------------------- Brand: logo from params OR siteTitle (matches index.php) ------------------------ */ $brandHtml = ''; $logoFile = (string) $params->get('logoFile'); if ($logoFile !== '') { $brandHtml = HTMLHelper::_( 'image', Uri::root(false) . htmlspecialchars($logoFile, ENT_QUOTES, 'UTF-8'), $sitename, ['class' => 'logo d-inline-block', 'loading' => 'eager', 'decoding' => 'async'], false, 0 ); } else { // If no logo file, show the title (defaults to "MokoCassiopeia" if not set) $siteTitle = $params->get('siteTitle', 'MokoCassiopeia'); $brandHtml = '' . htmlspecialchars($siteTitle, ENT_COMPAT, 'UTF-8') . ''; } $brandTagline = (string) ($params->get('brand_tagline') ?: $params->get('siteDescription') ?: ''); $showTagline = (int) $params->get('show_brand_tagline', 0); // Theme params $params_theme_enabled = (int) $params->get('theme_enabled', 1); // Analytics params $params_googletagmanager = $params->get('googletagmanager', false); $params_googletagmanagerid = $params->get('googletagmanagerid', null); $params_googleanalytics = $params->get('googleanalytics', false); $params_googleanalyticsid = $params->get('googleanalyticsid', null); $params_googlesitekey = $params->get('googlesitekey', null); if (!empty($params_googlesitekey)) { $doc->setMetaData('google-site-verification', htmlspecialchars($params_googlesitekey, ENT_QUOTES, 'UTF-8')); } /* ----------------------- Login routes & Users ------------------------ */ $action = Route::_('index.php', true); $return = base64_encode(Uri::base()); $allowRegistration = (bool) ComponentHelper::getParams('com_users')->get('allowUserRegistration', 0); if (class_exists('\Joomla\Component\Users\Site\Helper\RouteHelper')) { $resetUrl = \Joomla\Component\Users\Site\Helper\RouteHelper::getResetRoute(); $remindUrl = \Joomla\Component\Users\Site\Helper\RouteHelper::getRemindRoute(); $registrationUrl = \Joomla\Component\Users\Site\Helper\RouteHelper::getRegistrationRoute(); } else { $resetUrl = Route::_('index.php?option=com_users&view=reset'); $remindUrl = Route::_('index.php?option=com_users&view=remind'); $registrationUrl = Route::_('index.php?option=com_users&view=registration'); } ?>