本文整理汇总了PHP中wikiFN函数的典型用法代码示例。如果您正苦于以下问题:PHP wikiFN函数的具体用法?PHP wikiFN怎么用?PHP wikiFN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wikiFN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle_ajax_call
public function handle_ajax_call()
{
global $INPUT;
header('Content-Type: text/plain');
$langCode = $INPUT->str('lang');
$text = $INPUT->str('text');
$dir = DOKU_CONF . 'lang/' . $langCode;
$file = $dir . '/register.txt';
// make sure the directory exists
if (!file_exists($dir)) {
if (mkdir($dir, 0755) === false) {
echo $this->getLang('makeDirError');
return;
}
}
// save the file
if (file_put_contents($file, $text) === false) {
echo $this->getLang('saveFileError');
return;
}
// set file permissions
chmod($file, 0644);
// log the change
$timestamp = time();
$id = $langCode . ':register';
addLogEntry($timestamp, $id);
// save this revision in the attic
$atticFile = wikiFN($id, $timestamp, true);
io_saveFile($atticFile, $text, false);
// send OK to the browser
echo 'OK';
}
示例2: pagefromtemplate
function pagefromtemplate(&$event, $param)
{
if (strlen(trim($_REQUEST['newpagetemplate'])) > 0) {
global $conf;
global $INFO;
global $ID;
$tpl = io_readFile(wikiFN($_REQUEST['newpagetemplate']));
if ($this->getConf('userreplace')) {
$stringvars = array_map(create_function('$v', 'return explode(",",$v,2);'), explode(';', $_REQUEST['newpagevars']));
foreach ($stringvars as $value) {
$tpl = str_replace(trim($value[0]), trim($value[1]), $tpl);
}
}
if ($this->getConf('standardreplace')) {
// replace placeholders
$file = noNS($ID);
$page = strtr($file, '_', ' ');
$tpl = str_replace(array('@ID@', '@NS@', '@FILE@', '@!FILE@', '@!FILE!@', '@PAGE@', '@!PAGE@', '@!!PAGE@', '@!PAGE!@', '@USER@', '@NAME@', '@MAIL@', '@DATE@'), array($ID, getNS($ID), $file, utf8_ucfirst($file), utf8_strtoupper($file), $page, utf8_ucfirst($page), utf8_ucwords($page), utf8_strtoupper($page), $_SERVER['REMOTE_USER'], $INFO['userinfo']['name'], $INFO['userinfo']['mail'], $conf['dformat']), $tpl);
// we need the callback to work around strftime's char limit
$tpl = preg_replace_callback('/%./', create_function('$m', 'return strftime($m[0]);'), $tpl);
}
$event->result = $tpl;
$event->preventDefault();
}
}
示例3: _getMenu
function _getMenu($menu, $edit)
{
global $conf, $ID, $REV, $INFO, $lang;
$currID = false;
// Remember $ID and $REV
$svID = $ID;
$svREV = $REV;
// Parent side ID
$sub = substr($ID, 0, strpos($ID, ":"));
$menuOutput = "";
if (file_exists(wikiFN($ID . "/" . $menu))) {
$menuOutput = p_wiki_xhtml($ID . "/" . $menu, '', false);
$currID = $ID;
$menuID = $currID . ":" . $menu;
} else {
if (file_exists(wikiFN($sub . "/" . $menu))) {
$menuOutput = p_wiki_xhtml($sub . "/" . $menu, '', false);
$currID = $sub;
$menuID = $currID . ":" . $menu;
}
}
if ($INFO['perm'] > AUTH_READ && true == $edit) {
$menuOutput = '<ul><li><a href="?id=' . $menuID . '&do=edit" class="wikilink1" title="Edit Menu"><b>Edit Menu</b></a></li></ul>';
}
$ID = $svID;
$REV = $svREV;
return $menuOutput;
}
示例4: action_randompage
function action_randompage(&$event, $args)
{
global $conf;
global $ID;
$data = array();
$dir = $conf['savedir'];
$data = file($dir . '/index/page.idx');
//We loops through ten random page...
$i = 1;
while ($i <= 10 & $i != "ok") {
//echo $i;
$i++;
$id = rtrim($data[array_rand($data, 1)]);
$testACL = auth_aclcheck($id, $_SERVER['REMOTE_USER'], $USERINFO['grps']);
if ($testACL > 1 and file_exists(wikiFN($id))) {
$i = "ok";
//echo $id;
}
}
if ($testACL < 1) {
$id = $ID;
}
header("Location: " . wl($id, '', true));
//echo wl($page,'',true);
exit;
}
示例5: document_start
function document_start()
{
global $ID;
if (!@file_exists(wikiFN($ID))) {
$this->persistent['date']['created'] = time();
}
parent::document_start();
}
示例6: getAllPages
function getAllPages()
{
$namespace = $this->getConf("translationns");
$dir = dirname(wikiFN("{$namespace}:foo"));
$pages = array();
search($pages, $dir, 'search_allpages', array());
return $pages;
}
示例7: get_epub
function get_epub($event, $param)
{
global $ID;
global $USERINFO;
if (!isset($USERINFO)) {
return;
}
$user = $USERINFO['name'];
global $ACT;
global $INFO;
if ($ACT != 'show') {
return;
}
if (!$this->helper) {
$this->helper = $this->loadHelper('epub', true);
}
if (!$this->helper->is_inCache($INFO['id'])) {
return;
}
//cache set in syntax.php
if (strpos($INFO['id'], 'epub') === false) {
return;
}
$wiki_file = wikiFN($INFO['id']);
if (!@file_exists($wiki_file)) {
return;
}
$epub_group = $this->getConf('group');
$groups = $USERINFO['grps'];
$auth = auth_quickaclcheck('epub:*');
if ($auth < 8 && !in_array($epub_group, $groups)) {
return;
}
$auth = auth_quickaclcheck($INFO['id']);
if ($auth < 4) {
return;
}
$client = $INFO['client'];
$button_name = $this->getLang('button_start');
//"Start"; //$this->getLang('btn_generate');
$button = "<form class='button'>";
$button .= "<div class='no' id='show_throbberbutton'><input type='button' value='{$button_name}' class='button' title='start' onclick=\"_epub_show_throbber('{$user}','{$client}');\"/>";
$button .= " ";
$button .= $this->getLang('label_start');
//"Click the Start Button to Create your eBook";
$button .= "</div></form>";
echo $button;
$id = $INFO['id'];
$button_name = $this->getLang('button_remove');
$button = "<p><form class='button'>";
$button .= "<div class='no' id='epub_remove_button'><input type='button' value='{$button_name}' class='button' title='start' onclick=\"epub_remove_creator('{$id}');\"/></div></form>";
$button .= '</br>' . $this->locale_xhtml('remove') . '</p>';
echo $button;
}
示例8: test_futurerev
/**
* test a future revision
*
*/
function test_futurerev()
{
$rev = 1385051947;
$revsexpected = '';
//set a known timestamp
touch(wikiFN($this->pageid), $rev);
$rev += 1;
$pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192);
$revs = $pagelog->getLastRevisionAt($rev);
$this->assertEquals($revsexpected, $revs);
}
示例9: cleanPage
protected function cleanPage($pageId)
{
$filename = wikiFN($pageId);
if (!file_exists($filename)) {
throw new \Exception('Cannot delete page. It does not exist');
}
$this->logger('delete', $filename);
unlink($filename);
$this->logger('sweepNS', '[datadir]');
io_sweepNS($pageId, 'datadir');
}
示例10: test_rename_to_new_page
function test_rename_to_new_page()
{
$newid = 'new_id_1';
$oldpid = $this->indexer->getPID($this->old_id);
$this->assertTrue($this->indexer->renamePage($this->old_id, $newid), 'Renaming the page to a new id failed');
io_rename(wikiFN($this->old_id), wikiFN($newid));
$this->assertNotEquals($this->indexer->getPID($this->old_id), $oldpid, 'PID for the old page unchanged after rename.');
$this->assertEquals($this->indexer->getPID($newid), $oldpid, 'New page has not the old pid.');
$query = array('old');
$this->assertEquals(array('old' => array($newid => 1)), $this->indexer->lookup($query), '"Old" doesn\'t find the new page');
}
示例11: get_template
/**
* Handler to load page template.
*
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* handler was registered]
* @return void
*/
public function get_template(Doku_Event &$event, $param)
{
if (strlen($_REQUEST['copyfrom']) > 0) {
$template_id = $_REQUEST['copyfrom'];
if (auth_quickaclcheck($template_id) >= AUTH_READ) {
$tpl = io_readFile(wikiFN($template_id));
$event->data['tpl'] = $tpl;
$event->preventDefault();
}
}
}
示例12: indexmenu_search_index
function indexmenu_search_index(&$data, $base, $file, $type, $lvl, $opts)
{
global $conf;
$ret = true;
$item = array();
if ($type == 'f' && !preg_match('#\\.txt$#', $file)) {
// don't add
return false;
}
// get page id by filename
$id = pathID($file);
// check hiddens
if ($type == 'f' && isHiddenPage($id)) {
return false;
}
// bugfix for the
// /ns/
// /<ns>.txt
// case, need to force the 'directory' type
if ($type == 'f' && file_exists(dirname(wikiFN($id . ":" . noNS($id))))) {
$type = 'd';
}
// page target id = global id
$target = $id;
if ($type == 'd') {
// this will check 3 kinds of headpage:
// 1. /<ns>/<ns>.txt
// 2. /<ns>/
// /<ns>.txt
// 3. /<ns>/
// /<ns>/<start_page>
$nsa = array($id . ":" . noNS($id), $id, $id . ":" . $conf['start']);
$nspage = false;
foreach ($nsa as $nsp) {
if (@file_exists(wikiFN($nsp)) && auth_quickaclcheck($nsp) >= AUTH_READ) {
$nspage = $nsp;
break;
}
}
//headpage exists
if ($nspage) {
$target = $nspage;
} else {
// open namespace index, if headpage does not exists
$target = $target . ':';
}
}
$data[] = array('id' => $id, 'date' => @filectime(wikiFN($target)), 'type' => $type, 'target' => $target, 'title' => $conf['useheading'] && ($title = p_get_first_heading($target)) ? $title : $id, 'level' => $lvl);
if (substr_count($id, ":") > 2) {
$ret = 0;
}
return $ret;
}
示例13: after_action
/**
* Executed after performing the action hooks
*
* Increases counter and purge cache
*/
public function after_action()
{
if ($this->autoinc) {
global $ID;
p_set_metadata($ID, array('bureaucracy' => array($this->get_key() => $this->opt['value'] + 1)));
// Force rerendering by removing the instructions cache file
$cache_fn = getCacheName(wikiFN($ID) . $_SERVER['HTTP_HOST'] . $_SERVER['SERVER_PORT'], '.' . 'i');
if (file_exists($cache_fn)) {
unlink($cache_fn);
}
}
}
示例14: handle_dokuwiki_started
public function handle_dokuwiki_started(&$event, $param)
{
global $ID, $ACT, $REV;
if ($ACT != 'show' && $ACT != '' || $REV) {
return;
}
$page = p_get_metadata($ID, 'relation isreplacedby');
// return if no redirection data
if (empty($page)) {
return;
}
if (isset($_GET['redirect'])) {
// return if redirection is temporarily disabled,
// or we have been redirected 5 times in a row
if ($_GET['redirect'] == 'no' || $_GET['redirect'] > 4) {
return;
} elseif ($_GET['redirect'] > 0) {
$redirect = $_GET['redirect'] + 1;
} else {
$redirect = 1;
}
} else {
$redirect = 1;
}
// verify metadata currency
if (@filemtime(metaFN($ID, '.meta')) < @filemtime(wikiFN($ID))) {
return;
}
// preserve #section from $page
list($page, $section) = explode('#', $page, 2);
if (isset($section)) {
$section = '#' . $section;
} else {
$section = '';
}
// prepare link for internal redirects, keep external targets
if (!preg_match('#^https?://#i', $page)) {
$page = wl($page, array('redirect' => $redirect), TRUE, '&');
if (!headers_sent() && $this->getConf('show_note')) {
// remember to show note about being redirected from another page
session_start();
$_SESSION[DOKU_COOKIE]['redirect'] = $ID;
}
}
// redirect
header("HTTP/1.1 301 Moved Permanently");
header("Location: " . $page . $section . $_SERVER['QUERY_STRING']);
exit;
}
示例15: label_document
function label_document()
{
//For links
if (isset($this->info['current_file_id'])) {
$cleanid = $this->info['current_file_id'];
} else {
$cleanid = noNS(cleanID($this->info['current_id'], TRUE));
}
$this->putcmd("label{" . md5($cleanid) . "}");
if (isset($this->info['current_file_id'])) {
$this->putnl("%%Start: " . $cleanid . ' => ' . $this->info['current_file_id']);
} else {
$this->putnl("%%Start: " . $cleanid . ' => ' . wikiFN($cleanid));
}
}