本文整理汇总了PHP中useHeading函数的典型用法代码示例。如果您正苦于以下问题:PHP useHeading函数的具体用法?PHP useHeading怎么用?PHP useHeading使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了useHeading函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: ajax_qsearch
/**
* Searches for matching pagenames
*
* @author Andreas Gohr <[email protected]>
*/
function ajax_qsearch()
{
global $conf;
global $lang;
global $INPUT;
$query = $INPUT->post->str('q');
if (empty($query)) {
$query = $INPUT->get->str('q');
}
if (empty($query)) {
return;
}
$query = urldecode($query);
$data = ft_pageLookup($query, true, useHeading('navigation'));
if (!count($data)) {
return;
}
print '<strong>' . $lang['quickhits'] . '</strong>';
print '<ul>';
foreach ($data as $id => $title) {
if (useHeading('navigation')) {
$name = $title;
} else {
$ns = getNS($id);
if ($ns) {
$name = noNS($id) . ' (' . $ns . ')';
} else {
$name = $id;
}
}
echo '<li>' . html_wikilink(':' . $id, $name) . '</li>';
}
print '</ul>';
}
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:39,代码来源:ajax.php
示例2: js_out
/**
* Output all needed JavaScript
*
* @author Andreas Gohr <[email protected]>
*/
function js_out()
{
global $conf;
global $lang;
global $config_cascade;
// The generated script depends on some dynamic options
$cache = new cache('scripts' . $_SERVER['HTTP_HOST'] . $_SERVER['SERVER_PORT'], '.js');
$cache->_event = 'JS_CACHE_USE';
// load minified version for some files
$min = $conf['compress'] ? '.min' : '';
// array of core files
$files = array(DOKU_INC . "lib/scripts/jquery/jquery{$min}.js", DOKU_INC . 'lib/scripts/jquery/jquery.cookie.js', DOKU_INC . "lib/scripts/jquery/jquery-ui{$min}.js", DOKU_INC . "lib/scripts/fileuploader.js", DOKU_INC . "lib/scripts/fileuploaderextended.js", DOKU_INC . 'lib/scripts/helpers.js', DOKU_INC . 'lib/scripts/delay.js', DOKU_INC . 'lib/scripts/cookie.js', DOKU_INC . 'lib/scripts/script.js', DOKU_INC . 'lib/scripts/tw-sack.js', DOKU_INC . 'lib/scripts/qsearch.js', DOKU_INC . 'lib/scripts/tree.js', DOKU_INC . 'lib/scripts/index.js', DOKU_INC . 'lib/scripts/drag.js', DOKU_INC . 'lib/scripts/textselection.js', DOKU_INC . 'lib/scripts/toolbar.js', DOKU_INC . 'lib/scripts/edit.js', DOKU_INC . 'lib/scripts/editor.js', DOKU_INC . 'lib/scripts/locktimer.js', DOKU_INC . 'lib/scripts/linkwiz.js', DOKU_INC . 'lib/scripts/media.js', DOKU_INC . 'lib/scripts/compatibility.js', DOKU_INC . 'lib/scripts/behaviour.js', DOKU_INC . 'lib/scripts/page.js', tpl_incdir() . 'script.js');
// add possible plugin scripts and userscript
$files = array_merge($files, js_pluginscripts());
if (isset($config_cascade['userscript']['default'])) {
$files[] = $config_cascade['userscript']['default'];
}
$cache_files = array_merge($files, getConfigFiles('main'));
$cache_files[] = __FILE__;
// check cache age & handle conditional request
// This may exit if a cache can be used
$cache_ok = $cache->useCache(array('files' => $cache_files));
http_cached($cache->cache, $cache_ok);
// start output buffering and build the script
ob_start();
// add some global variables
print "var DOKU_BASE = '" . DOKU_BASE . "';";
print "var DOKU_TPL = '" . tpl_basedir() . "';";
// FIXME: Move those to JSINFO
print "var DOKU_UHN = " . (int) useHeading('navigation') . ";";
print "var DOKU_UHC = " . (int) useHeading('content') . ";";
// load JS specific translations
$json = new JSON();
$lang['js']['plugins'] = js_pluginstrings();
echo 'LANG = ' . $json->encode($lang['js']) . ";\n";
// load toolbar
toolbar_JSdefines('toolbar');
// load files
foreach ($files as $file) {
echo "\n\n/* XXXXXXXXXX begin of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
js_load($file);
echo "\n\n/* XXXXXXXXXX end of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
}
// init stuff
if ($conf['locktime'] != 0) {
js_runonstart("dw_locktimer.init(" . ($conf['locktime'] - 60) . "," . $conf['usedraft'] . ")");
}
// init hotkeys - must have been done after init of toolbar
# disabled for FS#1958 js_runonstart('initializeHotkeys()');
// end output buffering and get contents
$js = ob_get_contents();
ob_end_clean();
// compress whitespace and comments
if ($conf['compress']) {
$js = js_compress($js);
}
$js .= "\n";
// https://bugzilla.mozilla.org/show_bug.cgi?id=316033
http_cached_finish($cache->cache, $js);
}
开发者ID:nextghost,项目名称:dokuwiki,代码行数:65,代码来源:js.php
示例3: ajax_qsearch
/**
* Searches for matching pagenames
*
* @author Andreas Gohr <[email protected]>
*/
function ajax_qsearch()
{
global $conf;
global $lang;
$query = $_POST['q'];
if (empty($query)) {
$query = $_GET['q'];
}
if (empty($query)) {
return;
}
$data = ft_pageLookup($query, true, useHeading('navigation'));
if (!count($data)) {
return;
}
print '<strong>' . $lang['quickhits'] . '</strong>';
print '<ul>';
foreach ($data as $id => $title) {
if (useHeading('navigation')) {
$name = $title;
} else {
$ns = getNS($id);
if ($ns) {
$name = shorten(noNS($id), ' (' . $ns . ')', 30);
} else {
$name = $id;
}
}
echo '<li>' . html_wikilink(':' . $id, $name) . '</li>';
}
print '</ul>';
}
开发者ID:stretchyboy,项目名称:dokuwiki,代码行数:37,代码来源:ajax.php
示例4: getSiteTitle
/**
* get the Title for the page
**/
public function getSiteTitle($ID)
{
if (useHeading('content') && $ID) {
$heading = p_get_first_heading($ID, true);
if ($heading) {
return $this->xmlEntities($heading);
}
}
return ucwords($this->xmlEntities(array_pop(explode(':', $ID))));
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:13,代码来源:functions.php
示例5: render
function render($mode, &$R, &$T, $value, $hint)
{
$heading = null;
// only use heading if allowed by configuration
if (useHeading('content')) {
$titles = $T->fetchTriples($value, $this->util->getTitleKey());
if ($titles) {
$heading = $titles[0]['object'];
}
}
// render internal link
// (':' is prepended to make sure we use an absolute pagename,
// internallink resolves page names, but the name is already resolved.)
$R->internallink(':' . $value, $heading);
}
开发者ID:virk,项目名称:dokuwiki-strata,代码行数:15,代码来源:ref.php
示例6: ajax_qsearch
/**
* Searches for matching pagenames
*
* @author Andreas Gohr <[email protected]>
*/
function ajax_qsearch()
{
global $lang;
global $INPUT;
$maxnumbersuggestions = 50;
$query = $INPUT->post->str('q');
if (empty($query)) {
$query = $INPUT->get->str('q');
}
if (empty($query)) {
return;
}
$query = urldecode($query);
$data = ft_pageLookup($query, true, useHeading('navigation'));
if (!count($data)) {
return;
}
print '<strong>' . $lang['quickhits'] . '</strong>';
print '<ul>';
$counter = 0;
foreach ($data as $id => $title) {
if (useHeading('navigation')) {
$name = $title;
} else {
$ns = getNS($id);
if ($ns) {
/* Displays the Header of the Namespace-Page or of namespace:start as the Name of the NS */
$ns_name = p_get_first_heading(getNS($id));
if (!$ns_name) {
$ns_name = p_get_first_heading(getNS($id) . ':start');
}
$name = shorten(' [' . $ns_name . ']', 30);
} else {
$name = $id;
}
}
echo '<li>' . html_wikilink(':' . $id, $name) . '</li>';
$counter++;
if ($counter > $maxnumbersuggestions) {
echo '<li>...</li>';
break;
}
}
print '</ul>';
}
开发者ID:s-blu,项目名称:dokuwiki,代码行数:50,代码来源:ajax.php
示例7: _custom_delete_page
function _custom_delete_page($id, $summary)
{
global $ID, $INFO, $conf;
// mark as nonexist to prevent indexerWebBug
if ($id == $ID) {
$INFO['exists'] = 0;
}
// delete page, meta and attic
$file = wikiFN($id);
$old = @filemtime($file);
// from page
if (file_exists($file)) {
unlink($file);
}
$opts['oldname'] = $this->_FN(noNS($id));
$opts['oldns'] = $this->_FN(getNS($id));
if ($opts['oldns']) {
$opts['oldns'] .= '/';
}
$this->_locate_filepairs($opts, 'metadir', '/^' . $opts['oldname'] . '\\.(?!mlist)\\w*?$/');
$this->_locate_filepairs($opts, 'olddir', '/^' . $opts['oldname'] . '\\.\\d{10}\\.txt(\\.gz|\\.bz2)?$/');
$this->_apply_deletes($opts);
io_sweepNS($id, 'datadir');
io_sweepNS($id, 'metadir');
io_sweepNS($id, 'olddir');
// send notify mails
notify($id, 'admin', $old, $summary);
notify($id, 'subscribers', $old, $summary);
// update the purgefile (timestamp of the last time anything within the wiki was changed)
io_saveFile($conf['cachedir'] . '/purgefile', time());
// if useheading is enabled, purge the cache of all linking pages
if (useHeading('content')) {
$pages = ft_backlinks($id);
foreach ($pages as $page) {
$cache = new cache_renderer($page, wikiFN($page), 'xhtml');
$cache->removeCache();
}
}
}
开发者ID:houshuang,项目名称:folders2web,代码行数:39,代码来源:action.php
示例8: js_out
/**
* Output all needed JavaScript
*
* @author Andreas Gohr <[email protected]>
*/
function js_out()
{
global $conf;
global $lang;
global $config_cascade;
// The generated script depends on some dynamic options
$cache = getCacheName('scripts' . $_SERVER['HTTP_HOST'] . $_SERVER['SERVER_PORT'], '.js');
// array of core files
$files = array(DOKU_INC . 'lib/scripts/helpers.js', DOKU_INC . 'lib/scripts/events.js', DOKU_INC . 'lib/scripts/delay.js', DOKU_INC . 'lib/scripts/cookie.js', DOKU_INC . 'lib/scripts/script.js', DOKU_INC . 'lib/scripts/tw-sack.js', DOKU_INC . 'lib/scripts/ajax.js', DOKU_INC . 'lib/scripts/index.js', DOKU_INC . 'lib/scripts/drag.js', DOKU_INC . 'lib/scripts/textselection.js', DOKU_INC . 'lib/scripts/toolbar.js', DOKU_INC . 'lib/scripts/edit.js', DOKU_INC . 'lib/scripts/linkwiz.js', DOKU_INC . 'lib/scripts/media.js', DOKU_INC . 'lib/scripts/subscriptions.js', DOKU_TPLINC . 'script.js');
// add possible plugin scripts and userscript
$files = array_merge($files, js_pluginscripts());
if (isset($config_cascade['userscript']['default'])) {
$files[] = $config_cascade['userscript']['default'];
}
// check cache age & handle conditional request
header('Cache-Control: public, max-age=3600');
header('Pragma: public');
if (js_cacheok($cache, $files)) {
http_conditionalRequest(filemtime($cache));
if ($conf['allowdebug']) {
header("X-CacheUsed: {$cache}");
}
// finally send output
if ($conf['gzip_output'] && http_gzip_valid($cache)) {
header('Vary: Accept-Encoding');
header('Content-Encoding: gzip');
readfile($cache . ".gz");
} else {
if (!http_sendfile($cache)) {
readfile($cache);
}
}
return;
} else {
http_conditionalRequest(time());
}
// start output buffering and build the script
ob_start();
// add some global variables
print "var DOKU_BASE = '" . DOKU_BASE . "';";
print "var DOKU_TPL = '" . DOKU_TPL . "';";
print "var DOKU_UHN = " . (int) useHeading('navigation') . ";";
print "var DOKU_UHC = " . (int) useHeading('content') . ";";
// load JS specific translations
$json = new JSON();
$lang['js']['plugins'] = js_pluginstrings();
echo 'LANG = ' . $json->encode($lang['js']) . ";\n";
// load toolbar
toolbar_JSdefines('toolbar');
// load files
foreach ($files as $file) {
echo "\n\n/* XXXXXXXXXX begin of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
js_load($file);
echo "\n\n/* XXXXXXXXXX end of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
}
// init stuff
js_runonstart("addEvent(document,'click',closePopups)");
js_runonstart('addTocToggle()');
js_runonstart("initSizeCtl('size__ctl','wiki__text')");
js_runonstart("initToolbar('tool__bar','wiki__text',toolbar)");
if ($conf['locktime'] != 0) {
js_runonstart("locktimer.init(" . ($conf['locktime'] - 60) . ",'" . js_escape($lang['willexpire']) . "'," . $conf['usedraft'] . ")");
}
js_runonstart('scrollToMarker()');
js_runonstart('focusMarker()');
// init hotkeys - must have been done after init of toolbar
# disabled for FS#1958 js_runonstart('initializeHotkeys()');
// end output buffering and get contents
$js = ob_get_contents();
ob_end_clean();
// compress whitespace and comments
if ($conf['compress']) {
$js = js_compress($js);
}
$js .= "\n";
// https://bugzilla.mozilla.org/show_bug.cgi?id=316033
// save cache file
io_saveFile($cache, $js);
if (function_exists('gzopen')) {
io_saveFile("{$cache}.gz", $js);
}
// finally send output
if ($conf['gzip_output']) {
header('Vary: Accept-Encoding');
header('Content-Encoding: gzip');
print gzencode($js, 9, FORCE_GZIP);
} else {
print $js;
}
}
开发者ID:ryankask,项目名称:dokuwiki,代码行数:95,代码来源:js.php
示例9: search
/**
* List all pages in the given namespace (and below)
*/
function search($query)
{
$regex = '';
$data = ft_pageSearch($query, $regex);
$pages = array();
// prepare additional data
$idx = 0;
foreach ($data as $id => $score) {
$file = wikiFN($id);
if ($idx < FT_SNIPPET_NUMBER) {
$snippet = ft_snippet($id, $regex);
$idx++;
} else {
$snippet = '';
}
$pages[] = array('id' => $id, 'score' => intval($score), 'rev' => filemtime($file), 'mtime' => filemtime($file), 'size' => filesize($file), 'snippet' => $snippet, 'title' => useHeading('navigation') ? p_get_first_heading($id) : $id);
}
return $pages;
}
开发者ID:neosunchess,项目名称:dokuwiki,代码行数:22,代码来源:RemoteAPICore.php
示例10: tpl_pagetitle
/**
* Prints or returns the name of the given page (current one if none given).
*
* If useheading is enabled this will use the first headline else
* the given ID is used.
*
* @author Andreas Gohr <[email protected]>
*
* @param string $id page id
* @param bool $ret return content instead of printing
* @return bool|string
*/
function tpl_pagetitle($id = null, $ret = false)
{
global $ACT, $INPUT, $conf, $lang;
if (is_null($id)) {
global $ID;
$id = $ID;
}
$name = $id;
if (useHeading('navigation')) {
$first_heading = p_get_first_heading($id);
if ($first_heading) {
$name = $first_heading;
}
}
// default page title is the page name, modify with the current action
switch ($ACT) {
// admin functions
case 'admin':
$page_title = $lang['btn_admin'];
// try to get the plugin name
/** @var $plugin DokuWiki_Admin_Plugin */
if ($plugin = plugin_getRequestAdminPlugin()) {
$plugin_title = $plugin->getMenuText($conf['lang']);
$page_title = $plugin_title ? $plugin_title : $plugin->getPluginName();
}
break;
// user functions
// user functions
case 'login':
case 'profile':
case 'register':
case 'resendpwd':
$page_title = $lang['btn_' . $ACT];
break;
// wiki functions
// wiki functions
case 'search':
case 'index':
$page_title = $lang['btn_' . $ACT];
break;
// page functions
// page functions
case 'edit':
$page_title = "✎ " . $name;
break;
case 'revisions':
$page_title = $name . ' - ' . $lang['btn_revs'];
break;
case 'backlink':
case 'recent':
case 'subscribe':
$page_title = $name . ' - ' . $lang['btn_' . $ACT];
break;
default:
// SHOW and anything else not included
$page_title = $name;
}
if ($ret) {
return hsc($page_title);
} else {
print hsc($page_title);
return true;
}
}
开发者ID:RnBConsulting,项目名称:dokuwiki,代码行数:76,代码来源:template.php
示例11: _getLinkTitle
/**
* Construct a title and handle images in titles
*
* @author Harry Fuecks <[email protected]>
*/
function _getLinkTitle($title, $default, $id = NULL)
{
global $conf;
$isImage = false;
if (is_null($title)) {
if (useHeading('content') && $id) {
$heading = p_get_first_heading($id, false);
if ($heading) {
return $heading;
}
}
return $default;
} else {
if (is_string($title)) {
return $title;
} else {
if (is_array($title)) {
return '[' . $title['title'] . ']';
}
}
}
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:27,代码来源:metadata.php
示例12: bootstrap3_conf
/**
* Simple wrapper for tpl_getConf
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @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;
}
开发者ID:vierbergenlars,项目名称:dokuwiki-template-bootstrap3,代码行数:71,代码来源:tpl_functions.php
示例13: handle_tpl_act_render
public function handle_tpl_act_render(&$event, $param)
{
global $ID, $ACT;
if ($ACT != 'show' && $ACT != '') {
return;
}
if (!$this->getConf('show_note')) {
return;
}
if (isset($_GET['redirect']) && $_GET['redirect'] > 0 && $_GET['redirect'] < 6) {
if (isset($_SESSION[DOKU_COOKIE]['redirect']) && $_SESSION[DOKU_COOKIE]['redirect'] != '') {
// we were redirected from another page, show it!
$page = cleanID($_SESSION[DOKU_COOKIE]['redirect']);
$title = hsc(useHeading('navigation') && p_get_first_heading($page) ? p_get_first_heading($page) : $page);
echo '<div class="noteredirect">' . sprintf($this->getLang('redirected_from'), '<a href="' . wl(':' . $page, array('redirect' => 'no'), TRUE, '&') . '" class="wikilink1" title="' . $page . '">' . $title . '</a>') . '</div><br/>';
unset($_SESSION[DOKU_COOKIE]['redirect']);
return true;
}
}
return true;
}
开发者ID:phillip-hopper,项目名称:dokuwiki-plugin-pageredirect,代码行数:21,代码来源:action.php
示例14: _resolveData
/**
* Resolve a value according to its column settings
*
* This function is registered as a SQL function named DATARESOLVE
*/
function _resolveData($value, $colname)
{
// resolve pre and postfixes
$column = $this->_column($colname);
$value = $this->_addPrePostFixes($column['type'], $value);
// for pages, resolve title
$type = $column['type'];
if (is_array($type)) {
$type = $type['type'];
}
if ($type == 'title' || $type == 'page' && useHeading('content')) {
$value = p_get_first_heading($value);
}
return $value;
}
开发者ID:rsnitsch,项目名称:dokuwiki-plugin-data,代码行数:20,代码来源:helper.php
示例15: tpl_pageName
function tpl_pageName($id)
{
// page names
$name = noNSorNS($id);
if (useHeading('navigation')) {
// get page title
$title = p_get_first_heading($id, METADATA_RENDER_USING_SIMPLE_CACHE);
if ($title) {
$name = $title;
}
}
return $name;
}
开发者ID:alanthonyc,项目名称:dokuwiki-template-bootie,代码行数:13,代码来源:tpl_template_NicoBoot.php
示例16: _list
/**
* List recent edits matching the given filter
*/
function _list($filter)
{
global $conf;
global $lang;
echo '<hr /><br />';
echo '<form action="" method="post"><div class="no">';
echo '<input type="hidden" name="filter" value="' . hsc($filter) . '" />';
formSecurityToken();
$recents = getRecents(0, $this->max_lines);
echo '<ul>';
$cnt = 0;
foreach ($recents as $recent) {
if ($filter) {
if (strpos(rawWiki($recent['id']), $filter) === false) {
continue;
}
}
$cnt++;
$date = strftime($conf['dformat'], $recent['date']);
echo $recent['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT ? '<li class="minor">' : '<li>';
echo '<div class="li">';
echo '<input type="checkbox" name="revert[]" value="' . hsc($recent['id']) . '" checked="checked" id="revert__' . $cnt . '" />';
echo '<label for="revert__' . $cnt . '">' . $date . '</label> ';
echo '<a href="' . wl($recent['id'], "do=diff") . '">';
$p = array();
$p['src'] = DOKU_BASE . 'lib/images/diff.png';
$p['width'] = 15;
$p['height'] = 11;
$p['title'] = $lang['diff'];
$p['alt'] = $lang['diff'];
$att = buildAttributes($p);
echo "<img {$att} />";
echo '</a> ';
echo '<a href="' . wl($recent['id'], "do=revisions") . '">';
$p = array();
$p['src'] = DOKU_BASE . 'lib/images/history.png';
$p['width'] = 12;
$p['height'] = 14;
$p['title'] = $lang['btn_revs'];
$p['alt'] = $lang['btn_revs'];
$att = buildAttributes($p);
echo "<img {$att} />";
echo '</a> ';
echo html_wikilink(':' . $recent['id'], useHeading('navigation') ? NULL : $recent['id']);
echo ' – ' . htmlspecialchars($recent['sum']);
echo ' <span class="user">';
echo $recent['user'] . ' ' . $recent['ip'];
echo '</span>';
echo '</div>';
echo '</li>';
@set_time_limit(10);
flush();
}
echo '</ul>';
echo '<p>';
echo '<input type="submit" class="button" value="' . $this->getLang('revert') . '" /> ';
printf($this->getLang('note2'), hsc($filter));
echo '</p>';
echo '</div></form>';
}
开发者ID:nextghost,项目名称:dokuwiki,代码行数:63,代码来源:admin.php
示例17: js_out
/**
* Output all needed JavaScript
*
* @author Andreas Gohr <[email protected]>
*/
function js_out()
{
global $conf;
global $lang;
global $config_cascade;
global $INPUT;
// decide from where to get the template
$tpl = trim(preg_replace('/[^\\w-]+/', '', $INPUT->str('t')));
if (!$tpl) {
$tpl = $conf['template'];
}
// The generated script depends on some dynamic options
$cache = new cache('scripts' . $_SERVER['HTTP_HOST'] . $_SERVER['SERVER_PORT'] . DOKU_BASE . $tpl, '.js');
$cache->_event = 'JS_CACHE_USE';
// load minified version for some files
$min = $conf['compress'] ? '.min' : '';
// array of core files
$files = array(DOKU_INC . "lib/scripts/jquery/jquery{$min}.js", DOKU_INC . 'lib/scripts/jquery/jquery.cookie.js', DOKU_INC . "lib/scripts/jquery/jquery-ui{$min}.js", DOKU_INC . "lib/scripts/jquery/jquery-migrate{$min}.js", DOKU_INC . 'inc/lang/' . $conf['lang'] . '/jquery.ui.datepicker.js', DOKU_INC . "lib/scripts/fileuploader.js", DOKU_INC . "lib/scripts/fileuploaderextended.js", DOKU_INC . 'lib/scripts/helpers.js', DOKU_INC . 'lib/scripts/delay.js', DOKU_INC . 'lib/scripts/cookie.js', DOKU_INC . 'lib/scripts/script.js', DOKU_INC . 'lib/scripts/qsearch.js', DOKU_INC . 'lib/scripts/tree.js', DOKU_INC . 'lib/scripts/index.js', DOKU_INC . 'lib/scripts/textselection.js', DOKU_INC . 'lib/scripts/toolbar.js', DOKU_INC . 'lib/scripts/edit.js', DOKU_INC . 'lib/scripts/editor.js', DOKU_INC . 'lib/scripts/locktimer.js', DOKU_INC . 'lib/scripts/linkwiz.js', DOKU_INC . 'lib/scripts/media.js', DOKU_INC . 'lib/scripts/compatibility.js', DOKU_INC . 'lib/scripts/behaviour.js', DOKU_INC . 'lib/scripts/page.js', tpl_incdir($tpl) . 'script.js');
// add possible plugin scripts and userscript
$files = array_merge($files, js_pluginscripts());
if (!empty($config_cascade['userscript']['default'])) {
foreach ($config_cascade['userscript']['default'] as $userscript) {
$files[] = $userscript;
}
}
$cache_files = array_merge($files, getConfigFiles('main'));
$cache_files[] = __FILE__;
// check cache age & handle conditional request
// This may exit if a cache can be used
$cache_ok = $cache->useCache(array('files' => $cache_files));
http_cached($cache->cache, $cache_ok);
// start output buffering and build the script
ob_start();
$json = new JSON();
// add some global variables
print "var DOKU_BASE = '" . DOKU_BASE . "';";
print "var DOKU_TPL = '" . tpl_basedir($tpl) . "';";
print "var DOKU_COOKIE_PARAM = " . $json->encode(array('path' => empty($conf['cookiedir']) ? DOKU_REL : $conf['cookiedir'], 'secure' => $conf['securecookie'] && is_ssl())) . ";";
// FIXME: Move those to JSINFO
print "var DOKU_UHN = " . (int) useHeading('navigation') . ";";
print "var DOKU_UHC = " . (int) useHeading('content') . ";";
// load JS specific translations
$lang['js']['plugins'] = js_pluginstrings();
$templatestrings = js_templatestrings($tpl);
if (!empty($templatestrings)) {
$lang['js']['template'] = $templatestrings;
}
echo 'LANG = ' . $json->encode($lang['js']) . ";\n";
// load toolbar
toolbar_JSdefines('toolbar');
// load files
foreach ($files as $file) {
if (!file_exists($file)) {
continue;
}
$ismin = substr($file, -7) == '.min.js';
$debugjs = $conf['allowdebug'] && strpos($file, DOKU_INC . 'lib/scripts/') !== 0;
echo "\n\n/* XXXXXXXXXX begin of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
if ($ismin) {
echo "\n/* BEGIN NOCOMPRESS */\n";
}
if ($debugjs) {
echo "\ntry {\n";
}
js_load($file);
if ($debugjs) {
echo "\n} catch (e) {\n logError(e, '" . str_replace(DOKU_INC, '', $file) . "');\n}\n";
}
if ($ismin) {
echo "\n/* END NOCOMPRESS */\n";
}
echo "\n\n/* XXXXXXXXXX end of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
}
// init stuff
if ($conf['locktime'] != 0) {
js_runonstart("dw_locktimer.init(" . ($conf['locktime'] - 60) . "," . $conf['usedraft'] . ")");
}
// init hotkeys - must have been done after init of toolbar
# disabled for FS#1958 js_runonstart('initializeHotkeys()');
// end output buffering and get contents
$js = ob_get_contents();
ob_end_clean();
// strip any source maps
stripsourcemaps($js);
// compress whitespace and comments
if ($conf['compress']) {
$js = js_compress($js);
}
$js .= "\n";
// https://bugzilla.mozilla.org/show_bug.cgi?id=316033
http_cached_finish($cache->cache, $js);
}
开发者ID:kerryyao,项目名称:dokuwiki,代码行数:97,代码来源:js.php
示例18: tpl_arctic_mbo_pagename
function tpl_arctic_mbo_pagename($sep = ' » ')
{
global $conf;
global $ID;
global $lang;
$parts = explode(':', $ID);
$count = count($parts);
if ($GLOBALS['ACT'] == 'search') {
$parts = array($conf['start']);
$count = 1;
}
// always print the site title
tpl_link(wl(), $conf['title'], 'name="dokuwiki__top" id="dokuwiki__top" title="' . $conf['start'] . '"');
// print intermediate namespace links
$part = '';
for ($i = 0; $i < $count - 1; $i++) {
$part .= $parts[$i] . ':';
$page = $part;
resolve_pageid('', $page, $exists);
if ($page == $conf['start']) {
continue;
}
// Skip startpage
// output
echo $sep;
if ($exists && auth_quickaclcheck($page) >= AUTH_READ) {
$title = useHeading('navigation') ? p_get_first_heading($page) : $parts[$i];
tpl_link(wl($page), hsc($title), 'title="' . $page . '"');
} else {
tpl_link(wl($page), $parts[$i], 'title="' . $page . '" class="wikilink2" rel="nofollow"');
}
}
// print current page, skipping start page, skipping for namespace index
if (isset($page) && $page == $part . $parts[$i]) {
return;
}
$page = $part . $parts[$i];
if ($page == $conf['start']) {
return;
}
echo $sep;
if (page_exists($page) && auth_quickaclcheck($page) >= AUTH_READ) {
$title = useHeading('navigation') ? p_get_first_heading($page) : $parts[$i];
tpl_link(wl($page), hsc($title), 'title="' . $page . '"');
} else {
tpl_link(wl($page), $parts[$i], 'title="' . $page . '" class="wikilink2" rel="nofollow"');
}
return true;
}
开发者ID:xudianyang,项目名称:wiki.phpboy.net,代码行数:49,代码来源:tpl_functions.php
示例19: saveWikiText
//.........这里部分代码省略.........
after any changes. External edits change the wiki page
directly without using php or dokuwiki.
*/
global $conf;
global $lang;
global $REV;
/* @var Input $INPUT */
global $INPUT;
// prepare data for event
$svdta = array();
$svdta['id'] = $id;
$svdta['file'] = wikiFN($id);
$svdta['revertFrom'] = $REV;
$svdta['oldRevision'] = @filemtime($svdta['file']);
$svdta['newRevision'] = 0;
$svdta['newContent'] = $text;
$svdta['oldContent'] = rawWiki($id);
$svdta['summary'] = $summary;
$svdta['contentChanged'] = $svdta['newContent'] != $svdta['oldContent'];
$svdta['changeInfo'] = '';
$svdta['changeType'] = DOKU_CHANGE_TYPE_EDIT;
$svdta['sizechange'] = null;
// select changelog line type
if ($REV) {
$svdta['changeType'] = DOKU_CHANGE_TYPE_REVERT;
$svdta['changeInfo'] = $REV;
} else {
if (!file_exists($svdta['file'])) {
$svdta['changeType'] = DOKU_CHANGE_TYPE_CREATE;
} else {
if (trim($text) == '') {
// empty or whitespace only content deletes
$svdta['changeType'] = DOKU_CHANGE_TYPE_DELETE;
// autoset summary on deletion
if (blank($svdta['summary'])) {
$svdta['summary'] = $lang['deleted'];
}
} else {
if ($minor && $conf['useacl'] && $INPUT->server->str('REMOTE_USER')) {
//minor edits only for logged in users
$svdta['changeType'] = DOKU_CHANGE_TYPE_MINOR_EDIT;
}
}
}
}
$event = new Doku_Event('COMMON_WIKIPAGE_SAVE', $svdta);
if (!$event->advise_before()) {
return;
}
// if the content has not been changed, no save happens (plugins may override this)
if (!$svdta['contentChanged']) {
return;
}
detectExternalEdit($id);
if ($svdta['changeType'] == DOKU_CHANGE_TYPE_CREATE || $svdta['changeType'] == DOKU_CHANGE_TYPE_REVERT && !file_exists($svdta['file'])) {
$filesize_old = 0;
} else {
$filesize_old = filesize($svdta['file']);
}
if ($svdta['changeType'] == DOKU_CHANGE_TYPE_DELETE) {
// Send "update" event with empty data, so plugins can react to page deletion
$data = array(array($svdta['file'], '', false), getNS($id), noNS($id), false);
trigger_event('IO_WIKIPAGE_WRITE', $data);
// pre-save deleted revision
@touch($svdta['file']);
clearstatcache();
$data['newRevision'] = saveOldRevision($id);
// remove empty file
@unlink($svdta['file']);
$filesize_new = 0;
// don't remove old meta info as it should be saved, plugins can use IO_WIKIPAGE_WRITE for removing their metadata...
// purge non-persistant meta data
p_purge_metadata($id);
// remove empty namespaces
io_sweepNS($id, 'datadir');
io_sweepNS($id, 'mediadir');
} else {
// save file (namespace dir is created in io_writeWikiPage)
io_writeWikiPage($svdta['file'], $svdta['newContent'], $id);
// pre-save the revision, to keep the attic in sync
$svdta['newRevision'] = saveOldRevision($id);
$filesize_new = filesize($svdta['file']);
}
$svdta['sizechange'] = $filesize_new - $filesize_old;
$event->advise_after();
addLogEntry($svdta['newRevision'], $svdta['id'], $svdta['changeType'], $svdta['summary'], $svdta['changeInfo'], null, $svdta['sizechange']);
// send notify mails
notify($svdta['id'], 'admin', $svdta['oldRevision'], $svdta['summary'], $minor);
notify($svdta['id'], 'subscribers', $svdta['oldRevision'], $svdta['summary'], $minor);
// update the purgefile (timestamp of the last time anything within the wiki was changed)
io_saveFile($conf['cachedir'] . '/purgefile', time());
// if useheading is enabled, purge the cache of all linking pages
if (useHeading('content')) {
$pages = ft_backlinks($id, true);
foreach ($pages as $page) {
$cache = new cache_renderer($page, wikiFN($page), 'xhtml');
$cache->removeCache();
}
}
}
开发者ID:splitbrain,项目名称:dokuwiki,代码行数:101,代码来源:common.php
示例20: _resolveData
/**
* Resolve a value according to its column settings
*
* This function is registered as a SQL function named DATARESOLVE
*/
function _resolveData($value, $colname)
{
// resolve pre and postfixes
$column = $t
|
请发表评论