* @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Uri\Uri; /** @var Joomla\CMS\Document\HtmlDocument $this */ $app = Factory::getApplication(); $input = $app->getInput(); $wa = $this->getWebAssetManager(); $params_ColorName = $this->params->get('colorName', 'colors_standard'); $params_googletagmanager = $this->params->get('googletagmanager', false); $params_googletagmanagerid = $this->params->get('googletagmanagerid', null); $params_googleanalytics = $this->params->get('googleanalytics', false); $params_googleanalyticsid = $this->params->get('googleanalyticsid', null); $params_custom_head_start = $this->params->get('custom_head_start', null); $params_custom_head_end = $this->params->get('custom_head_end', null); $params_leftIcon = htmlspecialchars( $this->params->get('drawerLeftIcon', 'fa-solid fa-chevron-left'), ENT_COMPAT, 'UTF-8' ); $params_rightIcon = htmlspecialchars( $this->params->get('drawerRightIcon', 'fa-solid fa-chevron-right'), ENT_COMPAT, 'UTF-8' ); // Add Bootstrap 5 Support HTMLHelper::_('bootstrap.framework'); HTMLHelper::_('bootstrap.loadCss', true); HTMLHelper::_('bootstrap.alert'); HTMLHelper::_('bootstrap.button'); HTMLHelper::_('bootstrap.carousel'); HTMLHelper::_('bootstrap.collapse'); HTMLHelper::_('bootstrap.dropdown'); HTMLHelper::_('bootstrap.modal'); HTMLHelper::_('bootstrap.offcanvas'); HTMLHelper::_('bootstrap.popover'); HTMLHelper::_('bootstrap.scrollspy'); HTMLHelper::_('bootstrap.tab'); HTMLHelper::_('bootstrap.tooltip'); HTMLHelper::_('bootstrap.toast'); // Detecting Active Variables $option = $input->getCmd('option', ''); $view = $input->getCmd('view', ''); $layout = $input->getCmd('layout', ''); $task = $input->getCmd('task', ''); $itemid = $input->getCmd('Itemid', ''); $sitename = htmlspecialchars($app->get('sitename'), ENT_QUOTES, 'UTF-8'); $menu = $app->getMenu()->getActive(); $pageclass = $menu !== null ? $menu->getParams()->get('pageclass_sfx', '') : ''; // Template path $templatePath = 'media/templates/site/moko-cassiopeia'; // Color Theme $assetColorName = 'theme.' . $params_ColorName; $wa->registerAndUseStyle($assetColorName, $templatePath . '/css/global/' . $params_ColorName . '.css'); // Use a font scheme if set in the template style options $params_FontScheme = $this->params->get('useFontScheme', false); $fontStyles = ''; if ($params_FontScheme) { if (stripos($params_FontScheme, 'https://') === 0) { $this->getPreloadManager()->preconnect('https://fonts.googleapis.com/', ['crossorigin' => 'anonymous']); $this->getPreloadManager()->preconnect('https://fonts.gstatic.com/', ['crossorigin' => 'anonymous']); $this->getPreloadManager()->preload($params_FontScheme, ['as' => 'style', 'crossorigin' => 'anonymous']); $wa->registerAndUseStyle('fontscheme.current', $params_FontScheme, [], ['media' => 'print', 'rel' => 'lazy-stylesheet', 'onload' => 'this.media=\'all\'', 'crossorigin' => 'anonymous']); if (preg_match_all('/family=([^?:]*):/i', $params_FontScheme, $matches) > 0) { $fontStyles = '--font-family-body: "' . str_replace('+', ' ', $matches[1][0]) . '", sans-serif;\n'; $fontStyles .= '--font-family-headings: "' . str_replace('+', ' ', isset($matches[1][1]) ? $matches[1][1] : $matches[1][0]) . '", sans-serif;\n'; $fontStyles .= '--font-weight-normal: 400;\n'; $fontStyles .= '--font-weight-headings: 700;'; } } else { $wa->registerAndUseStyle('fontscheme.current', $params_FontScheme, ['version' => 'auto'], ['media' => 'print', 'rel' => 'lazy-stylesheet', 'onload' => 'this.media=\'all\'']); $this->getPreloadManager()->preload($wa->getAsset('style', 'fontscheme.current')->getUri() . '?' . $this->getMediaVersion(), ['as' => 'style']); } } // Enable assets $wa->usePreset('template.MOKO-CASSIOPEIA.' . ($this->direction === 'rtl' ? 'rtl' : 'ltr')) ->useStyle('template.active.language') ->useStyle('template.user') ->useScript('template.user') ->addInlineStyle(":root {\n --hue: 214;\n --template-bg-light: #f0f4fb;\n --template-text-dark: #495057;\n --template-text-light: #ffffff;\n --template-link-color: #2a69b8;\n --template-special-color: #001B4C;\n $fontStyles\n }"); // Override 'template.active' asset for correct dependency $wa->registerStyle('template.active', '', [], [], ['template.MOKO-CASSIOPEIA.' . ($this->direction === 'rtl' ? 'rtl' : 'ltr')]); // Logo file or site title if ($this->params->get('logoFile')) { $logo = HTMLHelper::_('image', Uri::root(false) . htmlspecialchars($this->params->get('logoFile'), ENT_QUOTES), $sitename, ['loading' => 'eager', 'decoding' => 'async'], false, 0); } elseif ($this->params->get('siteTitle')) { $logo = '' . htmlspecialchars($this->params->get('siteTitle'), ENT_COMPAT, 'UTF-8') . ''; } else { $logo = HTMLHelper::_('image', 'full_logo.png', $sitename, ['class' => 'logo d-inline-block', 'loading' => 'eager', 'decoding' => 'async'], true, 0); } $hasClass = ''; if ($this->countModules('sidebar-left', true)) { $hasClass .= ' has-sidebar-left'; } if ($this->countModules('sidebar-right', true)) { $hasClass .= ' has-sidebar-right'; } if ($this->countModules('drawer-left', true)) { $hasClass .= ' has-drawer-left'; } if ($this->countModules('drawer-right', true)) { $hasClass .= ' has-drawer-right'; } $params_DrawerIconLeft = $this->params->get('drawerIconLeft', 'fas fa-chevron-right'); $params_DrawerIconRight = $this->params->get('drawerIconRight', 'fas fa-chevron-left'); // Container $wrapper = $this->params->get('fluidContainer') ? 'wrapper-fluid' : 'wrapper-static'; $this->setMetaData('viewport', 'width=device-width, initial-scale=1'); $stickyHeader = $this->params->get('stickyHeader') ? 'position-sticky sticky-top' : ''; if ($this->params->get('fA6KitCode')) { $fa6Kit = "https://kit.fontawesome.com/" . $this->params->get('fA6KitCode') . ".js"; JHtml::_('script', $fa6Kit, ['crossorigin' => 'anonymous']); } else { $wa->getAsset('style', 'fontawesome')->setAttribute('rel', 'lazy-stylesheet'); } // Add Bootstrap TOC CSS $this->addStyleSheet($templatePath . '/css/vendor/afeld/bootstrap-toc.min.css'); // Add Bootstrap TOC JS (should be loaded after Bootstrap JS) $this->addScript($templatePath . '/js/vendor/afeld/bootstrap-toc.min.js'); ?>