PHP Class Doku_Renderer_xhtml, dokuwiki

This is DokuWiki's main renderer used to display page content in the wiki
Inheritance: extends Doku_Renderer
显示文件 Open project: splitbrain/dokuwiki Class Usage Examples

Public Properties

Property Type Description
$date_at
$toc store the table of contents

Protected Properties

Property Type Description
$_codeblock counts the code and file blocks, used to provide download links
$_counter global counter, for table classes etc.
$footnotes a list of footnotes, list starts at 1!
$headers the list of headers used to create unique link ids
$lastlevel current section level
$lastsecid last section edit id, used by startSectionEdit
$node section node tracker
$schemes list of allowed URL schemes
$sectionedits A stack of section edit data
$store temporary $doc store

Public Methods

Method Description
_audio ( string $src, array $atts = [] ) : string Embed audio in HTML
_formatLink ( array $link ) : string Build a link
_getLastMediaRevisionAt ( string $media_id ) : string _getLastMediaRevisionAt is a helperfunction to internalmedia() and _media() which returns an existing media revision less or equal to rev or date_at
_getLinkTitle ( string | array $title, string $default, boolean &$isImage, null | string $id = null, string $linktype = 'content' ) : string Construct a title and handle images in titles
_getMediaLinkConf ( string $src, string $title, string $align, integer $width, integer $height, string $cache, boolean $render ) : array helperfunction to return a basic link to a media
_headerToLink ( string $title, boolean $create = false ) : string Creates a linkid from a headline
_highlight ( string $type, string $text, string $language = null, string $filename = null ) Use GeSHi to highlight language syntax in code and file blocks
_imageTitle ( array $img ) : string Returns HTML code for images used in link titles
_media ( string $src, string $title = null, string $align = null, integer $width = null, integer $height = null, string $cache = null, boolean $render = true ) : string Renders internal and external media
_video ( string $src, integer $width, integer $height, array $atts = null ) : string Embed video(s) in HTML
_xmlEntities ( $string ) : string Escape string for output
acronym ( string $acronym ) Format an acronym
apostrophe ( ) Render an apostrophe char (language specific)
camelcaselink ( string $link, boolean $returnonly = false ) : void | string Render a CamelCase link
cdata ( $text ) Render plain text data
code ( string $text, string $language = null, string $filename = null ) Display text as code content, optionally syntax highlighted
deleted_close ( ) Stop deleted (strike-through) formatting
deleted_open ( ) Start deleted (strike-through) formatting
document_end ( ) Finalize the document
document_start ( ) Initialize the document
doublequoteclosing ( ) Render an closinging double quote char (language specific)
doublequoteopening ( ) Render an opening double quote char (language specific)
emaillink ( string $address, string | array $name = null, boolean $returnonly = false ) : void | string Render a linked E-Mail Address
emphasis_close ( ) Stop emphasis (italics) formatting
emphasis_open ( ) Start emphasis (italics) formatting
entity ( string $entity ) Format an entity
externallink ( string $url, string | array $name = null, boolean $returnonly = false ) : void | string Render an external link
externalmedia ( string $src, string $title = null, string $align = null, integer $width = null, integer $height = null, string $cache = null, string $linking = null, boolean $return = false ) : void | string Render an external media file
file ( string $text, string $language = null, string $filename = null ) Display text as file content, optionally syntax highlighted
finishSectionEdit ( integer $end = null ) Finish an edit section range
footnote_close ( ) Callback for footnote end syntax
footnote_open ( ) Callback for footnote start syntax
getFormat ( ) : string Returns the format produced by this renderer.
getLastlevel ( ) : integer Returns the current header level.
header ( string $text, integer $level, integer $pos ) Render a heading
hr ( ) Create a horizontal line
html ( string $text, string $wrapper = 'code' ) Insert HTML if allowed
htmlblock ( string $text ) Output raw block-level HTML
internallink ( string $id, string | null $name = null, string | null $search = null, boolean $returnonly = false, string $linktype = 'content' ) : void | string Render an internal Wiki Link
internalmedia ( string $src, string $title = null, string $align = null, integer $width = null, integer $height = null, string $cache = null, string $linking = null, boolean $return = false ) : void | string Render an internal media file
interwikilink ( string $match, string | array $name = null, string $wikiName, string $wikiUri, boolean $returnonly = false ) : void | string Render an interwiki link
linebreak ( ) Create a line break
listcontent_close ( ) Stop the content of a list item
listcontent_open ( ) Start the content of a list item
listitem_close ( ) Close a list item
listitem_open ( integer $level, boolean $node = false ) Open a list item
listo_close ( ) Close an ordered list
listo_open ( string | string[] $classes = null ) Open an ordered list
listu_close ( ) Close an unordered list
listu_open ( string | string[] $classes = null ) Open an unordered list
locallink ( string $hash, string $name = null, boolean $returnonly = false ) : void | string Render a page local link
monospace_close ( ) Stop monospace formatting
monospace_open ( ) Start monospace formatting
multiplyentity ( string | integer $x, string | integer $y ) Typographically format a multiply sign
p_close ( ) Close a paragraph
p_open ( ) Open a paragraph
php ( string $text, string $wrapper = 'code' ) Execute PHP code if allowed
phpblock ( string $text ) Output block level PHP code
preformatted ( string $text ) Output preformatted text
quote_close ( ) Stop a block quote
quote_open ( ) Start a block quote
rss ( string $url, array $params ) Renders an RSS feed
section_close ( ) Close the current section
section_open ( integer $level ) Open a new section
singlequoteclosing ( ) Render a closing single quote char (language specific)
singlequoteopening ( ) Render an opening single quote char (language specific)
smiley ( string $smiley ) Format a smiley
startSectionEdit ( integer $start, string $type, string $title = null ) : string Register a new edit section range
strong_close ( ) Stop strong (bold) formatting
strong_open ( ) Start strong (bold) formatting
subscript_close ( ) Stop a subscript
subscript_open ( ) Start a subscript
superscript_close ( ) Stop a superscript
superscript_open ( ) Start a superscript
table_close ( integer $pos = null ) Close a table
table_open ( integer $maxcols = null, integer $numrows = null, integer $pos = null, string | string[] $classes = null ) Start a table
tablecell_close ( ) Close a table cell
tablecell_open ( integer $colspan = 1, string $align = null, integer $rowspan = 1, string | string[] $classes = null ) Open a table cell
tableheader_close ( ) Close a table header cell
tableheader_open ( integer $colspan = 1, string $align = null, integer $rowspan = 1, string | string[] $classes = null ) Open a table header cell
tablerow_close ( ) Close a table row
tablerow_open ( string | string[] $classes = null ) Open a table row
tabletbody_close ( ) Close a table body
tabletbody_open ( ) Open a table body
tablethead_close ( ) Close a table header
tablethead_open ( ) Open a table header
toc_additem ( string $id, string $text, integer $level ) Add an item to the TOC
underline_close ( ) Stop underline formatting
underline_open ( ) Start underline formatting
unformatted ( string $text ) Output unformatted $text
windowssharelink ( string $url, string | array $name = null, boolean $returnonly = false ) : void | string Link to windows share

