Files
luxtools-template/tpl_header.php

118 lines
4.5 KiB
PHP
Executable File

<?php
/**
* Template header, included in the main and detail files
*/
// must be run from within DokuWiki
if (!defined('DOKU_INC')) die();
$siteToolsHtml = (new \dokuwiki\Menu\SiteMenu())->getListItems('action ');
$userToolsHtml = '';
if ($conf['useacl']) {
$userToolsHtml = (new \dokuwiki\Menu\UserMenu())->getListItems('action ');
}
$breadcrumbsHtml = '';
if ($conf['youarehere']) {
$breadcrumbsHtml = tpl_youarehere(null, true);
// Remove the "You are here" label and the start page link,
// since the wiki logo already links to the start page.
if ($breadcrumbsHtml) {
// Strip the label span and the home/start page span
$breadcrumbsHtml = preg_replace('/<span class="bchead">.*?<\/span>/', '', $breadcrumbsHtml);
$breadcrumbsHtml = preg_replace('/<span class="home">.*?<\/span>/', '', $breadcrumbsHtml);
// Remove any leading separator left over after stripping the home link
$breadcrumbsHtml = preg_replace('/^\s*»\s*/', '' , trim($breadcrumbsHtml));
}
}
if (!$breadcrumbsHtml && $conf['breadcrumbs']) {
$breadcrumbsHtml = tpl_breadcrumbs(null, true);
}
$templateLogoUrl = tpl_basedir() . 'images/logo.svg';
$templateLogoPath = DOKU_TPLINC . 'images/logo.svg';
?>
<!-- ********** HEADER ********** -->
<header id="dokuwiki__header"><div class="pad group">
<?php tpl_includeFile('header.html') ?>
<ul class="a11y skip">
<li><a href="#dokuwiki__content"><?php echo $lang['skip_to_content']; ?></a></li>
</ul>
<div class="header__bar">
<div class="headings header__brand">
<h1 class="logo"><?php
$logoSize = [];
$logo = tpl_getMediaFile([
':wiki:logo.svg', ':logo.svg',
':wiki:logo.png', ':logo.png',
'images/logo.svg', 'images/logo.png'
], false, $logoSize);
if ($logo === $templateLogoUrl) {
$logoMarkup = '<span class="logo__image logo__image--svg" aria-hidden="true">' .
inlineSVG($templateLogoPath) .
'</span>';
} else {
$logoMarkup = '<img src="' . $logo . '" ' . ($logoSize ? $logoSize[3] : '') . ' alt="" />';
}
tpl_link(
wl(),
$logoMarkup .
'<span>' . $conf['title'] . '</span>',
'accesskey="h" title="' . tpl_getLang('home') . ' [h]"'
);
?></h1>
<?php if ($breadcrumbsHtml) : ?>
<div class="breadcrumbs header__breadcrumbs"><?php echo $breadcrumbsHtml; ?></div>
<?php endif ?>
</div>
<div id="dokuwiki__sitetools" class="tools header__actions">
<h3 class="a11y"><?php echo $lang['site_tools']; ?></h3>
<?php tpl_searchform(true, false); ?>
<?php if ($siteToolsHtml || $userToolsHtml) : ?>
<details class="header__menu">
<summary aria-label="<?php echo hsc($lang['tools']); ?>" title="<?php echo hsc($lang['tools']); ?>">
<?php echo inlineSVG(DOKU_INC . 'lib/images/menu/settings.svg'); ?>
</summary>
<div class="header__menu-panel">
<?php if ($siteToolsHtml) : ?>
<ul class="header__menu-list header__menu-list--site">
<?php echo $siteToolsHtml; ?>
</ul>
<?php endif ?>
<?php if ($siteToolsHtml && $userToolsHtml) : ?>
<div class="header__menu-separator" role="separator"></div>
<?php endif ?>
<?php if ($userToolsHtml) : ?>
<div id="dokuwiki__usertools">
<h3 class="a11y"><?php echo $lang['user_tools']; ?></h3>
<ul class="header__menu-list header__menu-list--user">
<?php echo $userToolsHtml; ?>
</ul>
</div>
<?php endif ?>
</div>
</details>
<?php endif ?>
<div class="mobileTools">
<?php echo (new \dokuwiki\Menu\MobileMenu())->getDropdown($lang['tools']); ?>
</div>
</div>
</div>
<hr class="a11y" />
</div></header><!-- /header -->