예제 #1
0
/**
 * Includes the rendered HTML of a given page
 *
 * This function is useful to populate sidebars or similar features in a
 * template
 */
function template_tpl_include_page($pageid, $print = true, $propagate = false, $rev = '')
{
    if (!$pageid) {
        return false;
    }
    if ($propagate) {
        $pageid = page_findnearest($pageid);
    }
    global $TOC;
    $oldtoc = $TOC;
    $html = p_wiki_xhtml($pageid, $rev, false);
    $TOC = $oldtoc;
    if (!$print) {
        return $html;
    }
    echo $html;
    return $html;
}
 function testExistingSidebars()
 {
     global $ID;
     saveWikiText('sidebar', 'topsidebar-test', '');
     $ID = 'foo:bar:baz:test';
     $sidebar = page_findnearest('sidebar');
     $this->assertEquals('sidebar', $sidebar);
     $ID = 'foo';
     $sidebar = page_findnearest('sidebar');
     $this->assertEquals('sidebar', $sidebar);
     saveWikiText('foo:bar:sidebar', 'bottomsidebar-test', '');
     $ID = 'foo:bar:baz:test';
     $sidebar = page_findnearest('sidebar');
     $this->assertEquals('foo:bar:sidebar', $sidebar);
     $ID = 'foo:bar:test';
     $sidebar = page_findnearest('sidebar');
     $this->assertEquals('foo:bar:sidebar', $sidebar);
     $ID = 'foo';
     $sidebar = page_findnearest('sidebar');
     $this->assertEquals('sidebar', $sidebar);
 }
 * @author   Giuseppe Di Terlizzi <*****@*****.**>
 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
 */