Method Details

_audio() public method

Embed audio in HTML
Author: Anika Henke ([email protected])
public _audio ( string $src, array $atts = [] ) : string
$src string - ID of audio to embed
$atts array - additional attributes for the
return string

_getLastMediaRevisionAt() public method

_getLastMediaRevisionAt is a helperfunction to internalmedia() and _media() which returns an existing media revision less or equal to rev or date_at
Author: lisps
public _getLastMediaRevisionAt ( string $media_id ) : string
$media_id string
return string revision ('' for current)

_getLinkTitle() public method

Construct a title and handle images in titles
Author: Harry Fuecks ([email protected])
public _getLinkTitle ( string | array $title, string $default, boolean &$isImage, null | string $id = null, string $linktype = 'content' ) : string
$title string | array either string title or media array
$default string default title if nothing else is found
$isImage boolean will be set to true if it's a media file
$id null | string linked page id (used to extract title from first heading)
$linktype string content|navigation
return string HTML of the title, might be full image tag or just escaped text

_getMediaLinkConf() public method

used in internalmedia() and externalmedia()
Author: Pierre Spring ([email protected])
public _getMediaLinkConf ( string $src, string $title, string $align, integer $width, integer $height, string $cache, boolean $render ) : array
$src string media ID
$title string descriptive text
$align string left|center|right
$width integer width of media in pixel
$height integer height of media in pixel
$cache string cache|recache|nocache
$render boolean should the media be embedded inline or just linked
return array associative array with link config

