本文整理汇总了PHP中page_findnearest函数的典型用法代码示例。如果您正苦于以下问题:PHP page_findnearest函数的具体用法?PHP page_findnearest怎么用?PHP page_findnearest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了page_findnearest函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: template_tpl_include_page
/**
* 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;
}
示例2: testExistingSidebars
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);
}
示例3: bootstrap3_conf
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
* @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'];
示例4: _tpl_get_container_grid
/**
* Calculate automatically the grid size for main container
*
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
*
* @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: dirname
<?php
/**
* DokuWiki Starter Bootstrap Template
*
* @link http://dokuwiki.org/template:starterbootstrap
* @author Cameron Littel <cameron@camlittle.com>
*/
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'];
示例6: bootstrap3_conf
/**
* Simple wrapper for tpl_getConf
*
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
*
* @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;
}
示例7: bootstrap3_conf
/**
* Simple wrapper for tpl_getConf
*
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
*
* @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: header
<?php
/**
* DokuWiki Default Template 2012
*
* @link http://dokuwiki.org/template
* @author Anika Henke <anika@selfthinker.org>
* @author Clarence Lee <clarencedglee@gmail.com>
* @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: tpl_include_page
/**
* 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;
}
示例10:
<?php
/**
* DokuWiki Bootstrap3 Template: Footer page
*
* @link http://dokuwiki.org/template:bootstrap3
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
* @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
示例11: bootstrap3_container_grid
/**
* Calculate automatically the grid size for main container
*
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
*
* @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;
}
示例12: bootstrap3_conf
/**
* Simple wrapper for tpl_getConf
*
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
*
* @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;
}
示例13: tpl_getConf
/**
* DokuWiki Bootstrap3 Template: Global Configurations
*
* @link http://dokuwiki.org/template:bootstrap3
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
* @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: page_findnearest
<?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: html_msgarea
<?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-->