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