本文整理汇总了PHP中get_doku_pref函数的典型用法代码示例。如果您正苦于以下问题:PHP get_doku_pref函数的具体用法?PHP get_doku_pref怎么用?PHP get_doku_pref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_doku_pref函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSession
/**
* Return the user's session ID
*
* This is usually our own managed session, not a PHP session (only in fallback)
*
* @return string
*/
protected function getSession()
{
$ses = $_REQUEST['ses'];
if (!$ses) {
$ses = get_doku_pref('plgstatsses', false);
}
if (!$ses) {
$ses = session_id();
}
return $ses;
}
示例2: html_diff
/**
* Show diff
* between current page version and provided $text
* or between the revisions provided via GET or POST
*
* @author Andreas Gohr <andi@splitbrain.org>
* @param string $text when non-empty: compare with this text with most current version
* @param bool $intro display the intro text
* @param string $type type of the diff (inline or sidebyside)
*/
function html_diff($text = '', $intro = true, $type = null)
{
global $ID;
global $REV;
global $lang;
global $INPUT;
global $INFO;
$pagelog = new PageChangeLog($ID);
/*
* Determine diff type
*/
if (!$type) {
$type = $INPUT->str('difftype');
if (empty($type)) {
$type = get_doku_pref('difftype', $type);
if (empty($type) && $INFO['ismobile']) {
$type = 'inline';
}
}
}
if ($type != 'inline') {
$type = 'sidebyside';
}
/*
* Determine requested revision(s)
*/
// we're trying to be clever here, revisions to compare can be either
// given as rev and rev2 parameters, with rev2 being optional. Or in an
// array in rev2.
$rev1 = $REV;
$rev2 = $INPUT->ref('rev2');
if (is_array($rev2)) {
$rev1 = (int) $rev2[0];
$rev2 = (int) $rev2[1];
if (!$rev1) {
$rev1 = $rev2;
unset($rev2);
}
} else {
$rev2 = $INPUT->int('rev2');
}
/*
* Determine left and right revision, its texts and the header
*/
$r_minor = '';
$l_minor = '';
if ($text) {
// compare text to the most current revision
$l_rev = '';
$l_text = rawWiki($ID, '');
$l_head = '<a class="wikilink1" href="' . wl($ID) . '">' . $ID . ' ' . dformat((int) @filemtime(wikiFN($ID))) . '</a> ' . $lang['current'];
$r_rev = '';
$r_text = cleanText($text);
$r_head = $lang['yours'];
} else {
if ($rev1 && isset($rev2) && $rev2) {
// two specific revisions wanted
// make sure order is correct (older on the left)
if ($rev1 < $rev2) {
$l_rev = $rev1;
$r_rev = $rev2;
} else {
$l_rev = $rev2;
$r_rev = $rev1;
}
} elseif ($rev1) {
// single revision given, compare to current
$r_rev = '';
$l_rev = $rev1;
} else {
// no revision was given, compare previous to current
$r_rev = '';
$revs = $pagelog->getRevisions(0, 1);
$l_rev = $revs[0];
$REV = $l_rev;
// store revision back in $REV
}
// when both revisions are empty then the page was created just now
if (!$l_rev && !$r_rev) {
$l_text = '';
} else {
$l_text = rawWiki($ID, $l_rev);
}
$r_text = rawWiki($ID, $r_rev);
list($l_head, $r_head, $l_minor, $r_minor) = html_diff_head($l_rev, $r_rev, null, false, $type == 'inline');
}
/*
* Build navigation
*/
$l_nav = '';
//.........这里部分代码省略.........
示例3: html_diff
/**
* show diff
*
* @author Andreas Gohr <andi@splitbrain.org>
* @param string $text - compare with this text with most current version
* @param bool $intro - display the intro text
* @param string $type type of the diff (inline or sidebyside)
*/
function html_diff($text = '', $intro = true, $type = null)
{
global $ID;
global $REV;
global $lang;
global $INPUT;
global $INFO;
if (!$type) {
$type = $INPUT->str('difftype');
if (empty($type)) {
$type = get_doku_pref('difftype', $type);
if (empty($type) && $INFO['ismobile']) {
$type = 'inline';
}
}
}
if ($type != 'inline') {
$type = 'sidebyside';
}
// we're trying to be clever here, revisions to compare can be either
// given as rev and rev2 parameters, with rev2 being optional. Or in an
// array in rev2.
$rev1 = $REV;
$rev2 = $INPUT->ref('rev2');
if (is_array($rev2)) {
$rev1 = (int) $rev2[0];
$rev2 = (int) $rev2[1];
if (!$rev1) {
$rev1 = $rev2;
unset($rev2);
}
} else {
$rev2 = $INPUT->int('rev2');
}
$r_minor = '';
$l_minor = '';
if ($text) {
// compare text to the most current revision
$l_rev = '';
$l_text = rawWiki($ID, '');
$l_head = '<a class="wikilink1" href="' . wl($ID) . '">' . $ID . ' ' . dformat((int) @filemtime(wikiFN($ID))) . '</a> ' . $lang['current'];
$r_rev = '';
$r_text = cleanText($text);
$r_head = $lang['yours'];
} else {
if ($rev1 && isset($rev2) && $rev2) {
// two specific revisions wanted
// make sure order is correct (older on the left)
if ($rev1 < $rev2) {
$l_rev = $rev1;
$r_rev = $rev2;
} else {
$l_rev = $rev2;
$r_rev = $rev1;
}
} elseif ($rev1) {
// single revision given, compare to current
$r_rev = '';
$l_rev = $rev1;
} else {
// no revision was given, compare previous to current
$r_rev = '';
$revs = getRevisions($ID, 0, 1);
$l_rev = $revs[0];
$REV = $l_rev;
// store revision back in $REV
}
// when both revisions are empty then the page was created just now
if (!$l_rev && !$r_rev) {
$l_text = '';
} else {
$l_text = rawWiki($ID, $l_rev);
}
$r_text = rawWiki($ID, $r_rev);
list($l_head, $r_head, $l_minor, $r_minor) = html_diff_head($l_rev, $r_rev, null, false, $type == 'inline');
}
$df = new Diff(explode("\n", $l_text), explode("\n", $r_text));
if ($type == 'inline') {
$tdf = new InlineDiffFormatter();
} else {
$tdf = new TableDiffFormatter();
}
if ($intro) {
print p_locale_xhtml('diff');
}
if (!$text) {
ptln('<div class="diffoptions">');
$form = new Doku_Form(array('action' => wl()));
$form->addHidden('id', $ID);
$form->addHidden('rev2[0]', $l_rev);
$form->addHidden('rev2[1]', $r_rev);
$form->addHidden('do', 'diff');
//.........这里部分代码省略.........
示例4: tpl_content_core
/**
* Default Action of TPL_ACT_RENDER
*
* @return bool
*/
function tpl_content_core()
{
global $ACT;
global $TEXT;
global $PRE;
global $SUF;
global $SUM;
global $IDX;
global $INPUT;
switch ($ACT) {
case 'show':
html_show();
break;
/** @noinspection PhpMissingBreakStatementInspection */
/** @noinspection PhpMissingBreakStatementInspection */
case 'locked':
html_locked();
case 'edit':
case 'recover':
html_edit();
break;
case 'preview':
html_edit();
html_show($TEXT);
break;
case 'draft':
html_draft();
break;
case 'search':
html_search();
break;
case 'revisions':
html_revisions($INPUT->int('first'));
break;
case 'diff':
html_diff();
break;
case 'recent':
$show_changes = $INPUT->str('show_changes');
if (empty($show_changes)) {
$show_changes = get_doku_pref('show_changes', $show_changes);
}
html_recent($INPUT->extract('first')->int('first'), $show_changes);
break;
case 'index':
html_index($IDX);
#FIXME can this be pulled from globals? is it sanitized correctly?
break;
case 'backlink':
html_backlinks();
break;
case 'conflict':
html_conflict(con($PRE, $TEXT, $SUF), $SUM);
html_diff(con($PRE, $TEXT, $SUF), false);
break;
case 'login':
html_login();
break;
case 'register':
html_register();
break;
case 'resendpwd':
html_resendpwd();
break;
case 'denied':
html_denied();
break;
case 'profile':
html_updateprofile();
break;
case 'admin':
tpl_admin();
break;
case 'subscribe':
tpl_subscribe();
break;
case 'media':
tpl_media();
break;
default:
$evt = new Doku_Event('TPL_ACT_UNKNOWN', $ACT);
if ($evt->advise_before()) {
msg("Failed to handle command: " . hsc($ACT), -1);
}
$evt->advise_after();
unset($evt);
return false;
}
return true;
}
示例5: set_doku_pref
/**
* Add a preference to the DokuWiki cookie
* (remembering $_COOKIE['DOKU_PREFS'] is urlencoded)
* Remove it by setting $val to false
*
* @param string $pref preference key
* @param string $val preference value
*/
function set_doku_pref($pref, $val)
{
global $conf;
$orig = get_doku_pref($pref, false);
$cookieVal = '';
if ($orig && $orig != $val) {
$parts = explode('#', $_COOKIE['DOKU_PREFS']);
$cnt = count($parts);
// urlencode $pref for the comparison
$enc_pref = rawurlencode($pref);
for ($i = 0; $i < $cnt; $i += 2) {
if ($parts[$i] == $enc_pref) {
if ($val !== false) {
$parts[$i + 1] = rawurlencode($val);
} else {
unset($parts[$i]);
unset($parts[$i + 1]);
}
break;
}
}
$cookieVal = implode('#', $parts);
} else {
if (!$orig && $val !== false) {
$cookieVal = ($_COOKIE['DOKU_PREFS'] ? $_COOKIE['DOKU_PREFS'] . '#' : '') . rawurlencode($pref) . '#' . rawurlencode($val);
}
}
if (!empty($cookieVal)) {
$cookieDir = empty($conf['cookiedir']) ? DOKU_REL : $conf['cookiedir'];
setcookie('DOKU_PREFS', $cookieVal, time() + 365 * 24 * 3600, $cookieDir, '', $conf['securecookie'] && is_ssl());
}
}
示例6: bootstrap3_fluid_container_button
/**
* Check if the fluid container button is enabled (from the user cookie)
*
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
*
* @return boolean
*/
function bootstrap3_fluid_container_button()
{
if (!bootstrap3_conf('fluidContainerBtn')) {
return false;
}
if (get_doku_pref('fluidContainer', null) !== null && get_doku_pref('fluidContainer', null) !== '' && get_doku_pref('fluidContainer', null) !== '0') {
return true;
}
return false;
}
示例7: _getTplPerUser
/**
* Get template from session and/or user config
*
* @author Anika Henke <anika@selfthinker.org>
*/
private function _getTplPerUser()
{
// get all available templates
$helper = $this->loadHelper('loadskin', true);
$tpls = $helper->getTemplates();
$mobileSwitch = $this->getConf('mobileSwitch');
$user = $_SERVER['REMOTE_USER'];
$tplRequest = $_REQUEST['tpl'];
$actSelect = $_REQUEST['act'] && $_REQUEST['act'] == 'select';
// if template switcher was used
if ($tplRequest && $actSelect && (in_array($tplRequest, $tpls) || $tplRequest == '*')) {
// hidden way of deleting the cookie and config values
if ($tplRequest == '*') {
$tplRequest = false;
}
// not backwards-compatible, will only work with core PR #1129
// store in cookie
set_doku_pref('loadskinTpl', $tplRequest);
// if registered user, store also in conf file (not for mobile switcher)
if ($user && !$mobileSwitch) {
$this->_tplUserConfig('set', $user, $tplRequest);
}
return $tplRequest;
}
$tplUser = $this->_tplUserConfig('get', $user);
// from user conf file
$tplCookie = get_doku_pref('loadskinTpl', '');
// if logged in and user is in conf (not for mobile)
if ($user && $tplUser && in_array($tplUser, $tpls) && !$mobileSwitch) {
if ($tplCookie && $tplCookie == $tplUser) {
return $tplCookie;
}
// store in cookie
set_doku_pref('loadskinTpl', $tplUser);
return $tplUser;
}
// if template is stored in cookie
if ($tplCookie && in_array($tplCookie, $tpls)) {
return $tplCookie;
}
// if viewed on a mobile and mobile switcher is used, set mobile template as default
global $INFO;
$mobileTpl = $this->getConf('mobileTemplate');
if ($mobileTpl && $INFO['ismobile']) {
set_doku_pref('loadskinTpl', $mobileTpl);
return $mobileTpl;
}
return false;
}
示例8: _media_get_display_param
/**
* Get display parameters
*
* @param string $param name of parameter
* @param array $values allowed values, where default value has index key 'default'
* @return string the parameter value
*/
function _media_get_display_param($param, $values)
{
global $INPUT;
if (in_array($INPUT->str($param), $values)) {
// FIXME: Set cookie
return $INPUT->str($param);
} else {
$val = get_doku_pref($param, $values['default']);
if (!in_array($val, $values)) {
$val = $values['default'];
}
return $val;
}
}
示例9: bootstrap3_bootswatch_theme
/**
* Return (and set via cookie) the current Bootswatch theme
*
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
*
* @return string
*/
function bootstrap3_bootswatch_theme()
{
global $INPUT;
$bootswatch_theme = bootstrap3_conf('bootswatchTheme');
if (bootstrap3_conf('showThemeSwitcher')) {
if (get_doku_pref('bootswatchTheme', null) !== null && get_doku_pref('bootswatchTheme', null) !== '') {
$bootswatch_theme = get_doku_pref('bootswatchTheme', null);
}
if ($INPUT->str('bootswatch-theme')) {
$bootswatch_theme = $INPUT->str('bootswatch-theme');
set_doku_pref('bootswatchTheme', $bootswatch_theme);
}
}
return $bootswatch_theme;
}
示例10: trustExternal
/**
* Checks the session to see if the user is already logged in
*
* If not logged in, redirects to SAML provider
*/
public function trustExternal($user, $pass, $sticky = false)
{
global $USERINFO;
global $ID;
global $ACT;
global $conf;
// trust session info, no need to recheck
if (isset($_SESSION[DOKU_COOKIE]['auth']) && $_SESSION[DOKU_COOKIE]['auth']['buid'] == auth_browseruid() && isset($_SESSION[DOKU_COOKIE]['auth']['user'])) {
$_SERVER['REMOTE_USER'] = $_SESSION[DOKU_COOKIE]['auth']['user'];
$USERINFO = $_SESSION[DOKU_COOKIE]['auth']['info'];
return true;
}
if (!isset($_POST['SAMLResponse']) && ($ACT == 'login' || get_doku_pref('adfs_autologin', 0))) {
// Initiate SAML auth request
$authrequest = new SamlAuthRequest($this->settings);
$url = $authrequest->create();
$_SESSION['adfs_redirect'] = wl($ID, '', true, '&');
// remember current page
send_redirect($url);
} elseif (isset($_POST['SAMLResponse'])) {
// consume SAML response
$samlresponse = new SamlResponse($this->settings, $_POST['SAMLResponse']);
try {
if ($samlresponse->is_valid()) {
$_SERVER['REMOTE_USER'] = $samlresponse->get_attribute('login');
$USERINFO['user'] = $_SERVER['REMOTE_USER'];
$USERINFO['name'] = $samlresponse->get_attribute('fullname');
$USERINFO['mail'] = $samlresponse->get_attribute('email');
$USERINFO['grps'] = (array) $samlresponse->get_attribute('groups');
$USERINFO['grps'][] = $conf['defaultgroup'];
$USERINFO['grps'] = array_map(array($this, 'cleanGroup'), $USERINFO['grps']);
$_SESSION[DOKU_COOKIE]['auth']['user'] = $_SERVER['REMOTE_USER'];
$_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO;
$_SESSION[DOKU_COOKIE]['auth']['buid'] = auth_browseruid();
# cache login
// cache user data
$changes = array('name' => $USERINFO['name'], 'mail' => $USERINFO['mail'], 'grps' => $USERINFO['grps']);
if ($this->triggerUserMod('modify', array($user, $changes)) === false) {
$this->triggerUserMod('create', array($user, "nil", $USERINFO['name'], $USERINFO['mail'], $USERINFO['grps']));
}
// successful login
if (isset($_SESSION['adfs_redirect'])) {
$go = $_SESSION['adfs_redirect'];
unset($_SESSION['adfs_redirect']);
} else {
$go = wl($ID, '', true, '&');
}
set_doku_pref('adfs_autologin', 1);
send_redirect($go);
// decouple the history from POST
return true;
} else {
$this->logOff();
msg('The SAML response signature was invalid.', -1);
return false;
}
} catch (Exception $e) {
$this->logOff();
msg('Invalid SAML response: ' . hsc($e->getMessage()), -1);
return false;
}
}
// no login happened
return false;
}
示例11: _media_get_display_param
function _media_get_display_param($param, $values)
{
if (isset($_REQUEST[$param]) && in_array($_REQUEST[$param], $values)) {
// FIXME: Set cookie
return $_REQUEST[$param];
} else {
$val = get_doku_pref($param, $values['default']);
if (!in_array($val, $values)) {
$val = $values['default'];
}
return $val;
}
}
示例12:
<?php
/**
* DokuWiki Bootstrap3 Template: Cookie Law Banner
*
* @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 (bootstrap3_conf('showCookieLawBanner') && !(get_doku_pref('cookieNoticeAccepted', null) || get_doku_pref('cookieNoticeAccepted', ''))) {
$cookie_policy_page_id = bootstrap3_conf('cookieLawPolicyPage');
$cookie_banner_page_id = bootstrap3_conf('cookieLawBannerPage');
resolve_pageid('', $cookie_policy_page_id, $cookie_policy_page_exists);
?>
<div id="cookieNotice" class="navbar <?php
echo bootstrap3_conf('inverseNavbar') ? 'navbar-inverse' : 'navbar-default';
?>
navbar-fixed-bottom">
<div class="container">
<div class="navbar-text navbar-left">
<?php
$cookie_banner_page = tpl_include_page($cookie_banner_page_id, 0);
$cookie_banner_page = preg_replace('/<p>\\n(.*?)\\n<\\/p>/', '<i class="fa fa-info-circle text-primary"></i> $1', $cookie_banner_page);
echo $cookie_banner_page;
?>
</div>
<div class="navbar-right">
示例13: bootstrap3_conf
$useLocalBootswatch = bootstrap3_conf('useLocalBootswatch');
$contentGrid = bootstrap3_container_grid();
$bootstrapStyles = array();
$tplConfigJSON = array('tableFullWidth' => (int) bootstrap3_conf('tableFullWidth'), 'tableStyle' => bootstrap3_conf('tableStyle'), 'tagsOnTop' => (int) bootstrap3_conf('tagsOnTop'), 'useAnchorJS' => (int) bootstrap3_conf('useAnchorJS'));
$JSINFO['bootstrap3'] = $tplConfigJSON;
if ($fluidContainerBtn) {
$fluidContainer = bootstrap3_fluid_container_button();
}
// Display a landing page (set the pageOnPanel and showSidebar config to "off")
if ($showLandingPage && (bool) preg_match_all(bootstrap3_conf('landingPages'), $ID)) {
$showSidebar = false;
$pageOnPanel = false;
}
if ($showThemeSwitcher && $bootstrapTheme == 'bootswatch') {
if (get_doku_pref('bootswatchTheme', null) !== null && get_doku_pref('bootswatchTheme', null) !== '') {
$bootswatchTheme = get_doku_pref('bootswatchTheme', null);
}
global $INPUT;
if ($INPUT->str('bootswatchTheme')) {
$bootswatchTheme = $INPUT->str('bootswatchTheme');
set_doku_pref('bootswatchTheme', $bootswatchTheme);
}
}
switch ($bootstrapTheme) {
case 'optional':
$bootstrapStyles[] = DOKU_TPL . 'assets/bootstrap/css/bootstrap.min.css';
$bootstrapStyles[] = DOKU_TPL . 'assets/bootstrap/css/bootstrap-theme.min.css';
break;
case 'custom':
$bootstrapStyles[] = $customTheme;
break;
示例14: translation_hook
/**
* Hook Callback. Change the UI language in foreign language namespaces
*/
function translation_hook(&$event, $args)
{
global $ID;
global $lang;
global $conf;
global $ACT;
// try to load language from session/cookie - stick to language selected by the user previously
if (!empty($_SESSION[DOKU_COOKIE]['translationlc'])) {
$lc = $_SESSION[DOKU_COOKIE]['translationlc'];
} else {
if (!empty(get_doku_pref('plugin_translation_lc', null))) {
$lc = get_doku_pref('plugin_translation_lc', null);
}
}
// redirect away from start page?
if (empty($lc) && $this->conf['redirectstart'] && $ID == $conf['start'] && $ACT == 'show') {
$lc = $this->helper->getBrowserLang($conf['lang']);
if (!$lc) {
$lc = $conf['lang'];
}
if ($lc != $conf['lang']) {
$_SESSION[DOKU_COOKIE]['translationlc'] = $lc;
set_doku_pref('plugin_translation_lc', $lc);
header('Location: ' . wl($lc . ':' . $conf['start'], '', true, '&'));
exit;
}
}
// check if we are in a foreign language namespace
$newLc = $this->helper->getLangPart($ID);
if (empty($newLc)) {
$lc = $conf['lang'];
} else {
if ($newLc != $lc) {
$lc = $newLc;
}
}
// store language in session (for page related views only)
if (in_array($ACT, array('show', 'recent', 'diff', 'edit', 'preview', 'source', 'subscribe'))) {
$_SESSION[DOKU_COOKIE]['translationlc'] = $lc;
set_doku_pref('plugin_translation_lc', $lc);
}
// stop. no effort is needed
if ($lc == $conf['lang']) {
return;
}
// adjust environment to the selected language
$this->locale = $lc;
if (!$this->getConf('translateui')) {
return true;
}
if (file_exists(DOKU_INC . 'inc/lang/' . $lc . '/lang.php')) {
require DOKU_INC . 'inc/lang/' . $lc . '/lang.php';
}
$conf['lang_before_translation'] = $conf['lang'];
//store for later access in syntax plugin
$conf['lang'] = $lc;
return true;
}
示例15: jQuery
<?php
/**
* DokuWiki Bootstrap3 Template: Cookie Law Banner
*
* @link http://dokuwiki.org/template:bootstrap3
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/
if ($showCookieLawBanner && !(get_doku_pref('cookieNoticeAccepted', null) || get_doku_pref('cookieNoticeAccepted', ''))) {
?>
<div id="cookieNotice" class="navbar <?php
echo $inverseNavbar ? 'navbar-inverse' : 'navbar-default';
?>
navbar-fixed-bottom">
<div class="container">
<?php
tpl_include_page($cookieLawBannerPage);
?>
<div class="navbar-right">
<button class="btn btn-primary btn-xs navbar-btn" id="cookieDismiss">OK</button>
<?php
tpl_link(wl($cookieLawPolicyPage), 'Policy', 'class="btn btn-default btn-xs navbar-btn" id="cookiePolicy"');
?>
</div>
</div>
</div>
<script type="text/javascript">
jQuery('#cookieDismiss').click(function(){
jQuery('#cookieNotice').hide();
DokuCookie.setValue('cookieNoticeAccepted', true);