本文整理汇总了PHP中io_readWikiPage函数的典型用法代码示例。如果您正苦于以下问题:PHP io_readWikiPage函数的具体用法?PHP io_readWikiPage怎么用?PHP io_readWikiPage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了io_readWikiPage函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_css
function add_css(&$event, $param)
{
// get content from wiki page
$txt = io_readWikiPage(wikiFN($this->pagename), $this->pagename);
// filter for CSS definitions in <code css> blocks
preg_match_all('/<code css>(.*?)<\\/code>/sm', $txt, $matches);
$usercss = implode("\n", $matches[1]);
// fix url() locations
$usercss = preg_replace_callback('#(url\\([ \'"]*)([^\'"]*)#', create_function('$matches', 'global $ID; $m = $matches[2];
resolve_mediaid(getNS($ID), $m, $exists);
return $matches[1].ml($m);'), $usercss);
// append all
$event->data .= $usercss;
}
示例2: p_cached_instructions
/**
* Returns the render instructions for a file
*
* Uses and creates a serialized cache file
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function p_cached_instructions($file, $cacheonly = false, $id = '')
{
global $conf;
static $run = null;
if (is_null($run)) {
$run = array();
}
$cache = new cache_instructions($id, $file);
if ($cacheonly || $cache->useCache() || isset($run[$file])) {
return $cache->retrieveCache();
} else {
if (@file_exists($file)) {
// no cache - do some work
$ins = p_get_instructions(io_readWikiPage($file, $id));
if ($cache->storeCache($ins)) {
$run[$file] = true;
// we won't rebuild these instructions in the same run again
} else {
msg('Unable to save cache file. Hint: disk full; file permissions; safe_mode setting.', -1);
}
return $ins;
}
}
return null;
}
示例3: rawWikiSlices
/**
* Returns the raw Wiki Text in three slices.
*
* The range parameter needs to have the form "from-to"
* and gives the range of the section in bytes - no
* UTF-8 awareness is needed.
* The returned order is prefix, section and suffix.
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function rawWikiSlices($range, $id, $rev = '')
{
$text = io_readWikiPage(wikiFN($id, $rev), $id, $rev);
// Parse range
list($from, $to) = explode('-', $range, 2);
// Make range zero-based, use defaults if marker is missing
$from = !$from ? 0 : $from - 1;
$to = !$to ? strlen($text) : $to - 1;
$slices[0] = substr($text, 0, $from);
$slices[1] = substr($text, $from, $to - $from);
$slices[2] = substr($text, $to);
return $slices;
}
示例4: rawWikiSlices
/**
* Returns the raw Wiki Text in three slices.
*
* The range parameter needs to have the form "from-to"
* and gives the range of the section in bytes - no
* UTF-8 awareness is needed.
* The returned order is prefix, section and suffix.
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function rawWikiSlices($range, $id, $rev = '')
{
list($from, $to) = split('-', $range, 2);
$text = io_readWikiPage(wikiFN($id, $rev), $id, $rev);
if (!$from) {
$from = 0;
}
if (!$to) {
$to = strlen($text) + 1;
}
$slices[0] = substr($text, 0, $from - 1);
$slices[1] = substr($text, $from - 1, $to - $from);
$slices[2] = substr($text, $to);
return $slices;
}
示例5: process_page
function process_page($input)
{
$page = $input;
// integrate all includes
$includematches = array();
preg_match_all('/\\[INCLUDE:([^\\]]*)\\]/', $page, $includematches, PREG_SET_ORDER);
foreach ($includematches as $includematch) {
$includeid = $includematch[1];
$file = wikiFN($includeid, '');
if (@file_exists($file)) {
$content = io_readWikiPage($file, $includeid);
}
if (!$content) {
$page = str_replace($includematch[0], "include \"{$includeid}\" not found", $page);
continue;
}
$page = str_replace($includematch[0], $content, $page);
}
$page = str_replace('~~TEMPLATE~~', '', $page);
// interpret and remove all maps and variable blocks
$mapblocks = array();
preg_match_all('/\\[MAPS\\](.*)?\\[ENDMAPS\\]/sm', $page, $mapblocks, PREG_SET_ORDER);
foreach ($mapblocks as $mapblock) {
fill_map($mapblock[1], $this->maps);
// at this point, maps are stored as strings, we need to convert them
foreach (array_keys($this->maps) as $mapname) {
$list = explode(',', $this->maps[$mapname]);
$map = array();
foreach ($list as $field) {
if ($pos = strpos($field, '=')) {
$map[trim(substr($field, 0, $pos))] = trim(substr($field, $pos + 1));
} else {
// no key found => append
$map[] = trim($field);
}
}
$this->maps[$mapname] = $map;
}
$page = str_replace($mapblock[0], '', $page);
}
$variableblocks = array();
preg_match_all('/\\[VARIABLES\\](.*)?\\[ENDVARIABLES\\]/sm', $page, $variableblocks, PREG_SET_ORDER);
foreach ($variableblocks as $variableblock) {
fill_map($variableblock[1], $this->variables);
$page = str_replace($variableblock[0], '', $page);
}
// invoke the substitution
$this->substitute($page, -1);
return $page;
}
示例6: bootstrap_tpl_get_sidebar
/**
* Get the sidebar html. Get cached sidebar if $cache param is true.
*
* @author Cameron Little <cameron@camlittle.com>
*/
function bootstrap_tpl_get_sidebar($pageid, $cache)
{
global $TOC;
$oldtoc = $TOC;
$html = '';
$rev = '';
$file = wikiFN($pageid, $rev);
if ($cache && !$rev) {
if (@file_exists($file)) {
$html = p_cached_output($file, 'xhtml', $pageid);
}
} else {
if (@file_exists($file)) {
$html = p_render('xhtml', p_get_instructions(io_readWikiPage($file, $pageid, $rev)), $info);
//no caching on old revisions
}
}
return $html;
}
示例7: parse
/**
*
*/
private function parse()
{
$text = io_readWikiPage($this->fileName, $this->id);
$call = p_cached_instructions($this->fileName);
$calls = count($call);
for ($c = 0; $c < $calls; $c++) {
if ($call[$c][0] == 'table_open') {
$c = $this->parseTable($call, $calls, $c, $text);
} elseif ($call[$c][0] == 'code') {
$this->parseCode($call[$c]);
} elseif ($call[$c][0] == 'plugin' && $call[$c][1][0] == 'data_entry') {
$this->parseDataEntry($call[$c][1][1]);
}
}
}