// must be run from within DokuWiki
if (!defined('DOKU_INC')) {
    die;
}
if (($ACT == 'show' || defined('DOKU_MEDIADETAIL')) && bootstrap3_conf('showPageIcons')) {
    global $ID;
    $page_icons = bootstrap3_conf('pageIcons');
    $social_share = in_array('social-share', $page_icons);
    $social_share_providers = bootstrap3_conf('socialShareProviders');
    $help_page = false;
    $help_title = null;
    if (in_array('help', $page_icons)) {
        $help_page = page_findnearest('help', bootstrap3_conf('useACL'));
        $help_title = hsc(p_get_first_heading($help_page));
    }
    ?>
<div class="dw-page-icons pull-right hidden-print">

  <ul class="list-inline pull-right">
    <?php 
    if (in_array('feed', $page_icons)) {
        ?>
    <li>
      <a href="<?php 
        echo DOKU_URL . 'feed.php';
        ?>
" title="<?php 
        echo $lang['btn_recent'];
/**
 * Calculate automatically the grid size for main container
 *
 * @author  Giuseppe Di Terlizzi <*****@*****.**>
 *
 * @return  string
 */
function _tpl_get_container_grid()
{
    global $ACT;
    global $conf;
    $grids = array();
    $result = '';
    $showRightSidebar = page_findnearest(tpl_getConf('rightSidebar')) && $ACT == 'show';
    $showLeftSidebar = page_findnearest($conf['sidebar']) && $ACT == 'show';
    $fluidContainer = tpl_getConf('fluidContainer');
    if (!$showLeftSidebar) {
        return 'container' . ($fluidContainer ? '-fluid' : '');
    }
    foreach (split(' ', tpl_getConf('leftSidebarGrid')) as $grid) {
        list($col, $media, $size) = split('-', $grid);
        $grids[$media]['left'] = (int) $size;
    }
    foreach (split(' ', tpl_getConf('rightSidebarGrid')) as $grid) {
        list($col, $media, $size) = split('-', $grid);
        $grids[$media]['right'] = (int) $size;
    }
    foreach ($grids as $media => $item) {
        $left = $item['left'];
        $right = $item['right'];
        $result .= sprintf('col-%s-%s ', $media, 12 - $left - ($showRightSidebar ? $right : 0));
    }
    return $result;
}
예제 #5
0
<?php

/**
 * DokuWiki Starter Bootstrap Template
 *
 * @link     http://dokuwiki.org/template:starterbootstrap
 * @author   Cameron Littel <*****@*****.**>
 */
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') && $_SERVER['REMOTE_USER'];
$showSidebar = (page_findnearest($conf['sidebar']) || $conf['sidebar'] == "automatic") && $ACT == 'show';
$sidebarCols = (int) tpl_getConf('sidebar_cols');
$sidebarPos = tpl_getConf('sidebar_pos');
if ($sidebarCols < 0 || $sidebarCols >= 12) {
    $sidebarCols = 3;
}
?>
<!DOCTYPE html>
<html xml:lang="<?php 
echo $conf['lang'];
?>
" lang="<?php 
echo $conf['lang'];
?>
" dir="<?php 
echo $lang['direction'];
/**
 * Simple wrapper for tpl_getConf
 *
 * @author  Giuseppe Di Terlizzi <*****@*****.**>
 *
 * @param   string  $key
 * @param   mixed   $default value
 * @return  mixed
 */
function bootstrap3_conf($key, $default = false)
{
    global $ACT, $INFO, $ID, $conf;
    $value = tpl_getConf($key, $default);
    switch ($key) {
        case 'showTools':
        case 'showSearchForm':
        case 'showPageTools':
            return $value !== 'never' && ($value == 'always' || !empty($_SERVER['REMOTE_USER']));
        case 'showIndividualTool':
        case 'hideInThemeSwitcher':
        case 'tableStyle':
            return explode(',', $value);
        case 'showAdminMenu':
            return $value && $INFO['isadmin'];
        case 'hideLoginLink':
        case 'showLoginOnFooter':
            return $value && !$_SERVER['REMOTE_USER'];
        case 'showSidebar':
            if (bootstrap3_conf('showLandingPage')) {
                return false;
            }
            return page_findnearest($conf['sidebar']) && $ACT == 'show';
        case 'showRightSidebar':
            return page_findnearest(tpl_getConf('rightSidebar')) && $ACT == 'show';
        case 'landingPages':
            return sprintf('/%s/', $value);
        case 'showLandingPage':
            return $value && (bool) preg_match_all(bootstrap3_conf('landingPages'), $ID);
        case 'pageOnPanel':
            if (bootstrap3_conf('showLandingPage')) {
                return false;
            }
            return $value;
        case 'showThemeSwitcher':
            return $value && bootstrap3_conf('bootstrapTheme') == 'bootswatch';
    }
    //$type = bootstrap3_conf_metadata($key);
    //if ($type[0] == 'regex') {
    //  return sprintf('/%s/', $value);
    //}
    return $value;
}
/**
 * Simple wrapper for tpl_getConf
 *
 * @author  Giuseppe Di Terlizzi <*****@*****.**>
 *
 * @param   string  $key
 * @param   mixed   $default value
 * @return  mixed
 */
function bootstrap3_conf($key, $default = false)
{
    global $ACT, $INFO, $ID, $conf;
    $value = tpl_getConf($key, $default);
    switch ($key) {
        case 'showTools':
        case 'showSearchForm':
        case 'showPageTools':
            return $value !== 'never' && ($value == 'always' || !empty($_SERVER['REMOTE_USER']));
        case 'showAdminMenu':
            return $value && $INFO['isadmin'];
        case 'hideLoginLink':
        case 'showLoginOnFooter':
            return $value && !$_SERVER['REMOTE_USER'];
        case 'showCookieLawBanner':
            return $value && page_findnearest(tpl_getConf('cookieLawBannerPage'), bootstrap3_conf('useACL')) && $ACT == 'show';
        case 'showSidebar':
            if ($ACT !== 'show') {
                return false;
            }
            if (bootstrap3_conf('showLandingPage')) {
                return false;
            }
            return page_findnearest($conf['sidebar'], bootstrap3_conf('useACL'));
        case 'showRightSidebar':
            if ($ACT !== 'show') {
                return false;
            }
            if (bootstrap3_conf('sidebarPosition') == 'right') {
                return false;
            }
            return page_findnearest(tpl_getConf('rightSidebar'), bootstrap3_conf('useACL'));
        case 'showLandingPage':
            return $value && (bool) preg_match_all(bootstrap3_conf('landingPages'), $ID);
        case 'pageOnPanel':
            if (bootstrap3_conf('showLandingPage')) {
                return false;
            }
            return $value;
        case 'showThemeSwitcher':
            return $value && bootstrap3_conf('bootstrapTheme') == 'bootswatch';
        case 'tocCollapseSubSections':
            if (!bootstrap3_conf('tocAffix')) {
                return false;
            }
            return $value;
        case 'schemaOrgType':
            if ($semantic = plugin_load('helper', 'semantic')) {
                if (method_exists($semantic, 'getSchemaOrgType')) {
                    return $semantic->getSchemaOrgType();
                }
            }
            return $value;
    }
    $metadata = bootstrap3_conf_metadata($key);
    switch ($metadata[0]) {
        case 'regex':
            return sprintf('/%s/', $value);
        case 'multicheckbox':
            return explode(',', $value);
    }
    return $value;
}
예제 #8
0
<?php

/**
 * DokuWiki Default Template 2012
 *
 * @link     http://dokuwiki.org/template
 * @author   Anika Henke <*****@*****.**>
 * @author   Clarence Lee <*****@*****.**>
 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
 */
if (!defined('DOKU_INC')) {
    die;
}
/* must be run from within DokuWiki */
header('X-UA-Compatible: IE=edge,chrome=1');
$hasSidebar = page_findnearest($conf['sidebar']);
$showSidebar = $hasSidebar && $ACT == 'show';
?>
<!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();
?>
예제 #9
0
/**
 * Includes the rendered HTML of a given page
 *
 * This function is useful to populate sidebars or similar features in a
 * template
 *
 * @param string $pageid The page name you want to include
 * @param bool $print Should the content be printed or returned only
 * @param bool $propagate Search higher namespaces, too?
 * @param bool $useacl Include the page only if the ACLs check out?
 * @return bool|null|string
 */
function tpl_include_page($pageid, $print = true, $propagate = false, $useacl = true)
{
    if ($propagate) {
        $pageid = page_findnearest($pageid, $useacl);
    } elseif ($useacl && auth_quickaclcheck($pageid) == AUTH_NONE) {
        return false;
    }
    if (!$pageid) {
        return false;
    }
    global $TOC;
    $oldtoc = $TOC;
    $html = p_wiki_xhtml($pageid, '', false);
    $TOC = $oldtoc;
    if ($print) {
        echo $html;
    }
    return $html;
}
<?php

/**
 * DokuWiki Bootstrap3 Template: Footer page
 *
 * @link     http://dokuwiki.org/template:bootstrap3
 * @author   Giuseppe Di Terlizzi <*****@*****.**>
 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
 */
// must be run from within DokuWiki
if (!defined('DOKU_INC')) {
    die;
}
if (page_findnearest('footer', bootstrap3_conf('useACL'))) {
    ?>
<footer id="dw__footer" class="small navbar <?php 
    echo bootstrap3_conf('inverseNavbar') ? 'navbar-inverse' : 'navbar-default';
    ?>
">
  <div class="container<?php 
    echo bootstrap3_is_fluid_container() ? '-fluid' : '';
    ?>
">
    <div class="navbar-text">
      <?php 
    tpl_include_page('footer', 1, 1, bootstrap3_conf('useACL'));
    ?>
    </div>
  </div>
</footer>
<?php 
/**
 * Calculate automatically the grid size for main container
 *
 * @author  Giuseppe Di Terlizzi <*****@*****.**>
 *
 * @return  string
 */
function bootstrap3_container_grid()
{
    global $ACT;
    global $ID;
    global $conf;
    $grids = array();
    $result = '';
    $showRightSidebar = page_findnearest(tpl_getConf('rightSidebar')) && $ACT == 'show';
    $showLeftSidebar = page_findnearest($conf['sidebar']) && $ACT == 'show';
    $fluidContainer = tpl_getConf('fluidContainer');
    if (tpl_getConf('fluidContainerBtn')) {
        $fluidContainer = bootstrap3_fluid_container_button();
    }
    if (tpl_getConf('showLandingPage') && (bool) preg_match_all(sprintf('/%s/', tpl_getConf('landingPages')), $ID)) {
        $showLeftSidebar = false;
    }
    if (!$showLeftSidebar) {
        return 'container' . ($fluidContainer ? '-fluid' : '');
    }
    foreach (explode(' ', tpl_getConf('leftSidebarGrid')) as $grid) {
        list($col, $media, $size) = explode('-', $grid);
        $grids[$media]['left'] = (int) $size;
    }
    foreach (explode(' ', tpl_getConf('rightSidebarGrid')) as $grid) {
        list($col, $media, $size) = explode('-', $grid);
        $grids[$media]['right'] = (int) $size;
    }
    foreach ($grids as $media => $item) {
        $left = $item['left'];
        $right = $item['right'];
        $result .= sprintf('col-%s-%s ', $media, 12 - $left - ($showRightSidebar ? $right : 0));
    }
    return $result;
}
/**
 * Simple wrapper for tpl_getConf
 *
 * @author  Giuseppe Di Terlizzi <*****@*****.**>
 *
 * @param   string  $key
 * @param   mixed   $default value
 * @return  mixed
 */
function bootstrap3_conf($key, $default = false)
{
    global $ACT, $INFO, $ID, $conf;
    $value = tpl_getConf($key, $default);
    switch ($key) {
        case 'showTools':
        case 'showSearchForm':
        case 'showPageTools':
            return $value !== 'never' && ($value == 'always' || !empty($_SERVER['REMOTE_USER']));
        case 'showIndividualTool':
        case 'hideInThemeSwitcher':
        case 'tableStyle':
            return explode(',', $value);
        case 'showAdminMenu':
            return $value && $INFO['isadmin'];
        case 'hideLoginLink':
            return !$value || !empty($_SERVER['REMOTE_USER']);
        case 'browserTitle':
            return str_replace(array('@WIKI@', '@TITLE@'), array(strip_tags($conf['title']), tpl_pagetitle(null, true)), $value);
        case 'showSidebar':
            return page_findnearest($conf['sidebar']) && $ACT == 'show';
        case 'showRightSidebar':
            return page_findnearest(tpl_getConf('rightSidebar')) && $ACT == 'show';
        case 'landingPages':
            return sprintf('/%s/', $value);
    }
    //$type = bootstrap3_metadata($key);
    //if ($type[0] == 'regex') {
    //  return sprintf('/%s/', $value);
    //}
    return $value;
}
/**
 * DokuWiki Bootstrap3 Template: Global Configurations
 *
 * @link     http://dokuwiki.org/template:bootstrap3
 * @author   Giuseppe Di Terlizzi <*****@*****.**>
 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
 */
$showTools = tpl_getConf('showTools') != 'never' && (tpl_getConf('showTools') == 'always' || !empty($_SERVER['REMOTE_USER']));
$individualTools = tpl_getConf('individualTools');
$showUserHomeLink = tpl_getConf('showUserHomeLink');
$showLoginOnFooter = tpl_getConf('showLoginOnFooter');
$showLoginLink = !tpl_getConf('hideLoginLink') || !empty($_SERVER['REMOTE_USER']);
$showSidebar = page_findnearest($conf['sidebar']) && $ACT == 'show';
$sidebarPosition = tpl_getConf('sidebarPosition');
$showRightSidebar = page_findnearest(tpl_getConf('rightSidebar')) && $ACT == 'show';
$rightSidebar = tpl_getConf('rightSidebar');
$showCookieLawBanner = tpl_getConf('showCookieLawBanner');
$cookieLawBannerPage = tpl_getConf('cookieLawBannerPage');
$cookieLawPolicyPage = tpl_getConf('cookieLawPolicyPage');
$browserTitle = str_replace(array('@WIKI@', '@TITLE@'), array(strip_tags($conf['title']), tpl_pagetitle(null, true)), tpl_getConf('browserTitle'));
$showThemeSwitcher = tpl_getConf('showThemeSwitcher');
$fixedTopNavbar = tpl_getConf('fixedTopNavbar');
$inverseNavbar = tpl_getConf('inverseNavbar');
$bootstrapTheme = tpl_getConf('bootstrapTheme');
$customTheme = tpl_getConf('customTheme');
$bootswatchTheme = tpl_getConf('bootswatchTheme');
$pageOnPanel = tpl_getConf('pageOnPanel');
$fluidContainer = tpl_getConf('fluidContainer');
$showPageInfo = tpl_getConf('showPageInfo');
$showBadges = tpl_getConf('showBadges');
예제 #14
0
파일: main.php 프로젝트: projectesIF/Ateneu
<?php

/**
 * Templar - Dokuwiki Template - 09/2012
 * based on Andreas's Gohr template dokuwiki/main.php
 *
 * @link     http://templar.cavalie.ro
 * @author   Tudor Vaida
 * @license  GPL 3 (http://www.gnu.org/licenses/gpl.html)
 */
if (!defined('DOKU_INC')) {
    die;
}
$customSidebar = 'custom' == $conf['sidebar'];
$showSidebar = $ACT == 'show' && ($customSidebar || page_findnearest($conf['sidebar']));
?>
<!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']);
예제 #15
0
    <?php 
}
?>

    <!-- The global message array -->
    <?php 
html_msgarea();
?>


    <div class="row">

        <!-- ********** The CONTENT layout ********** -->
        <!-- ********** One or two coloumns ********** -->
        <?php 
if ($ACT == 'show' and $showSidebar and page_findnearest($conf['sidebar'])) {
    echo '<div role="main" class="col-md-9">';
} else {
    echo '<div role="main" class="col-md-12">';
}
?>


        <!-- BREADCRUMBS -->
        <?php 
if ($conf['youarehere']) {
    tpl_youarehere_bootstrap();
}
?>

        <!-- Some plugin (such as wrap) rely on the dokuwiki div tag for their css-->
/**
 * Simple wrapper for tpl_getConf
 *
 * @author  Giuseppe Di Terlizzi <*****@*****.**>
 *
 * @param   string  $key
 * @param   mixed   $default value
 * @return  mixed
 */
function bootstrap3_conf($key, $default = false)
{
    global $ACT, $INFO, $ID, $conf;
    $value = tpl_getConf($key, $default);
    switch ($key) {
        case 'showTools':
        case 'showSearchForm':
        case 'showPageTools':
            return $value !== 'never' && ($value == 'always' || !empty($_SERVER['REMOTE_USER']));
        case 'showIndividualTool':
        case 'hideInThemeSwitcher':
        case 'tableStyle':
            return explode(',', $value);
        case 'showAdminMenu':
            return $value && $INFO['isadmin'];
        case 'hideLoginLink':
            return !$value || !empty($_SERVER['REMOTE_USER']);
        case 'browserTitle':
            if (bootstrap3_conf('browserTitleShowNS')) {
                $ns_parts = explode(':', $ID);
                $ns_pages = array();
                $ns_titles = array();
                $ns_separator = sprintf(' %s ', bootstrap3_conf('browserTitleCharSepNS'));
                if (useHeading('navigation')) {
                    foreach ($ns_parts as $ns_part) {
                        $ns_page .= "{$ns_part}:";
                        $ns_pages[] = $ns_page;
                    }
                    $ns_pages = array_unique($ns_pages);
                    foreach ($ns_pages as $ns_page) {
                        resolve_pageid(getNS($ns_page), $ns_page, $exists);
                        $ns_page_title_heading = hsc(p_get_first_heading($ns_page));
                        $ns_page_title_page = noNSorNS($ns_page);
                        $ns_page_title = $ns_page_title_heading ? $ns_page_title_heading : $ns_page_title_page;
                        $ns_titles[] = $ns_page_title;
                    }
                    $ns_titles[] = tpl_pagetitle($ID, true);
                    $ns_titles = array_unique($ns_titles);
                } else {
                    $ns_titles = $ns_parts;
                }
                if (bootstrap3_conf('browserTitleOrderNS') == 'normal') {
                    $ns_titles = array_reverse($ns_titles);
                }
                $browser_title = implode($ns_separator, $ns_titles);
            } else {
                $browser_title = tpl_pagetitle($ID, true);
            }
            return str_replace(array('@WIKI@', '@TITLE@'), array(strip_tags($conf['title']), $browser_title), $value);
        case 'showSidebar':
            return page_findnearest($conf['sidebar']) && $ACT == 'show';
        case 'showRightSidebar':
            return page_findnearest(tpl_getConf('rightSidebar')) && $ACT == 'show';
        case 'landingPages':
            return sprintf('/%s/', $value);
    }
    //$type = bootstrap3_metadata($key);
    //if ($type[0] == 'regex') {
    //  return sprintf('/%s/', $value);
    //}
    return $value;
}
예제 #17
0
파일: main.php 프로젝트: fxleblanc/Wiki
    echo $conf['tagline'];
    ?>
</h2>
                    <?php 
}
?>
                </div>

                <div class="search-form widget">
                    <?php 
tpl_searchform();
?>
                </div>

                <?php 
if (page_findnearest('topnav')) {
    ?>
                    <nav id="writr__site-navigation" class="main-navigation" role="navigation">
                        <h3 class="menu-toggle genericon genericon-menu" title="<?php 
    echo tpl_getLang('menu');
    ?>
">
                            <span class="a11y"><?php 
    echo tpl_getLang('menu');
    ?>
</span>
                        </h3>
                        <div class="a11y skip-link">
                            <a href="#writr__content"><?php 
    echo $lang['skip_to_content'];
    ?>
/**
 * DokuWiki Starter Template
 *
 * @link     http://dokuwiki.org/template:starter
 * @author   Anika Henke <*****@*****.**>
 * @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 */
header('X-UA-Compatible: IE=edge,chrome=1');
$showTools = !tpl_getConf('hideTools') || tpl_getConf('hideTools') && !empty($_SERVER['REMOTE_USER']);
$showSidebar = page_findnearest($conf['sidebar']) && $ACT == 'show';
?>
<!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" />
예제 #19
0
/**
 * Include the sidebar, will check current namespaces first
 */
function tpl_sidebar($print = true)
{
    global $conf;
    $sidebar = page_findnearest($conf['sidebar']);
    if ($sidebar) {
        return tpl_include_page($sidebar, $print);
    }
    return '';
}
예제 #20
0
/**
 * Includes the rendered HTML of a given page
 *
 * This function is useful to populate sidebars or similar features in a
 * template
 */
function tpl_include_page($pageid, $print = true, $propagate = false)
{
    global $ID;
    global $TOC;
    if ($propagate) {
        $pageid = page_findnearest($pageid);
    }
    $oldid = $ID;
    $oldtoc = $TOC;
    $html = p_wiki_xhtml($pageid, '', false);
    $ID = $oldid;
    $TOC = $oldtoc;
    if (!$print) {
        return $html;
    }
    echo $html;
    return $html;
}