dokuwiki-template-landing/main.php

114 lines
4.7 KiB
PHP
Raw Normal View History

2021-07-12 18:26:55 +02:00
<?php
/**
* DokuWiki Default Template 2012
*
* @author Ruediger Marwein <henryxiv@hotmail.com>
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/
if (!defined('DOKU_INC')) die();
$hasSidebar = page_findnearest($conf['sidebar']);
$showSidebar = $hasSidebar && ($ACT=='show');
ob_start();
tpl_content(false);
$content = ob_get_clean();
$wrapperClass = "act-".$ACT;
if(in_array($ACT, array('edit', 'preview', 'source'))) {
$wrapperClass = "act-edit";
}
if($ACT == "preview") {
$expectedH1Exists = preg_match("/(<h1 .*?id=\"preview\")/", $content, $h1Pattern);
if($expectedH1Exists) {
// in preview there's a h1 right before content
$editForm = substr($content, 0, strpos($content, $h1Pattern[1]));
$content = substr($content, strlen($editForm));
$wrapperClass = "act-edit";
}
} elseif($ACT == 'edit' or $ACT == "source") {
$editForm = $content;
$content = '';
}
$loggedIn = $INPUT->server->str('REMOTE_USER');
2021-07-12 18:26:55 +02:00
?><!DOCTYPE html>
<html 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') ?>
</head>
<body>
2021-07-12 18:26:55 +02:00
<div id="wrapper">
<div class="overlay"></div>
<div id="dokuwiki__site">
<div id="dokuwiki__top" class="site <?php echo tpl_classes(); ?> <?php echo $wrapperClass ?>">
<?php if(in_array($ACT, ['edit', 'preview', 'source'])): ?>
2021-07-12 18:26:55 +02:00
<div class="container">
<?php echo $editForm ?>
2021-07-12 18:26:55 +02:00
</div>
<?php endif ?>
<?php if(in_array($ACT, ['login', 'profile', 'revisions', 'recent', 'admin', 'diff', 'draft', 'resendpwd', 'register', 'subscribe', 'index', 'backlink', 'source'])): ?>
<div class="container">
<?php tpl_link(wl($ID), "Back", 'class="btn btn-default"'); ?>
<?php echo $content ?>
</div>
<?php elseif(in_array($ACT, ['media'])): ?>
<div class="container-fluid">
<?php tpl_link(wl($ID), "Back", 'class="btn btn-default"'); ?>
<?php echo $content ?>
</div>
<?php else: ?>
<article>
<?php echo $content ?>
</article>
<?php endif ?>
<?php if(!in_array($ACT, ['edit'])): ?>
<aside id="dokuwiki__pagetools">
<div class="container">
<h3 class="a11y"><?php echo $lang['page_tools']; ?></h3>
<div class="tools">
<ul class="list-group">
<?php if(in_array($ACT, ['show', 'revisions'])): ?>
<?php echo (new \dokuwiki\Menu\PageMenu())->getListItems("action-page list-group-item "); ?>
<?php endif ?>
<?php if($loggedIn): ?>
<?php echo (new \dokuwiki\Menu\SiteMenu())->getListItems("action-site list-group-item "); ?>
<?php endif ?>
<?php echo (new \dokuwiki\Menu\UserMenu())->getListItems('action-user list-group-item '); ?>
</ul>
</div>
</div>
</aside>
<?php endif ?>
2021-07-12 18:26:55 +02:00
<footer class="text-center">
<?php tpl_include_page("footer", true, true) ?>
</footer>
<?php tpl_flush() ?>
</div>
<div class="no"><?php tpl_indexerWebBug() ?></div>
<div id="screen__mode" class="no"></div>
</div>
<?php if(in_array($ACT, ['show'])): ?>
<nav class="navbar navbar-inverse navbar-fixed-top sidebar-offcanvas" id="sidebar-wrapper" role="navigation">
<?php tpl_include_page("sidebar", true, true) ?>
</nav>
<button type="button" class="hamburger is-closed" data-toggle="offcanvas">
<i class="hamburger-icon dw-icons fa-fw fa fa-bars" style=""></i>
</button>
<?php endif ?>
2021-07-12 18:26:55 +02:00
</div>
</body>
</html>