1<?php 2/** 3 * Kiwiki Template 4 * 5 * @link http://dokuwiki.org/template:kiwiki 6 * @author Anika Henke <anika@selfthinker.org> 7 * @author Nicolas Prigent 8 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 9 */ 10 11if (!defined('DOKU_INC')) die(); /* must be run from within DokuWiki */ 12@require_once(dirname(__FILE__).'/tpl_functions.php'); /* include hook for template functions */ 13 14$showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && !empty($_SERVER['REMOTE_USER']) ); 15$showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show'); 16$sidebar = $conf['sidebar']; 17$sidebarElement = tpl_getConf('sidebarIsNav') ? 'nav' : 'aside'; 18$sidebarMaxHeight = tpl_getConf('SidebarMaxHeight'); 19$sidebar_right = tpl_getConf('SidebarRight'); 20$toc = tpl_toc(true); 21$tocMaxHeight = tpl_getConf('TocMaxHeight'); 22$toc_right = tpl_getConf('TocRight'); 23$contentMaxWidth = tpl_getConf('ContentMaxWidth'); 24$themeMode = tpl_getConf('DefaultTheme'); 25$forceTheme = tpl_getConf('ForceTheme'); 26$contentWidth = '100%'; 27$asideWidth = '20%'; 28if(($toc!='' || ($ACT == 'show' && page_exists($sidebar))) && $sidebar_right == $toc_right){ 29 $contentWidth = '80%'; 30} 31if($sidebar_right != $toc_right ){ 32 $contentWidth = '68%'; 33 $asideWidth = '16%'; 34} 35 36if (!empty($_COOKIE['theme'])){ 37 if(!$forceTheme){ 38 $themeMode = in_array($_COOKIE['theme'], ['darkmode', 'lightmode', 'system-color']) ? $_COOKIE['theme'] : $themeMode; 39 }else{ 40 setcookie("theme",$themeMode); 41 } 42} 43if (!isset($_COOKIE['theme']) || empty($_COOKIE['theme'] || !in_array($_COOKIE['theme'], ['darkmode', 'lightmode', 'system-color']))){ 44 setcookie("theme",$themeMode); 45} 46$logoSize = array(); 47 48$logodark = tpl_getMediaFile(array(':wiki:logo-dark.png', ':logo-dark.png', 'images/logo-dark.png'), true, $logoSize, false); 49$logolight = tpl_getMediaFile(array(':wiki:logo-light.png', ':logo-light.png', 'images/logo-light.png'), true, $logoSize, false); 50$logo = tpl_getMediaFile(array(':wiki:logo.png', ':logo.png', 'images/logo.png'), true, $logoSize); 51 52 53?><!DOCTYPE html> 54<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $conf['lang'] ?>" 55 lang="<?php echo $conf['lang'] ?>" dir="<?php echo $lang['direction'] ?>" class="no-js"> 56<head> 57 <meta charset="UTF-8" /> 58 <title><?php tpl_pagetitle() ?> [<?php echo strip_tags($conf['title']) ?>]</title> 59 <script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script> 60 <?php tpl_metaheaders() ?> 61 <meta name="viewport" content="width=device-width,initial-scale=1" /> 62 <?php echo tpl_favicon(array('favicon', 'mobile')) ?> 63 <?php tpl_includeFile('meta.html')?> 64 <style>body{ 65 --kiwiki-sidebar-max-height:<?php echo $sidebarMaxHeight; ?>px; 66 --kiwiki-toc-max-height:<?php echo $tocMaxHeight; ?>px; 67 --kiwiki-content-max-width:<?php echo $contentMaxWidth; ?>; 68 --kiwiki-content-width:<?php echo $contentWidth; ?>; 69 --kiwiki-aside-width:<?php echo $asideWidth; ?>; 70 --kiwiki-logo-url:url(<?php echo $logo; ?>); 71 --kiwiki-logo-light-url:url(<?php echo $logolight ? $logolight : $logo; ?>); 72 --kiwiki-logo-dark-url:url(<?php echo $logodark ? $logodark : $logo; ?>); 73 } 74 </style> 75</head> 76 77 78<body id="kiwiki" class="<?php echo $themeMode; ?>"> 79 <?php /* the "dokuwiki__top" id is needed somewhere at the top, because that's where the "back to top" button/link links to */ ?> 80 <?php /* tpl_classes() provides useful CSS classes; if you choose not to use it, the 'dokuwiki' class at least 81 should always be in one of the surrounding elements (e.g. plugins and templates depend on it) */ ?> 82 <?php $admin_page = (($ACT == "admin") && (isset($_REQUEST['page']))) ? explode("#",$_REQUEST['page'])[0]: "" ;?> 83 <div id="dokuwiki__site"> 84 <div id="dokuwiki__top" class="site <?php echo tpl_classes() ." " . $admin_page; ?>"> 85 <!-- ********** HEADER ********** --> 86 <?php include('partial/header.php');?> 87 88 <?php include('partial/before_content.php'); ?> 89 90 <?php include('partial/content.php');?> 91 92 </div> 93 <!-- ********** FOOTER ********** --> 94 <?php include('partial/footer.php'); ?> 95 <!-- GO TOP --> 96 <div id="go"> 97 <?php 98 99 $items = (new \dokuwiki\Menu\KiwikiGo())->getItems(); 100 foreach ($items as $item){ 101 if ($item -> getType() == 'bottom' && !tpl_getConf('GoBottomBtn')){ 102 continue; 103 }else{ 104 echo '<a href="'.$item->getLink().'" title="'.$item->getTitle().'">' 105 .'<span class="icon">'.inlineSVG($item->getSvg()).'</span>' 106 . '<span class="a11y">'.$item->getLabel().'</span>' 107 . '</a>'; 108 } 109 } 110 ?> 111 </div> 112 </div><!-- /site --> 113 <div id="dokuwiki__bottom"></div> 114 <div class="no"><?php tpl_indexerWebBug() /* provide DokuWiki housekeeping, required in all templates */ ?></div> 115</body> 116</html> 117