[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/ -> parserutils.php (summary)

Utilities for accessing the parser

Author: Harry Fuecks
Author: Andreas Gohr
License: GPL 2 (http://www.gnu.org/licenses/gpl.html)
File Size: 829 lines (28 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 inc/parser/parser.php

Defines 17 functions

  p_wiki_xhtml()
  p_locale_xhtml()
  p_cached_output()
  p_cached_instructions()
  p_get_instructions()
  p_get_metadata()
  p_set_metadata()
  p_purge_metadata()
  p_read_metadata()
  p_save_metadata()
  p_render_metadata()
  p_get_parsermodes()
  p_sort_modes()
  p_render()
  p_get_renderer()
  p_get_first_heading()
  p_xhtml_cached_geshi()

Functions
Functions that are not part of a class:

p_wiki_xhtml($id, $rev = '', $excuse = true, $date_at = '')   X-Ref
Returns the parsed Wikitext in XHTML for the given id and revision.

If $excuse is true an explanation is returned if the file
wasn't found

return: null|string
param: string $id page id
param: string|int $rev revision timestamp or empty string
param: bool $excuse
param: string $date_at
author: Andreas Gohr <andi@splitbrain.org>

p_locale_xhtml($id)   X-Ref
Returns the specified local text in parsed format

return: null|string
param: string $id page id
author: Andreas Gohr <andi@splitbrain.org>

p_cached_output($file, $format = 'xhtml', $id = '')   X-Ref
Returns the given file parsed into the requested output format

return: null|string
param: string $file filename, path to file
param: string $format
param: string $id page id
author: Andreas Gohr <andi@splitbrain.org>
author: Chris Smith <chris@jalakai.co.uk>

p_cached_instructions($file, $cacheonly = false, $id = '')   X-Ref
Returns the render instructions for a file

Uses and creates a serialized cache file

return: array|null
param: string $file filename, path to file
param: bool $cacheonly
param: string $id page id
author: Andreas Gohr <andi@splitbrain.org>

p_get_instructions($text)   X-Ref
turns a page into a list of instructions

return: array a list of instruction arrays
param: string $text raw wiki syntax text
author: Harry Fuecks <hfuecks@gmail.com>
author: Andreas Gohr <andi@splitbrain.org>

p_get_metadata($id, $key = '', $render = METADATA_RENDER_USING_CACHE)   X-Ref
returns the metadata of a page

return: mixed The requested metadata fields
param: string $id The id of the page the metadata should be returned from
param: string $key The key of the metdata value that shall be read (by default everything)
param: int $render If the page should be rendererd - possible values:
author: Esther Brunner <esther@kaffeehaus.ch>
author: Michael Hamann <michael@content-space.de>

p_set_metadata($id, $data, $render = false, $persistent = true)   X-Ref
sets metadata elements of a page

return: boolean true on success
param: string $id is the ID of a wiki page
param: array $data is an array with key ⇒ value pairs to be set in the metadata
param: boolean $render whether or not the page metadata should be generated with the renderer
param: boolean $persistent indicates whether or not the particular metadata value will persist through
see: http://www.dokuwiki.org/devel:metadata#functions_to_get_and_set_metadata
author: Esther Brunner <esther@kaffeehaus.ch>
author: Michael Hamann <michael@content-space.de>

p_purge_metadata($id)   X-Ref
Purges the non-persistant part of the meta data
used on page deletion

return: bool  success / fail
param: string $id page id
author: Michael Klier <chi@chimeric.de>

p_read_metadata($id, $cache = false)   X-Ref
read the metadata from source/cache for $id
(internal use only - called by p_get_metadata & p_set_metadata)

return: array             metadata
param: string $id absolute wiki page id
param: bool $cache whether or not to cache metadata in memory
author: Christopher Smith <chris@jalakai.co.uk>

p_save_metadata($id, $meta)   X-Ref
This is the backend function to save a metadata array to a file

return: bool              success / fail
param: string $id absolute wiki page id
param: array $meta metadata

p_render_metadata($id, $orig)   X-Ref
renders the metadata of a page

return: array|null array('current'=> array,'persistent'=> array);
param: string $id page id
param: array $orig the original metadata
author: Esther Brunner <esther@kaffeehaus.ch>

p_get_parsermodes()   X-Ref
returns all available parser syntax modes in correct order

return: array[] with for each plugin the array('sort' => sortnumber, 'mode' => mode string, 'obj'  => plugin object)
author: Andreas Gohr <andi@splitbrain.org>

p_sort_modes($a, $b)   X-Ref
Callback function for usort

return: int $a is lower/equal/higher than $b
param: array $a
param: array $b
author: Andreas Gohr <andi@splitbrain.org>

p_render($mode, $instructions, &$info, $date_at = '')   X-Ref
Renders a list of instruction to the specified output mode

In the $info array is information from the renderer returned

return: null|string rendered output
param: string $mode
param: array|null|false $instructions
param: array $info returns render info like enabled toc and cache
param: string $date_at
author: Andreas Gohr <andi@splitbrain.org>
author: Harry Fuecks <hfuecks@gmail.com>

p_get_renderer($mode)   X-Ref
Figure out the correct renderer class to use for $mode,
instantiate and return it

return: null|Doku_Renderer The renderer
param: string $mode Mode of the renderer to get
author: Christopher Smith <chris@jalakai.co.uk>

p_get_first_heading($id, $render = METADATA_RENDER_USING_SIMPLE_CACHE)   X-Ref
Gets the first heading from a file

return: string|null The first heading
param: string $id dokuwiki page id
param: int $render rerender if first heading not known
author: Andreas Gohr <andi@splitbrain.org>
author: Michael Hamann <michael@content-space.de>

p_xhtml_cached_geshi($code, $language, $wrapper = 'pre', array $options = null)   X-Ref
Wrapper for GeSHi Code Highlighter, provides caching of its output

return: string xhtml code
param: string $code source code to be highlighted
param: string $language language to provide highlighting
param: string $wrapper html element to wrap the returned highlighted text
author: Christopher Smith <chris@jalakai.co.uk>
author: Andreas Gohr <andi@splitbrain.org>