_highlight() public method

Use GeSHi to highlight language syntax in code and file blocks
Author: Andreas Gohr ([email protected])
public _highlight ( string $type, string $text, string $language = null, string $filename = null )
$type string code|file
$text string text to show
$language string programming language to use for syntax highlighting
$filename string file path label

_imageTitle() public method

Returns HTML code for images used in link titles
Author: Andreas Gohr ([email protected])
public _imageTitle ( array $img ) : string
$img array
return string HTML img tag or similar

_media() public method

Renders internal and external media
Author: Andreas Gohr ([email protected])
public _media ( string $src, string $title = null, string $align = null, integer $width = null, integer $height = null, string $cache = null, boolean $render = true ) : string
$src string media ID
$title string descriptive text
$align string left|center|right
$width integer width of media in pixel
$height integer height of media in pixel
$cache string cache|recache|nocache
$render boolean should the media be embedded inline or just linked
return string

_video() public method

Embed video(s) in HTML
Author: Anika Henke ([email protected])
public _video ( string $src, integer $width, integer $height, array $atts = null ) : string
$src string - ID of video to embed
$width integer - width of the video in pixels
$height integer - height of the video in pixels
$atts array - additional attributes for the
return string

_xmlEntities() public method

Escape string for output
public _xmlEntities ( $string ) : string
$string
return string

acronym() public method

Uses $this->acronyms
public acronym ( string $acronym )
$acronym string

apostrophe() public method

Render an apostrophe char (language specific)
public apostrophe ( )

cdata() public method

Render plain text data
public cdata ( $text )
$text

code() public method

Display text as code content, optionally syntax highlighted
public code ( string $text, string $language = null, string $filename = null )
$text string text to show
$language string programming language to use for syntax highlighting
$filename string file path label

deleted_close() public method

Stop deleted (strike-through) formatting
public deleted_close ( )

deleted_open() public method

Start deleted (strike-through) formatting
public deleted_open ( )

document_end() public method

Finalize the document
public document_end ( )

document_start() public method

Initialize the document
public document_start ( )

doublequoteclosing() public method

Render an closinging double quote char (language specific)
public doublequoteclosing ( )

doublequoteopening() public method

Render an opening double quote char (language specific)
public doublequoteopening ( )

emphasis_close() public method

Stop emphasis (italics) formatting
public emphasis_close ( )

emphasis_open() public method

Start emphasis (italics) formatting
public emphasis_open ( )

entity() public method

Entities are basically small text replacements Uses $this->entities
public entity ( string $entity )
$entity string

externalmedia() public method

Render an external media file
public externalmedia ( string $src, string $title = null, string $align = null, integer $width = null, integer $height = null, string $cache = null, string $linking = null, boolean $return = false ) : void | string
$src string full media URL
$title string descriptive text
$align string left|center|right
$width integer width of media in pixel
$height integer height of media in pixel
$cache string cache|recache|nocache
$linking string linkonly|detail|nolink
$return boolean return HTML instead of adding to $doc
return void | string writes to doc attribute or returns html depends on $return

file() public method

Display text as file content, optionally syntax highlighted
public file ( string $text, string $language = null, string $filename = null )
$text string text to show
$language string programming language to use for syntax highlighting
$filename string file path label

finishSectionEdit() public method

