本文整理汇总了PHP中rawWiki函数的典型用法代码示例。如果您正苦于以下问题:PHP rawWiki函数的具体用法?PHP rawWiki怎么用?PHP rawWiki使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rawWiki函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle_approve
function handle_approve(&$event, $param)
{
global $ID, $REV;
if (!$this->can_approve()) {
return;
}
if ($event->data == 'show' && isset($_GET['approve'])) {
//Add or remove the new line from the end of the page. Silly but needed.
$content = rawWiki($ID, '');
if (substr($content, -1) == "\n") {
$content = substr($content, 0, -1);
} else {
$content .= "\n";
}
saveWikiText($ID, $content, APPROVED);
header('Location: ?id=' . $ID);
}
/*czytacze wydzą najnowszą zatwierdzaną*/
$last = $this->find_lastest_approved();
/*użytkownik może tylko czytać i jednocześnie istnieje jakaś zatwierdzona strona*/
if (auth_quickaclcheck($ID) <= AUTH_READ && $last != -1) {
/*najnowsza zatwierdzona nie jest najnowszą*/
/*i jednocześnie znajdujemy się w stronach nowszych niż aktualna zatwierdzona*/
if ($last != 0 && ($REV > $last || $REV == 0)) {
$REV = $last;
}
}
}
示例2: handle_start
function handle_start(&$event, $param)
{
global $ID;
global $ACT;
global $INFO;
if ($ACT != 'show') {
return;
}
if (!$INFO['exists']) {
return;
}
# don't try to read an article that doesn't exist
$all = rtrim(rawWiki($ID));
$inner = substr($all, 2, -2);
if ($all == '[[' . $inner . ']]' and strpos($inner, '[[') === false and strpos($inner, ']]') === false) {
if (!strpos($inner, '://') === false) {
$url = $inner;
# link is URL already
} else {
msg(sprintf('From: <a href="' . wl($ID, 'do=edit') . '">' . hsc($ID) . '</a>'));
$url = html_wikilink($inner, $name = null, $search = '');
$url = substr($url, strpos($url, '"') + 1);
$url = substr($url, 0, strpos($url, '"'));
}
idx_addPage($ID);
# ensure fulltext search indexing of referrer article - to put it on the backlink page of target article
send_redirect($url);
}
}
示例3: xhtml
/**
* renders the xhtml output of an action
* note that you can define Doku_Action_Postprocessor subclasses to change
* the global data that is used here, e.g., $ID and $EXAMPLE_TAG,
*/
public function xhtml()
{
global $ID;
global $EXAMPLE_TAG;
$text = htmlspecialchars(rawWiki($ID));
echo '<' . $EXAMPLE_TAG . '>' . $text . '</' . $EXAMPLE_TAG . '>';
}
示例4: _hookdo
function _hookdo(Doku_Event $event, $param)
{
global $ID;
if ($event->data === 'export_svg' && auth_quickaclcheck($ID) >= AUTH_READ) {
header('Content-type: image/svg+xml');
die(rawWiki($ID));
}
}
示例5: run
/**
* Handle the user input [required]
*
* @param helper_plugin_bureaucracy_field[] $fields the list of fields in the form
* @param string $thanks the thank you message as defined in the form
* or default one. Might be modified by the action
* before returned
* @param array $argv additional arguments passed to the action
* @return bool|string false on error, $thanks on success
*/
public function run($fields, $thanks, $argv)
{
global $ID;
// prepare replacements
$this->prepareNamespacetemplateReplacements();
$this->prepareDateTimereplacements();
$this->prepareLanguagePlaceholder();
$this->prepareNoincludeReplacement();
$this->prepareFieldReplacements($fields);
//handle arguments
$page_to_modify = array_shift($argv);
if ($page_to_modify === '_self') {
# shortcut to modify the same page as the submitter
$page_to_modify = $ID;
} else {
//resolve against page which contains the form
resolve_pageid(getNS($ID), $page_to_modify, $ignored);
}
$template_section_id = cleanID(array_shift($argv));
if (!page_exists($page_to_modify)) {
msg(sprintf($this->getLang('e_pagenotexists'), html_wikilink($page_to_modify)), -1);
return false;
}
// check auth
//
// This is an important point. In order to be able to modify a page via this method ALL you need is READ access to the page
// This is good for admins to be able to only allow people to modify a page via a certain method. If you want to protect the page
// from people to WRITE via this method, deny access to the form page.
$auth = $this->aclcheck($page_to_modify);
// runas
if ($auth < AUTH_READ) {
msg($this->getLang('e_denied'), -1);
return false;
}
// fetch template
$template = rawWiki($page_to_modify);
if (empty($template)) {
msg(sprintf($this->getLang('e_template'), $page_to_modify), -1);
return false;
}
// do the replacements
$template = $this->updatePage($template, $template_section_id);
if (!$template) {
msg(sprintf($this->getLang('e_failedtoparse'), $page_to_modify), -1);
return false;
}
// save page
saveWikiText($page_to_modify, $template, sprintf($this->getLang('summary'), $ID));
//thanks message with redirect
$link = wl($page_to_modify);
return sprintf($this->getLang('pleasewait'), "<script type='text/javascript' charset='utf-8'>location.replace('{$link}')</script>", html_wikilink($page_to_modify));
}
示例6: rawPage
/**
* Return a raw wiki page
*/
function rawPage($id, $rev = '')
{
if (auth_quickaclcheck($id) < AUTH_READ) {
return new IXR_Error(1, 'You are not allowed to read this page');
}
$text = rawWiki($id, $rev);
if (!$text) {
$data = array($id);
return trigger_event('HTML_PAGE_FROMTEMPLATE', $data, 'pageTemplate', true);
} else {
return $text;
}
}
示例7: rawPage
/**
* Return a raw wiki page
* @param string $id wiki page id
* @param string $rev revision number of the page
* @return page text.
*/
function rawPage($id, $rev = '')
{
$id = $this->resolvePageId($id);
if (auth_quickaclcheck($id) < AUTH_READ) {
throw new RemoteAccessDeniedException('You are not allowed to read this file', 111);
}
$text = rawWiki($id, $rev);
if (!$text) {
return pageTemplate($id);
} else {
return $text;
}
}
示例8: test_rename
public function test_rename()
{
/** @var $move helper_plugin_move_op */
$move = plugin_load('helper', 'move_op');
if (!$move) {
return;
}
// disable the test when move is not installed
saveWikiText('editx', 'Page to rename', 'Testcase create');
saveWikiText('links', '{{section>links#foo}} {{page>editx}} {{page>:eDitX&nofooter}} {{section>editx#test}} {{page>editx&nofooter}}', 'Testcase created');
idx_addPage('editx');
idx_addPage('links');
$this->assertTrue($move->movePage('editx', 'test:edit'));
$this->assertEquals('{{section>links#foo}} {{page>test:edit}} {{page>test:edit&nofooter}} {{section>test:edit#test}} {{page>test:edit&nofooter}}', rawWiki('links'));
}
示例9: test_rename
public function test_rename() {
global $ID;
/** @var $pagemove helper_plugin_pagemove */
$pagemove = plugin_load('helper', 'pagemove');
if (!$pagemove) return; // disable the test when pagemove is not installed
saveWikiText('editx', 'Page to rename', 'Testcase create');
saveWikiText('links', '{{section>links#foo}} {{page>editx}} {{page>:eDitX&nofooter}} {{section>editx#test}} {{page>editx&nofooter}}', 'Testcase created');
idx_addPage('editx');
idx_addPage('links');
$ID = 'editx';
$opts['ns'] = '';
$opts['newname'] = 'edit';
$opts['newns'] = 'test';
$pagemove->move_page($opts);
$this->assertEquals('{{section>links#foo}} {{page>test:edit}} {{page>test:edit&nofooter}} {{section>test:edit#test}} {{page>test:edit&nofooter}}', rawWiki('links'));
}
示例10: document_start
/**
* Initialize the rendering
*/
function document_start()
{
global $ID;
$this->id = $ID;
if (!isset($this->_texit)) {
if (!$this->configloaded) {
$this->loadConfig();
}
$this->_texit = new texitrender_plugin_texit($this->id);
$info = array();
if (preg_match("/<texit info>(.*?)<\\/texit>/", str_replace("\n", '\\n', rawWiki($this->id)), $info, PREG_OFFSET_CAPTURE)) {
$this->_texit->add_data('info', str_replace('\\n', "\n", $info[0][0]));
} else {
echo "error preg_match";
}
if ($_REQUEST['texit_type'] == 'zip') {
$this->_texit->_texit_conf['zipsources'] = true;
}
if ($this->_texit->generate('pdf')) {
$filename = null;
switch ($_REQUEST['texit_type']) {
case 'zip':
if (is_readable($this->_texit->zip['file'])) {
$filename = $this->_texit->zip['file'];
header('Content-Type: application/zip');
}
break;
case 'pdf':
default:
if (is_readable($this->_texit->pdf['file'])) {
$filename = $this->_texit->pdf['file'];
header('Content-Type: application/pdf');
}
break;
}
$hdr = "Content-Disposition: attachment;";
$hdr .= "filename=" . basename($filename) . ";";
header($hdr);
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filename));
readfile("{$filename}");
die;
}
}
}
示例11: test_moveSingleMedia_colonstart
/**
* @group slow
*/
public function test_moveSingleMedia_colonstart()
{
global $AUTH_ACL;
$AUTH_ACL[] = "wiki:*\t@ALL\t16";
$AUTH_ACL[] = "foobar:*\t@ALL\t8";
$filepath = DOKU_TMP_DATA . 'media/wiki/testimage.png';
io_makeFileDir($filepath);
io_saveFile($filepath, '');
saveWikiText('wiki:movetest', '{{:wiki:testimage.png?200}}', 'Test initialized');
idx_addPage('wiki:movetest');
$src = 'wiki:testimage.png';
$dst = 'foobar:logo_2.png';
/** @var helper_plugin_move_op $move */
$move = plugin_load('helper', 'move_op');
$this->assertTrue($move->moveMedia($src, $dst));
$this->assertTrue(@file_exists(mediaFn('foobar:logo_2.png')));
$this->assertEquals('{{:foobar:logo_2.png?200}}', rawWiki('wiki:movetest'));
}
示例12: test_PageDeleteSuccessful
/**
* @dataProvider dataPages
*/
public function test_PageDeleteSuccessful($id, $new_id, $pages)
{
$GLOBALS['INPUT']->server->set('REMOTE_USER', 'testuser');
foreach ($pages as $page) {
saveWikiText($page['id'], $page['content'], $page['summary']);
idx_addPage($page['id']);
}
$json = $this->doCall($id, $new_id, 'testuser');
$this->assertInstanceOf('\\stdClass', $json);
$this->assertObjectHasAttribute('error', $json);
$this->assertFalse($json->error);
//check page deleted
$this->assertFalse(file_exists(wikiFN($id)));
//check foreign pages
foreach ($pages as $page) {
if ($page['id'] == $id) {
continue;
// skip main. it was deleted
}
$this->assertEquals(!empty($page['new_content']) ? $page['new_content'] : $page['content'], rawWiki($page['id']));
}
}
示例13: test_moveSingleMedia
public function test_moveSingleMedia() {
global $AUTH_ACL;
$AUTH_ACL[] = "wiki:*\t@ALL\t16";
$AUTH_ACL[] = "foobar:*\t@ALL\t8";
saveWikiText('wiki:movetest', '{{wiki:dokuwiki-128.png?200}}', 'Test initialized');
idx_addPage('wiki:movetest');
$opts = array();
$opts['ns'] = 'wiki';
$opts['name'] = 'dokuwiki-128.png';
$opts['newns'] = 'foobar';
$opts['newname'] = 'logo.png';
/** @var helper_plugin_move $move */
$move = plugin_load('helper', 'move');
$this->assertTrue($move->move_media($opts));
$this->assertTrue(@file_exists(mediaFn('foobar:logo.png')));
$this->assertEquals('{{foobar:logo.png?200}}', rawWiki('wiki:movetest'));
}
示例14: _wikiRpcPublish
private function _wikiRpcPublish($id)
{
# get page contents
$content = rawWiki($id, '');
#$meta = p_get_metadata($id);
//TODO: allow to rewrite, prepend namespace, regexp replace, etc
$id = $this->getConf('target_ns') . $id;
# format a XMP-RPC message to update the page
$req = xmlrpc_encode_request("wiki.putPage", array($id, $content, "pub", false));
$errors = 0;
# TODO: loop over mult. servers to update {
$o = array('doku_host' => $this->getConf('target_host'), 'doku_base' => $this->getConf('target_path'), 'http_port' => $this->getConf('target_port'), 'protocol' => $this->getConf('target_proto'));
#call "curl ... &" -> fire and forget
#OR use make request here and inform user about result(s).
$rv = $this->dokuXmlRpc($req, $o);
#$this->_debug('parsed RPC reply: '.print_r($rv,true));
if ($rv != "0") {
$errors++;
// TODO queue error message.
$this->_debug(" !!! XMLRPC error #{$errors}");
}
# }
return true;
}
示例15: idx_getPageWords
/**
* Split a page into words
*
* Returns an array of word counts, false if an error occurred.
* Array is keyed on the word length, then the word index.
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Christopher Smith <chris@jalakai.co.uk>
*/
function idx_getPageWords($page)
{
global $conf;
$swfile = DOKU_INC . 'inc/lang/' . $conf['lang'] . '/stopwords.txt';
if (@file_exists($swfile)) {
$stopwords = file($swfile);
} else {
$stopwords = array();
}
$body = '';
$data = array($page, $body);
$evt = new Doku_Event('INDEXER_PAGE_ADD', $data);
if ($evt->advise_before()) {
$data[1] .= rawWiki($page);
}
$evt->advise_after();
unset($evt);
list($page, $body) = $data;
$body = strtr($body, "\r\n\t", ' ');
$tokens = explode(' ', $body);
$tokens = array_count_values($tokens);
// count the frequency of each token
// ensure the deaccented or romanised page names of internal links are added to the token array
// (this is necessary for the backlink function -- there maybe a better way!)
if ($conf['deaccent']) {
$links = p_get_metadata($page, 'relation references');
if (!empty($links)) {
$tmp = join(' ', array_keys($links));
// make a single string
$tmp = strtr($tmp, ':', ' ');
// replace namespace separator with a space
$link_tokens = array_unique(explode(' ', $tmp));
// break into tokens
foreach ($link_tokens as $link_token) {
if (isset($tokens[$link_token])) {
continue;
}
$tokens[$link_token] = 1;
}
}
}
$words = array();
foreach ($tokens as $word => $count) {
$arr = idx_tokenizer($word, $stopwords);
$arr = array_count_values($arr);
foreach ($arr as $w => $c) {
$l = wordlen($w);
if (isset($words[$l])) {
$words[$l][$w] = $c * $count + (isset($words[$l][$w]) ? $words[$l][$w] : 0);
} else {
$words[$l] = array($w => $c * $count);
}
}
}
// arrive here with $words = array(wordlen => array(word => frequency))
$index = array();
//resulting index
foreach (array_keys($words) as $wlen) {
$word_idx = idx_getIndex('w', $wlen);
foreach ($words[$wlen] as $word => $freq) {
$wid = array_search("{$word}\n", $word_idx);
if (!is_int($wid)) {
$wid = count($word_idx);
$word_idx[] = "{$word}\n";
}
if (!isset($index[$wlen])) {
$index[$wlen] = array();
}
$index[$wlen][$wid] = $freq;
}
// save back word index
if (!idx_saveIndex('w', $wlen, $word_idx)) {
trigger_error("Failed to write word index", E_USER_ERROR);
return false;
}
}
return $index;
}