Finish an edit section range
Author: Adrian Lang ([email protected])
public finishSectionEdit ( integer $end = null )
$end integer The byte position for the edit end; null for the rest of the page

footnote_close() public method

All rendered content is moved to the $footnotes array and the old content is restored from $store again
Author: Andreas Gohr
public footnote_close ( )

footnote_open() public method

All following content will go to the footnote instead of the document. To achieve this the previous rendered content is moved to $store and $doc is cleared
Author: Andreas Gohr ([email protected])
public footnote_open ( )

getFormat() public method

Returns the format produced by this renderer.
public getFormat ( ) : string
return string always 'xhtml'

getLastlevel() public method

(required e.g. by the filelist plugin)
public getLastlevel ( ) : integer
return integer The current header level

header() public method

Render a heading
public header ( string $text, integer $level, integer $pos )
$text string the text to display
$level integer header level
$pos integer byte position in the original source

hr() public method

Create a horizontal line
public hr ( )

html() public method

Insert HTML if allowed
Author: Andreas Gohr ([email protected])
public html ( string $text, string $wrapper = 'code' )
$text string html text
$wrapper string html element to wrap result if $conf['htmlok'] is okff

htmlblock() public method

If $conf['htmlok'] is true this should add the code as is to $doc
public htmlblock ( string $text )
$text string The HTML

internalmedia() public method

Render an internal media file
public internalmedia ( string $src, string $title = null, string $align = null, integer $width = null, integer $height = null, string $cache = null, string $linking = null, boolean $return = false ) : void | string
$src string media ID
$title string descriptive text
$align string left|center|right
$width integer width of media in pixel
$height integer height of media in pixel
$cache string cache|recache|nocache
$linking string linkonly|detail|nolink
$return boolean return HTML instead of adding to $doc
return void | string writes to doc attribute or returns html depends on $return

linebreak() public method

Create a line break
public linebreak ( )

listcontent_close() public method

Stop the content of a list item
public listcontent_close ( )

listcontent_open() public method

Start the content of a list item
public listcontent_open ( )

listitem_close() public method

Close a list item
public listitem_close ( )

listitem_open() public method

Open a list item
public listitem_open ( integer $level, boolean $node = false )
$level integer the nesting level
$node boolean true when a node; false when a leaf

listo_close() public method

Close an ordered list
public listo_close ( )

listo_open() public method

Open an ordered list
public listo_open ( string | string[] $classes = null )
$classes string | string[] css classes - have to be valid, do not pass unfiltered user input

listu_close() public method

Close an unordered list
public listu_close ( )

listu_open() public method

Open an unordered list
public listu_open ( string | string[] $classes = null )
$classes string | string[] css classes - have to be valid, do not pass unfiltered user input

monospace_close() public method

Stop monospace formatting
public monospace_close ( )

monospace_open() public method

Start monospace formatting
public monospace_open ( )

multiplyentity() public method

Example: ($x=640, $y=480) should result in "640×480"
public multiplyentity ( string | integer $x, string | integer $y )
$x string | integer first value
$y string | integer second value

p_close() public method

Close a paragraph
public p_close ( )

p_open() public method

Open a paragraph
public p_open ( )

php() public method

Execute PHP code if allowed
Author: Andreas Gohr ([email protected])
public php ( string $text, string $wrapper = 'code' )
$text string PHP code that is either executed or printed
$wrapper string html element to wrap result if $conf['phpok'] is okff

phpblock() public method

If $conf['phpok'] is true this should evaluate the given code and append the result to $doc
public phpblock ( string $text )
$text string The PHP code

preformatted() public method

Output preformatted text
public preformatted ( string $text )
$text string

quote_close() public method

Stop a block quote
public quote_close ( )

quote_open() public method

Start a block quote
public quote_open ( )

rss() public method

Renders an RSS feed
Author: Andreas Gohr ([email protected])
public rss ( string $url, array $params )
$url string URL of the feed
$params array Finetuning of the output

section_close() public method

Close the current section
public section_close ( )

section_open() public method

Open a new section
public section_open ( integer $level )
$level integer section level (as determined by the previous header)

singlequoteclosing() public method

Render a closing single quote char (language specific)
public singlequoteclosing ( )

singlequoteopening() public method

Render an opening single quote char (language specific)
public singlequoteopening ( )

smiley() public method

Uses $this->smiley
public smiley ( string $smiley )
$smiley string

startSectionEdit() public method

Register a new edit section range
Author: Adrian Lang ([email protected])
public startSectionEdit ( integer $start, string $type, string $title = null ) : string
$start integer The byte position for the edit start
$type string The section type identifier
$title string The section title
return string A marker class for the starting HTML element

strong_close() public method

Stop strong (bold) formatting
public strong_close ( )

strong_open() public method

Start strong (bold) formatting
public strong_open ( )

subscript_close() public method

Stop a subscript
public subscript_close ( )

subscript_open() public method

Start a subscript
public subscript_open ( )

superscript_close() public method

Stop a superscript
public superscript_close ( )

superscript_open() public method

Start a superscript
public superscript_open ( )

table_close() public method

Close a table
public table_close ( integer $pos = null )
$pos integer byte position in the original source

table_open() public method

Start a table
public table_open ( integer $maxcols = null, integer $numrows = null, integer $pos = null, string | string[] $classes = null )
$maxcols integer maximum number of columns
$numrows integer NOT IMPLEMENTED
$pos integer byte position in the original source
$classes string | string[] css classes - have to be valid, do not pass unfiltered user input

tablecell_close() public method

Close a table cell
public tablecell_close ( )

tablecell_open() public method

Open a table cell
public tablecell_open ( integer $colspan = 1, string $align = null, integer $rowspan = 1, string | string[] $classes = null )
$colspan integer
$align string left|center|right
$rowspan integer
$classes string | string[] css classes - have to be valid, do not pass unfiltered user input

tableheader_close() public method

Close a table header cell
public tableheader_close ( )

tableheader_open() public method

Open a table header cell
public tableheader_open ( integer $colspan = 1, string $align = null, integer $rowspan = 1, string | string[] $classes = null )
$colspan integer
$align string left|center|right
$rowspan integer
$classes string | string[] css classes - have to be valid, do not pass unfiltered user input

tablerow_close() public method

Close a table row
public tablerow_close ( )

tablerow_open() public method

Open a table row
public tablerow_open ( string | string[] $classes = null )
$classes string | string[] css classes - have to be valid, do not pass unfiltered user input

tabletbody_close() public method

Close a table body
public tabletbody_close ( )

tabletbody_open() public method

Open a table body
public tabletbody_open ( )

tablethead_close() public method

Close a table header
public tablethead_close ( )

tablethead_open() public method

Open a table header
public tablethead_open ( )

toc_additem() public method

Add an item to the TOC
public toc_additem ( string $id, string $text, integer $level )
$id string the hash link
$text string the text to display
$level integer the nesting level

underline_close() public method

Stop underline formatting
public underline_close ( )

underline_open() public method

Start underline formatting
public underline_open ( )

unformatted() public method

Defaults to $this->cdata()
public unformatted ( string $text )
$text string

Property Details

$_codeblock protected_oe property

counts the code and file blocks, used to provide download links
protected $_codeblock

$_counter protected_oe property

global counter, for table classes etc.
protected $_counter

$date_at public_oe property

public $date_at

$footnotes protected_oe property

a list of footnotes, list starts at 1!
protected $footnotes

$headers protected_oe property

the list of headers used to create unique link ids
protected $headers

$lastlevel protected_oe property

current section level
protected $lastlevel

$lastsecid protected_oe property

last section edit id, used by startSectionEdit
protected $lastsecid

$node protected_oe property

section node tracker
protected $node

$schemes protected_oe property

list of allowed URL schemes
protected $schemes

$sectionedits protected_oe property

A stack of section edit data
protected $sectionedits

$store protected_oe property

temporary $doc store
protected $store

$toc public_oe property

store the table of contents
public $toc