visibility definition for the renderers

I made a lot of things public that probaly should be protected. But many
syntax plugins do access renderer mechanisms directly, so better stay on
the safe side here.

The base renderer is now abstract.
This commit is contained in:
Andreas Gohr 2018-04-28 07:06:08 +02:00
parent d2778ca9d5
commit de369923cc
7 changed files with 286 additions and 294 deletions

View File

@ -0,0 +1,11 @@
<?php
namespace dokuwiki\test\mock;
class Doku_Renderer extends \Doku_Renderer {
/** @inheritdoc */
public function getFormat() {
return 'none';
}
}

View File

@ -1,6 +1,6 @@
<?php
require_once DOKU_INC . 'inc/parser/renderer.php';
use dokuwiki\test\mock\Doku_Renderer;
/**
* Tests for Doku_Renderer::_resolveInterWiki()

View File

@ -5,7 +5,7 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
class Doku_Renderer_code extends Doku_Renderer {
var $_codeblock = 0;
protected $_codeblock = 0;
/**
* Send the wanted code block to the browser
@ -16,7 +16,7 @@ class Doku_Renderer_code extends Doku_Renderer {
* @param string $language
* @param string $filename
*/
function code($text, $language = null, $filename = '') {
public function code($text, $language = null, $filename = '') {
global $INPUT;
if(!$language) $language = 'txt';
$language = preg_replace(PREG_PATTERN_VALID_LANGUAGE, '', $language);
@ -47,14 +47,14 @@ class Doku_Renderer_code extends Doku_Renderer {
* @param string $language
* @param string $filename
*/
function file($text, $language = null, $filename = '') {
public function file($text, $language = null, $filename = '') {
$this->code($text, $language, $filename);
}
/**
* This should never be reached, if it is send a 404
*/
function document_end() {
public function document_end() {
http_status(404);
echo '404 - Not found';
exit;
@ -65,7 +65,7 @@ class Doku_Renderer_code extends Doku_Renderer {
*
* @returns string 'code'
*/
function getFormat() {
public function getFormat() {
return 'code';
}
}

View File

@ -43,7 +43,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
*
* @return string always 'metadata'
*/
function getFormat() {
public function getFormat() {
return 'metadata';
}
@ -52,7 +52,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
*
* Sets up some of the persistent info about the page if it doesn't exist, yet.
*/
function document_start() {
public function document_start() {
global $ID;
$this->headers = array();
@ -76,7 +76,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
*
* Stores collected data in the metadata
*/
function document_end() {
public function document_end() {
global $ID;
// store internal info in metadata (notoc,nocache)
@ -107,7 +107,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
*
* @param $text
*/
function cdata($text) {
public function cdata($text) {
if(!$this->capture) return;
$this->doc .= $text;
@ -123,7 +123,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param string $text the text to display
* @param int $level the nesting level
*/
function toc_additem($id, $text, $level) {
public function toc_additem($id, $text, $level) {
global $conf;
//only add items within configured levels
@ -146,7 +146,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param int $level header level
* @param int $pos byte position in the original source
*/
function header($text, $level, $pos) {
public function header($text, $level, $pos) {
if(!isset($this->meta['title'])) $this->meta['title'] = $text;
// add the header to the TOC
@ -160,28 +160,28 @@ class Doku_Renderer_metadata extends Doku_Renderer {
/**
* Open a paragraph
*/
function p_open() {
public function p_open() {
$this->cdata(DOKU_LF);
}
/**
* Close a paragraph
*/
function p_close() {
public function p_close() {
$this->cdata(DOKU_LF);
}
/**
* Create a line break
*/
function linebreak() {
public function linebreak() {
$this->cdata(DOKU_LF);
}
/**
* Create a horizontal line
*/
function hr() {
public function hr() {
$this->cdata(DOKU_LF.'----------'.DOKU_LF);
}
@ -194,7 +194,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function footnote_open() {
public function footnote_open() {
if($this->capture) {
// move current content to store and record footnote
$this->store = $this->doc;
@ -210,7 +210,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
*
* @author Andreas Gohr
*/
function footnote_close() {
public function footnote_close() {
if($this->capture) {
// restore old content
$this->doc = $this->store;
@ -221,14 +221,14 @@ class Doku_Renderer_metadata extends Doku_Renderer {
/**
* Open an unordered list
*/
function listu_open() {
public function listu_open() {
$this->cdata(DOKU_LF);
}
/**
* Open an ordered list
*/
function listo_open() {
public function listo_open() {
$this->cdata(DOKU_LF);
}
@ -238,14 +238,14 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param int $level the nesting level
* @param bool $node true when a node; false when a leaf
*/
function listitem_open($level,$node=false) {
public function listitem_open($level,$node=false) {
$this->cdata(str_repeat(DOKU_TAB, $level).'* ');
}
/**
* Close a list item
*/
function listitem_close() {
public function listitem_close() {
$this->cdata(DOKU_LF);
}
@ -254,21 +254,21 @@ class Doku_Renderer_metadata extends Doku_Renderer {
*
* @param string $text
*/
function preformatted($text) {
public function preformatted($text) {
$this->cdata($text);
}
/**
* Start a block quote
*/
function quote_open() {
public function quote_open() {
$this->cdata(DOKU_LF.DOKU_TAB.'"');
}
/**
* Stop a block quote
*/
function quote_close() {
public function quote_close() {
$this->cdata('"'.DOKU_LF);
}
@ -279,7 +279,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param string $lang programming language to use for syntax highlighting
* @param string $file file path label
*/
function file($text, $lang = null, $file = null) {
public function file($text, $lang = null, $file = null) {
$this->cdata(DOKU_LF.$text.DOKU_LF);
}
@ -290,7 +290,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param string $language programming language to use for syntax highlighting
* @param string $file file path label
*/
function code($text, $language = null, $file = null) {
public function code($text, $language = null, $file = null) {
$this->cdata(DOKU_LF.$text.DOKU_LF);
}
@ -301,7 +301,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
*
* @param string $acronym
*/
function acronym($acronym) {
public function acronym($acronym) {
$this->cdata($acronym);
}
@ -312,7 +312,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
*
* @param string $smiley
*/
function smiley($smiley) {
public function smiley($smiley) {
$this->cdata($smiley);
}
@ -325,7 +325,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
*
* @param string $entity
*/
function entity($entity) {
public function entity($entity) {
$this->cdata($entity);
}
@ -337,14 +337,14 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param string|int $x first value
* @param string|int $y second value
*/
function multiplyentity($x, $y) {
public function multiplyentity($x, $y) {
$this->cdata($x.'×'.$y);
}
/**
* Render an opening single quote char (language specific)
*/
function singlequoteopening() {
public function singlequoteopening() {
global $lang;
$this->cdata($lang['singlequoteopening']);
}
@ -352,7 +352,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
/**
* Render a closing single quote char (language specific)
*/
function singlequoteclosing() {
public function singlequoteclosing() {
global $lang;
$this->cdata($lang['singlequoteclosing']);
}
@ -360,7 +360,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
/**
* Render an apostrophe char (language specific)
*/
function apostrophe() {
public function apostrophe() {
global $lang;
$this->cdata($lang['apostrophe']);
}
@ -368,7 +368,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
/**
* Render an opening double quote char (language specific)
*/
function doublequoteopening() {
public function doublequoteopening() {
global $lang;
$this->cdata($lang['doublequoteopening']);
}
@ -376,7 +376,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
/**
* Render an closinging double quote char (language specific)
*/
function doublequoteclosing() {
public function doublequoteclosing() {
global $lang;
$this->cdata($lang['doublequoteclosing']);
}
@ -387,7 +387,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param string $link The link name
* @see http://en.wikipedia.org/wiki/CamelCase
*/
function camelcaselink($link) {
public function camelcaselink($link) {
$this->internallink($link, $link);
}
@ -397,7 +397,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param string $hash hash link identifier
* @param string $name name for the link
*/
function locallink($hash, $name = null) {
public function locallink($hash, $name = null) {
if(is_array($name)) {
$this->_firstimage($name['src']);
if($name['type'] == 'internalmedia') $this->_recordMediaUsage($name['src']);
@ -410,7 +410,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param string $id page ID to link to. eg. 'wiki:syntax'
* @param string|array|null $name name for the link, array for media file
*/
function internallink($id, $name = null) {
public function internallink($id, $name = null) {
global $ID;
if(is_array($name)) {
@ -447,7 +447,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param string $url full URL with scheme
* @param string|array|null $name name for the link, array for media file
*/
function externallink($url, $name = null) {
public function externallink($url, $name = null) {
if(is_array($name)) {
$this->_firstimage($name['src']);
if($name['type'] == 'internalmedia') $this->_recordMediaUsage($name['src']);
@ -468,7 +468,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param string $wikiName indentifier (shortcut) for the remote wiki
* @param string $wikiUri the fragment parsed from the original link
*/
function interwikilink($match, $name = null, $wikiName, $wikiUri) {
public function interwikilink($match, $name = null, $wikiName, $wikiUri) {
if(is_array($name)) {
$this->_firstimage($name['src']);
if($name['type'] == 'internalmedia') $this->_recordMediaUsage($name['src']);
@ -487,7 +487,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param string $url the link
* @param string|array $name name for the link, array for media file
*/
function windowssharelink($url, $name = null) {
public function windowssharelink($url, $name = null) {
if(is_array($name)) {
$this->_firstimage($name['src']);
if($name['type'] == 'internalmedia') $this->_recordMediaUsage($name['src']);
@ -507,7 +507,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param string $address Email-Address
* @param string|array $name name for the link, array for media file
*/
function emaillink($address, $name = null) {
public function emaillink($address, $name = null) {
if(is_array($name)) {
$this->_firstimage($name['src']);
if($name['type'] == 'internalmedia') $this->_recordMediaUsage($name['src']);
@ -530,7 +530,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param string $cache cache|recache|nocache
* @param string $linking linkonly|detail|nolink
*/
function internalmedia($src, $title = null, $align = null, $width = null,
public function internalmedia($src, $title = null, $align = null, $width = null,
$height = null, $cache = null, $linking = null) {
if($this->capture && $title) $this->doc .= '['.$title.']';
$this->_firstimage($src);
@ -548,7 +548,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param string $cache cache|recache|nocache
* @param string $linking linkonly|detail|nolink
*/
function externalmedia($src, $title = null, $align = null, $width = null,
public function externalmedia($src, $title = null, $align = null, $width = null,
$height = null, $cache = null, $linking = null) {
if($this->capture && $title) $this->doc .= '['.$title.']';
$this->_firstimage($src);
@ -560,7 +560,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param string $url URL of the feed
* @param array $params Finetuning of the output
*/
function rss($url, $params) {
public function rss($url, $params) {
$this->meta['relation']['haspart'][$url] = true;
$this->meta['date']['valid']['age'] =
@ -581,7 +581,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
*
* @return mixed|string
*/
function _simpleTitle($name) {
public function _simpleTitle($name) {
global $conf;
if(is_array($name)) return '';
@ -597,23 +597,6 @@ class Doku_Renderer_metadata extends Doku_Renderer {
return $name;
}
/**
* Creates a linkid from a headline
*
* @author Andreas Gohr <andi@splitbrain.org>
* @param string $title The headline title
* @param boolean $create Create a new unique ID?
* @return string
*/
function _headerToLink($title, $create = false) {
if($create) {
return sectionID($title, $this->headers);
} else {
$check = false;
return sectionID($title, $check);
}
}
/**
* Construct a title and handle images in titles
*
@ -623,7 +606,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
* @param null|string $id linked page id (used to extract title from first heading)
* @return string title text
*/
function _getLinkTitle($title, $default, $id = null) {
public function _getLinkTitle($title, $default, $id = null) {
if(is_array($title)) {
if($title['title']) {
return '['.$title['title'].']';
@ -646,7 +629,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
*
* @param string $src image URL or ID
*/
function _firstimage($src) {
protected function _firstimage($src) {
if($this->firstimage) return;
global $ID;
@ -664,7 +647,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
*
* @param string $src media ID
*/
function _recordMediaUsage($src) {
protected function _recordMediaUsage($src) {
global $ID;
list ($src) = explode('#', $src, 2);

View File

@ -23,7 +23,7 @@ define('PREG_PATTERN_VALID_LANGUAGE', '#[^a-zA-Z0-9\-_]#');
* $doc field. When all instructions are processed, the $doc field contents will be cached by
* DokuWiki and sent to the user.
*/
class Doku_Renderer extends DokuWiki_Plugin {
abstract class Doku_Renderer extends DokuWiki_Plugin {
/** @var array Settings, control the behavior of the renderer */
public $info = array(
'cache' => true, // may the rendered result cached?
@ -39,6 +39,9 @@ class Doku_Renderer extends DokuWiki_Plugin {
/** @var array contains the interwiki configuration, set in p_render() */
public $interwiki = array();
/** @var array the list of headers used to create unique link ids */
protected $headers = array();
/**
* @var string the rendered document, this will be cached after the renderer ran through
*/
@ -50,7 +53,8 @@ class Doku_Renderer extends DokuWiki_Plugin {
* This is called before each use of the renderer object and should be used to
* completely reset the state of the renderer to be reused for a new document
*/
function reset() {
public function reset(){
$this->headers = array();
}
/**
@ -61,7 +65,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @return bool false if the plugin has to be instantiated
*/
function isSingleton() {
public function isSingleton() {
return false;
}
@ -72,10 +76,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @return string
*/
function getFormat() {
trigger_error('getFormat() not implemented in '.get_class($this), E_USER_WARNING);
return '';
}
abstract public function getFormat();
/**
* Disable caching of this renderer's output
@ -103,7 +104,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $state matched state if any
* @param string $match raw matched syntax
*/
function plugin($name, $data, $state = '', $match = '') {
public function plugin($name, $data, $state = '', $match = '') {
/** @var DokuWiki_Syntax_Plugin $plugin */
$plugin = plugin_load('syntax', $name);
if($plugin != null) {
@ -117,7 +118,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @param array $instructions
*/
function nest($instructions) {
public function nest($instructions) {
foreach($instructions as $instruction) {
// execute the callback against ourself
if(method_exists($this, $instruction[0])) {
@ -132,7 +133,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* normally the syntax mode should override this instruction when instantiating Doku_Handler_Nest -
* however plugins will not be able to - as their instructions require data.
*/
function nest_close() {
public function nest_close() {
}
#region Syntax modes - sub classes will need to implement them to fill $doc
@ -140,13 +141,13 @@ class Doku_Renderer extends DokuWiki_Plugin {
/**
* Initialize the document
*/
function document_start() {
public function document_start() {
}
/**
* Finalize the document
*/
function document_end() {
public function document_end() {
}
/**
@ -154,7 +155,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @return string
*/
function render_TOC() {
public function render_TOC() {
return '';
}
@ -165,7 +166,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $text the text to display
* @param int $level the nesting level
*/
function toc_additem($id, $text, $level) {
public function toc_additem($id, $text, $level) {
}
/**
@ -175,7 +176,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param int $level header level
* @param int $pos byte position in the original source
*/
function header($text, $level, $pos) {
public function header($text, $level, $pos) {
}
/**
@ -183,13 +184,13 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @param int $level section level (as determined by the previous header)
*/
function section_open($level) {
public function section_open($level) {
}
/**
* Close the current section
*/
function section_close() {
public function section_close() {
}
/**
@ -197,151 +198,151 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @param string $text
*/
function cdata($text) {
public function cdata($text) {
}
/**
* Open a paragraph
*/
function p_open() {
public function p_open() {
}
/**
* Close a paragraph
*/
function p_close() {
public function p_close() {
}
/**
* Create a line break
*/
function linebreak() {
public function linebreak() {
}
/**
* Create a horizontal line
*/
function hr() {
public function hr() {
}
/**
* Start strong (bold) formatting
*/
function strong_open() {
public function strong_open() {
}
/**
* Stop strong (bold) formatting
*/
function strong_close() {
public function strong_close() {
}
/**
* Start emphasis (italics) formatting
*/
function emphasis_open() {
public function emphasis_open() {
}
/**
* Stop emphasis (italics) formatting
*/
function emphasis_close() {
public function emphasis_close() {
}
/**
* Start underline formatting
*/
function underline_open() {
public function underline_open() {
}
/**
* Stop underline formatting
*/
function underline_close() {
public function underline_close() {
}
/**
* Start monospace formatting
*/
function monospace_open() {
public function monospace_open() {
}
/**
* Stop monospace formatting
*/
function monospace_close() {
public function monospace_close() {
}
/**
* Start a subscript
*/
function subscript_open() {
public function subscript_open() {
}
/**
* Stop a subscript
*/
function subscript_close() {
public function subscript_close() {
}
/**
* Start a superscript
*/
function superscript_open() {
public function superscript_open() {
}
/**
* Stop a superscript
*/
function superscript_close() {
public function superscript_close() {
}
/**
* Start deleted (strike-through) formatting
*/
function deleted_open() {
public function deleted_open() {
}
/**
* Stop deleted (strike-through) formatting
*/
function deleted_close() {
public function deleted_close() {
}
/**
* Start a footnote
*/
function footnote_open() {
public function footnote_open() {
}
/**
* Stop a footnote
*/
function footnote_close() {
public function footnote_close() {
}
/**
* Open an unordered list
*/
function listu_open() {
public function listu_open() {
}
/**
* Close an unordered list
*/
function listu_close() {
public function listu_close() {
}
/**
* Open an ordered list
*/
function listo_open() {
public function listo_open() {
}
/**
* Close an ordered list
*/
function listo_close() {
public function listo_close() {
}
/**
@ -350,25 +351,25 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param int $level the nesting level
* @param bool $node true when a node; false when a leaf
*/
function listitem_open($level,$node=false) {
public function listitem_open($level,$node=false) {
}
/**
* Close a list item
*/
function listitem_close() {
public function listitem_close() {
}
/**
* Start the content of a list item
*/
function listcontent_open() {
public function listcontent_open() {
}
/**
* Stop the content of a list item
*/
function listcontent_close() {
public function listcontent_close() {
}
/**
@ -378,7 +379,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @param string $text
*/
function unformatted($text) {
public function unformatted($text) {
$this->cdata($text);
}
@ -390,7 +391,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @param string $text The PHP code
*/
function php($text) {
public function php($text) {
}
/**
@ -401,7 +402,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @param string $text The PHP code
*/
function phpblock($text) {
public function phpblock($text) {
}
/**
@ -411,7 +412,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @param string $text The HTML
*/
function html($text) {
public function html($text) {
}
/**
@ -421,7 +422,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @param string $text The HTML
*/
function htmlblock($text) {
public function htmlblock($text) {
}
/**
@ -429,19 +430,19 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @param string $text
*/
function preformatted($text) {
public function preformatted($text) {
}
/**
* Start a block quote
*/
function quote_open() {
public function quote_open() {
}
/**
* Stop a block quote
*/
function quote_close() {
public function quote_close() {
}
/**
@ -451,7 +452,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $lang programming language to use for syntax highlighting
* @param string $file file path label
*/
function file($text, $lang = null, $file = null) {
public function file($text, $lang = null, $file = null) {
}
/**
@ -461,7 +462,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $lang programming language to use for syntax highlighting
* @param string $file file path label
*/
function code($text, $lang = null, $file = null) {
public function code($text, $lang = null, $file = null) {
}
/**
@ -471,7 +472,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @param string $acronym
*/
function acronym($acronym) {
public function acronym($acronym) {
}
/**
@ -481,7 +482,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @param string $smiley
*/
function smiley($smiley) {
public function smiley($smiley) {
}
/**
@ -493,7 +494,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @param string $entity
*/
function entity($entity) {
public function entity($entity) {
}
/**
@ -504,37 +505,37 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string|int $x first value
* @param string|int $y second value
*/
function multiplyentity($x, $y) {
public function multiplyentity($x, $y) {
}
/**
* Render an opening single quote char (language specific)
*/
function singlequoteopening() {
public function singlequoteopening() {
}
/**
* Render a closing single quote char (language specific)
*/
function singlequoteclosing() {
public function singlequoteclosing() {
}
/**
* Render an apostrophe char (language specific)
*/
function apostrophe() {
public function apostrophe() {
}
/**
* Render an opening double quote char (language specific)
*/
function doublequoteopening() {
public function doublequoteopening() {
}
/**
* Render an closinging double quote char (language specific)
*/
function doublequoteclosing() {
public function doublequoteclosing() {
}
/**
@ -543,7 +544,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $link The link name
* @see http://en.wikipedia.org/wiki/CamelCase
*/
function camelcaselink($link) {
public function camelcaselink($link) {
}
/**
@ -552,7 +553,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $hash hash link identifier
* @param string $name name for the link
*/
function locallink($hash, $name = null) {
public function locallink($hash, $name = null) {
}
/**
@ -561,7 +562,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $link page ID to link to. eg. 'wiki:syntax'
* @param string|array $title name for the link, array for media file
*/
function internallink($link, $title = null) {
public function internallink($link, $title = null) {
}
/**
@ -570,7 +571,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $link full URL with scheme
* @param string|array $title name for the link, array for media file
*/
function externallink($link, $title = null) {
public function externallink($link, $title = null) {
}
/**
@ -579,7 +580,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $url URL of the feed
* @param array $params Finetuning of the output
*/
function rss($url, $params) {
public function rss($url, $params) {
}
/**
@ -592,7 +593,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $wikiName indentifier (shortcut) for the remote wiki
* @param string $wikiUri the fragment parsed from the original link
*/
function interwikilink($link, $title = null, $wikiName, $wikiUri) {
public function interwikilink($link, $title, $wikiName, $wikiUri) {
}
/**
@ -601,7 +602,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $link the link
* @param string|array $title name for the link, array for media file
*/
function filelink($link, $title = null) {
public function filelink($link, $title = null) {
}
/**
@ -610,7 +611,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $link the link
* @param string|array $title name for the link, array for media file
*/
function windowssharelink($link, $title = null) {
public function windowssharelink($link, $title = null) {
}
/**
@ -621,7 +622,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $address Email-Address
* @param string|array $name name for the link, array for media file
*/
function emaillink($address, $name = null) {
public function emaillink($address, $name = null) {
}
/**
@ -635,7 +636,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $cache cache|recache|nocache
* @param string $linking linkonly|detail|nolink
*/
function internalmedia($src, $title = null, $align = null, $width = null,
public function internalmedia($src, $title = null, $align = null, $width = null,
$height = null, $cache = null, $linking = null) {
}
@ -650,7 +651,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $cache cache|recache|nocache
* @param string $linking linkonly|detail|nolink
*/
function externalmedia($src, $title = null, $align = null, $width = null,
public function externalmedia($src, $title = null, $align = null, $width = null,
$height = null, $cache = null, $linking = null) {
}
@ -664,7 +665,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param int $height height of media in pixel
* @param string $cache cache|recache|nocache
*/
function internalmedialink($src, $title = null, $align = null,
public function internalmedialink($src, $title = null, $align = null,
$width = null, $height = null, $cache = null) {
}
@ -678,7 +679,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param int $height height of media in pixel
* @param string $cache cache|recache|nocache
*/
function externalmedialink($src, $title = null, $align = null,
public function externalmedialink($src, $title = null, $align = null,
$width = null, $height = null, $cache = null) {
}
@ -689,7 +690,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param int $numrows NOT IMPLEMENTED
* @param int $pos byte position in the original source
*/
function table_open($maxcols = null, $numrows = null, $pos = null) {
public function table_open($maxcols = null, $numrows = null, $pos = null) {
}
/**
@ -697,55 +698,55 @@ class Doku_Renderer extends DokuWiki_Plugin {
*
* @param int $pos byte position in the original source
*/
function table_close($pos = null) {
public function table_close($pos = null) {
}
/**
* Open a table header
*/
function tablethead_open() {
public function tablethead_open() {
}
/**
* Close a table header
*/
function tablethead_close() {
public function tablethead_close() {
}
/**
* Open a table body
*/
function tabletbody_open() {
public function tabletbody_open() {
}
/**
* Close a table body
*/
function tabletbody_close() {
public function tabletbody_close() {
}
/**
* Open a table footer
*/
function tabletfoot_open() {
public function tabletfoot_open() {
}
/**
* Close a table footer
*/
function tabletfoot_close() {
public function tabletfoot_close() {
}
/**
* Open a table row
*/
function tablerow_open() {
public function tablerow_open() {
}
/**
* Close a table row
*/
function tablerow_close() {
public function tablerow_close() {
}
/**
@ -755,13 +756,13 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $align left|center|right
* @param int $rowspan
*/
function tableheader_open($colspan = 1, $align = null, $rowspan = 1) {
public function tableheader_open($colspan = 1, $align = null, $rowspan = 1) {
}
/**
* Close a table header cell
*/
function tableheader_close() {
public function tableheader_close() {
}
/**
@ -771,19 +772,36 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $align left|center|right
* @param int $rowspan
*/
function tablecell_open($colspan = 1, $align = null, $rowspan = 1) {
public function tablecell_open($colspan = 1, $align = null, $rowspan = 1) {
}
/**
* Close a table cell
*/
function tablecell_close() {
public function tablecell_close() {
}
#endregion
#region util functions, you probably won't need to reimplement them
/**
* Creates a linkid from a headline
*
* @author Andreas Gohr <andi@splitbrain.org>
* @param string $title The headline title
* @param boolean $create Create a new unique ID?
* @return string
*/
public function _headerToLink($title, $create = false) {
if($create) {
return sectionID($title, $this->headers);
} else {
$check = false;
return sectionID($title, $check);
}
}
/**
* Removes any Namespace from the given name but keeps
* casing and special chars
@ -793,7 +811,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param string $name
* @return string
*/
function _simpleTitle($name) {
protected function _simpleTitle($name) {
global $conf;
//if there is a hash we use the ancor name only
@ -817,7 +835,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
* @param null|bool $exists reference which returns if an internal page exists
* @return string interwikilink
*/
function _resolveInterWiki(&$shortcut, $reference, &$exists = null) {
public function _resolveInterWiki(&$shortcut, $reference, &$exists = null) {
//get interwiki URL
if(isset($this->interwiki[$shortcut])) {
$url = $this->interwiki[$shortcut];

View File

@ -14,14 +14,13 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/** @var array A stack of section edit data */
protected $sectionedits = array();
var $date_at = ''; // link pages and media against this revision
/** @var string|int link pages and media against this revision */
public $date_at = '';
/** @var int last section edit id, used by startSectionEdit */
protected $lastsecid = 0;
/** @var array the list of headers used to create unique link ids */
protected $headers = array();
/** @var array a list of footnotes, list starts at 1! */
protected $footnotes = array();
@ -108,23 +107,22 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @return string always 'xhtml'
*/
function getFormat() {
public function getFormat() {
return 'xhtml';
}
/**
* Initialize the document
*/
function document_start() {
public function document_start() {
//reset some internals
$this->toc = array();
$this->headers = array();
}
/**
* Finalize the document
*/
function document_end() {
public function document_end() {
// Finish open section edits.
while(count($this->sectionedits) > 0) {
if($this->sectionedits[count($this->sectionedits) - 1]['start'] <= 1) {
@ -189,7 +187,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param string $text the text to display
* @param int $level the nesting level
*/
function toc_additem($id, $text, $level) {
public function toc_additem($id, $text, $level) {
global $conf;
//handle TOC
@ -205,7 +203,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param int $level header level
* @param int $pos byte position in the original source
*/
function header($text, $level, $pos) {
public function header($text, $level, $pos) {
global $conf;
if(blank($text)) return; //skip empty headlines
@ -251,14 +249,14 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @param int $level section level (as determined by the previous header)
*/
function section_open($level) {
public function section_open($level) {
$this->doc .= '<div class="level'.$level.'">'.DOKU_LF;
}
/**
* Close the current section
*/
function section_close() {
public function section_close() {
$this->doc .= DOKU_LF.'</div>'.DOKU_LF;
}
@ -267,133 +265,133 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @param $text
*/
function cdata($text) {
public function cdata($text) {
$this->doc .= $this->_xmlEntities($text);
}
/**
* Open a paragraph
*/
function p_open() {
public function p_open() {
$this->doc .= DOKU_LF.'<p>'.DOKU_LF;
}
/**
* Close a paragraph
*/
function p_close() {
public function p_close() {
$this->doc .= DOKU_LF.'</p>'.DOKU_LF;
}
/**
* Create a line break
*/
function linebreak() {
public function linebreak() {
$this->doc .= '<br/>'.DOKU_LF;
}
/**
* Create a horizontal line
*/
function hr() {
public function hr() {
$this->doc .= '<hr />'.DOKU_LF;
}
/**
* Start strong (bold) formatting
*/
function strong_open() {
public function strong_open() {
$this->doc .= '<strong>';
}
/**
* Stop strong (bold) formatting
*/
function strong_close() {
public function strong_close() {
$this->doc .= '</strong>';
}
/**
* Start emphasis (italics) formatting
*/
function emphasis_open() {
public function emphasis_open() {
$this->doc .= '<em>';
}
/**
* Stop emphasis (italics) formatting
*/
function emphasis_close() {
public function emphasis_close() {
$this->doc .= '</em>';
}
/**
* Start underline formatting
*/
function underline_open() {
public function underline_open() {
$this->doc .= '<em class="u">';
}
/**
* Stop underline formatting
*/
function underline_close() {
public function underline_close() {
$this->doc .= '</em>';
}
/**
* Start monospace formatting
*/
function monospace_open() {
public function monospace_open() {
$this->doc .= '<code>';
}
/**
* Stop monospace formatting
*/
function monospace_close() {
public function monospace_close() {
$this->doc .= '</code>';
}
/**
* Start a subscript
*/
function subscript_open() {
public function subscript_open() {
$this->doc .= '<sub>';
}
/**
* Stop a subscript
*/
function subscript_close() {
public function subscript_close() {
$this->doc .= '</sub>';
}
/**
* Start a superscript
*/
function superscript_open() {
public function superscript_open() {
$this->doc .= '<sup>';
}
/**
* Stop a superscript
*/
function superscript_close() {
public function superscript_close() {
$this->doc .= '</sup>';
}
/**
* Start deleted (strike-through) formatting
*/
function deleted_open() {
public function deleted_open() {
$this->doc .= '<del>';
}
/**
* Stop deleted (strike-through) formatting
*/
function deleted_close() {
public function deleted_close() {
$this->doc .= '</del>';
}
@ -406,7 +404,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function footnote_open() {
public function footnote_open() {
// move current content to store and record footnote
$this->store = $this->doc;
@ -421,7 +419,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @author Andreas Gohr
*/
function footnote_close() {
public function footnote_close() {
/** @var $fnid int takes track of seen footnotes, assures they are unique even across multiple docs FS#2841 */
static $fnid = 0;
// assign new footnote id (we start at 1)
@ -452,7 +450,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @param string|string[] $classes css classes - have to be valid, do not pass unfiltered user input
*/
function listu_open($classes = null) {
public function listu_open($classes = null) {
$class = '';
if($classes !== null) {
if(is_array($classes)) $classes = join(' ', $classes);
@ -464,7 +462,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Close an unordered list
*/
function listu_close() {
public function listu_close() {
$this->doc .= '</ul>'.DOKU_LF;
}
@ -473,7 +471,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @param string|string[] $classes css classes - have to be valid, do not pass unfiltered user input
*/
function listo_open($classes = null) {
public function listo_open($classes = null) {
$class = '';
if($classes !== null) {
if(is_array($classes)) $classes = join(' ', $classes);
@ -485,7 +483,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Close an ordered list
*/
function listo_close() {
public function listo_close() {
$this->doc .= '</ol>'.DOKU_LF;
}
@ -495,7 +493,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param int $level the nesting level
* @param bool $node true when a node; false when a leaf
*/
function listitem_open($level, $node=false) {
public function listitem_open($level, $node=false) {
$branching = $node ? ' node' : '';
$this->doc .= '<li class="level'.$level.$branching.'">';
}
@ -503,21 +501,21 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Close a list item
*/
function listitem_close() {
public function listitem_close() {
$this->doc .= '</li>'.DOKU_LF;
}
/**
* Start the content of a list item
*/
function listcontent_open() {
public function listcontent_open() {
$this->doc .= '<div class="li">';
}
/**
* Stop the content of a list item
*/
function listcontent_close() {
public function listcontent_close() {
$this->doc .= '</div>'.DOKU_LF;
}
@ -528,7 +526,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @param string $text
*/
function unformatted($text) {
public function unformatted($text) {
$this->doc .= $this->_xmlEntities($text);
}
@ -540,7 +538,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function php($text, $wrapper = 'code') {
public function php($text, $wrapper = 'code') {
global $conf;
if($conf['phpok']) {
@ -561,7 +559,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @param string $text The PHP code
*/
function phpblock($text) {
public function phpblock($text) {
$this->php($text, 'pre');
}
@ -573,7 +571,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html($text, $wrapper = 'code') {
public function html($text, $wrapper = 'code') {
global $conf;
if($conf['htmlok']) {
@ -590,21 +588,21 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @param string $text The HTML
*/
function htmlblock($text) {
public function htmlblock($text) {
$this->html($text, 'pre');
}
/**
* Start a block quote
*/
function quote_open() {
public function quote_open() {
$this->doc .= '<blockquote><div class="no">'.DOKU_LF;
}
/**
* Stop a block quote
*/
function quote_close() {
public function quote_close() {
$this->doc .= '</div></blockquote>'.DOKU_LF;
}
@ -613,7 +611,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @param string $text
*/
function preformatted($text) {
public function preformatted($text) {
$this->doc .= '<pre class="code">'.trim($this->_xmlEntities($text), "\n\r").'</pre>'.DOKU_LF;
}
@ -625,7 +623,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param string $filename file path label
* @param array $options assoziative array with additional geshi options
*/
function file($text, $language = null, $filename = null, $options=null) {
public function file($text, $language = null, $filename = null, $options=null) {
$this->_highlight('file', $text, $language, $filename, $options);
}
@ -637,7 +635,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param string $filename file path label
* @param array $options assoziative array with additional geshi options
*/
function code($text, $language = null, $filename = null, $options=null) {
public function code($text, $language = null, $filename = null, $options=null) {
$this->_highlight('code', $text, $language, $filename, $options);
}
@ -651,7 +649,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param string $filename file path label
* @param array $options assoziative array with additional geshi options
*/
function _highlight($type, $text, $language = null, $filename = null, $options = null) {
public function _highlight($type, $text, $language = null, $filename = null, $options = null) {
global $ID;
global $lang;
global $INPUT;
@ -711,7 +709,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @param string $acronym
*/
function acronym($acronym) {
public function acronym($acronym) {
if(array_key_exists($acronym, $this->acronyms)) {
@ -732,7 +730,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @param string $smiley
*/
function smiley($smiley) {
public function smiley($smiley) {
if(array_key_exists($smiley, $this->smileys)) {
$this->doc .= '<img src="'.DOKU_BASE.'lib/images/smileys/'.$this->smileys[$smiley].
'" class="icon" alt="'.
@ -751,7 +749,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @param string $entity
*/
function entity($entity) {
public function entity($entity) {
if(array_key_exists($entity, $this->entities)) {
$this->doc .= $this->entities[$entity];
} else {
@ -767,14 +765,14 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param string|int $x first value
* @param string|int $y second value
*/
function multiplyentity($x, $y) {
public function multiplyentity($x, $y) {
$this->doc .= "$x&times;$y";
}
/**
* Render an opening single quote char (language specific)
*/
function singlequoteopening() {
public function singlequoteopening() {
global $lang;
$this->doc .= $lang['singlequoteopening'];
}
@ -782,7 +780,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Render a closing single quote char (language specific)
*/
function singlequoteclosing() {
public function singlequoteclosing() {
global $lang;
$this->doc .= $lang['singlequoteclosing'];
}
@ -790,7 +788,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Render an apostrophe char (language specific)
*/
function apostrophe() {
public function apostrophe() {
global $lang;
$this->doc .= $lang['apostrophe'];
}
@ -798,7 +796,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Render an opening double quote char (language specific)
*/
function doublequoteopening() {
public function doublequoteopening() {
global $lang;
$this->doc .= $lang['doublequoteopening'];
}
@ -806,7 +804,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Render an closinging double quote char (language specific)
*/
function doublequoteclosing() {
public function doublequoteclosing() {
global $lang;
$this->doc .= $lang['doublequoteclosing'];
}
@ -820,7 +818,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @see http://en.wikipedia.org/wiki/CamelCase
*/
function camelcaselink($link, $returnonly = false) {
public function camelcaselink($link, $returnonly = false) {
if($returnonly) {
return $this->internallink($link, $link, null, true);
} else {
@ -836,7 +834,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param bool $returnonly whether to return html or write to doc attribute
* @return void|string writes to doc attribute or returns html depends on $returnonly
*/
function locallink($hash, $name = null, $returnonly = false) {
public function locallink($hash, $name = null, $returnonly = false) {
global $ID;
$name = $this->_getLinkTitle($name, $hash, $isImage);
$hash = $this->_headerToLink($hash);
@ -867,7 +865,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param string $linktype type to set use of headings
* @return void|string writes to doc attribute or returns html depends on $returnonly
*/
function internallink($id, $name = null, $search = null, $returnonly = false, $linktype = 'content') {
public function internallink($id, $name = null, $search = null, $returnonly = false, $linktype = 'content') {
global $conf;
global $ID;
global $INFO;
@ -958,7 +956,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param bool $returnonly whether to return html or write to doc attribute
* @return void|string writes to doc attribute or returns html depends on $returnonly
*/
function externallink($url, $name = null, $returnonly = false) {
public function externallink($url, $name = null, $returnonly = false) {
global $conf;
$name = $this->_getLinkTitle($name, $url, $isImage);
@ -1022,7 +1020,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param bool $returnonly whether to return html or write to doc attribute
* @return void|string writes to doc attribute or returns html depends on $returnonly
*/
function interwikilink($match, $name = null, $wikiName, $wikiUri, $returnonly = false) {
public function interwikilink($match, $name, $wikiName, $wikiUri, $returnonly = false) {
global $conf;
$link = array();
@ -1077,7 +1075,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param bool $returnonly whether to return html or write to doc attribute
* @return void|string writes to doc attribute or returns html depends on $returnonly
*/
function windowssharelink($url, $name = null, $returnonly = false) {
public function windowssharelink($url, $name = null, $returnonly = false) {
global $conf;
//simple setup
@ -1117,7 +1115,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param bool $returnonly whether to return html or write to doc attribute
* @return void|string writes to doc attribute or returns html depends on $returnonly
*/
function emaillink($address, $name = null, $returnonly = false) {
public function emaillink($address, $name = null, $returnonly = false) {
global $conf;
//simple setup
$link = array();
@ -1169,7 +1167,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param bool $return return HTML instead of adding to $doc
* @return void|string writes to doc attribute or returns html depends on $return
*/
function internalmedia($src, $title = null, $align = null, $width = null,
public function internalmedia($src, $title = null, $align = null, $width = null,
$height = null, $cache = null, $linking = null, $return = false) {
global $ID;
if (strpos($src, '#') !== false) {
@ -1241,7 +1239,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param bool $return return HTML instead of adding to $doc
* @return void|string writes to doc attribute or returns html depends on $return
*/
function externalmedia($src, $title = null, $align = null, $width = null,
public function externalmedia($src, $title = null, $align = null, $width = null,
$height = null, $cache = null, $linking = null, $return = false) {
if(link_isinterwiki($src)){
list($shortcut, $reference) = explode('>', $src, 2);
@ -1288,7 +1286,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function rss($url, $params) {
public function rss($url, $params) {
global $lang;
global $conf;
@ -1380,7 +1378,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param int $pos byte position in the original source
* @param string|string[] $classes css classes - have to be valid, do not pass unfiltered user input
*/
function table_open($maxcols = null, $numrows = null, $pos = null, $classes = null) {
public function table_open($maxcols = null, $numrows = null, $pos = null, $classes = null) {
// initialize the row counter used for classes
$this->_counter['row_counter'] = 0;
$class = 'table';
@ -1405,7 +1403,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @param int $pos byte position in the original source
*/
function table_close($pos = null) {
public function table_close($pos = null) {
$this->doc .= '</table></div>'.DOKU_LF;
if($pos !== null) {
$this->finishSectionEdit($pos);
@ -1415,42 +1413,42 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Open a table header
*/
function tablethead_open() {
public function tablethead_open() {
$this->doc .= DOKU_TAB.'<thead>'.DOKU_LF;
}
/**
* Close a table header
*/
function tablethead_close() {
public function tablethead_close() {
$this->doc .= DOKU_TAB.'</thead>'.DOKU_LF;
}
/**
* Open a table body
*/
function tabletbody_open() {
public function tabletbody_open() {
$this->doc .= DOKU_TAB.'<tbody>'.DOKU_LF;
}
/**
* Close a table body
*/
function tabletbody_close() {
public function tabletbody_close() {
$this->doc .= DOKU_TAB.'</tbody>'.DOKU_LF;
}
/**
* Open a table footer
*/
function tabletfoot_open() {
public function tabletfoot_open() {
$this->doc .= DOKU_TAB.'<tfoot>'.DOKU_LF;
}
/**
* Close a table footer
*/
function tabletfoot_close() {
public function tabletfoot_close() {
$this->doc .= DOKU_TAB.'</tfoot>'.DOKU_LF;
}
@ -1459,7 +1457,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @param string|string[] $classes css classes - have to be valid, do not pass unfiltered user input
*/
function tablerow_open($classes = null) {
public function tablerow_open($classes = null) {
// initialize the cell counter used for classes
$this->_counter['cell_counter'] = 0;
$class = 'row'.$this->_counter['row_counter']++;
@ -1473,7 +1471,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Close a table row
*/
function tablerow_close() {
public function tablerow_close() {
$this->doc .= DOKU_LF.DOKU_TAB.'</tr>'.DOKU_LF;
}
@ -1485,7 +1483,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param int $rowspan
* @param string|string[] $classes css classes - have to be valid, do not pass unfiltered user input
*/
function tableheader_open($colspan = 1, $align = null, $rowspan = 1, $classes = null) {
public function tableheader_open($colspan = 1, $align = null, $rowspan = 1, $classes = null) {
$class = 'class="col'.$this->_counter['cell_counter']++;
if(!is_null($align)) {
$class .= ' '.$align.'align';
@ -1509,7 +1507,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Close a table header cell
*/
function tableheader_close() {
public function tableheader_close() {
$this->doc .= '</th>';
}
@ -1521,7 +1519,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param int $rowspan
* @param string|string[] $classes css classes - have to be valid, do not pass unfiltered user input
*/
function tablecell_open($colspan = 1, $align = null, $rowspan = 1, $classes = null) {
public function tablecell_open($colspan = 1, $align = null, $rowspan = 1, $classes = null) {
$class = 'class="col'.$this->_counter['cell_counter']++;
if(!is_null($align)) {
$class .= ' '.$align.'align';
@ -1545,7 +1543,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Close a table cell
*/
function tablecell_close() {
public function tablecell_close() {
$this->doc .= '</td>';
}
@ -1555,7 +1553,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @return int The current header level
*/
function getLastlevel() {
public function getLastlevel() {
return $this->lastlevel;
}
@ -1571,7 +1569,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function _formatLink($link) {
public function _formatLink($link) {
//make sure the url is XHTML compliant (skip mailto)
if(substr($link['url'], 0, 7) != 'mailto:') {
$link['url'] = str_replace('&', '&amp;', $link['url']);
@ -1614,7 +1612,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param bool $render should the media be embedded inline or just linked
* @return string
*/
function _media($src, $title = null, $align = null, $width = null,
public function _media($src, $title = null, $align = null, $width = null,
$height = null, $cache = null, $render = true) {
$ret = '';
@ -1731,26 +1729,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param $string
* @return string
*/
function _xmlEntities($string) {
public function _xmlEntities($string) {
return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
}
/**
* Creates a linkid from a headline
*
* @author Andreas Gohr <andi@splitbrain.org>
* @param string $title The headline title
* @param boolean $create Create a new unique ID?
* @return string
*/
function _headerToLink($title, $create = false) {
if($create) {
return sectionID($title, $this->headers);
} else {
$check = false;
return sectionID($title, $check);
}
}
/**
* Construct a title and handle images in titles
@ -1763,7 +1746,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param string $linktype content|navigation
* @return string HTML of the title, might be full image tag or just escaped text
*/
function _getLinkTitle($title, $default, &$isImage, $id = null, $linktype = 'content') {
public function _getLinkTitle($title, $default, &$isImage, $id = null, $linktype = 'content') {
$isImage = false;
if(is_array($title)) {
$isImage = true;
@ -1788,7 +1771,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param array $img
* @return string HTML img tag or similar
*/
function _imageTitle($img) {
public function _imageTitle($img) {
global $ID;
// some fixes on $img['src']
@ -1823,7 +1806,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param bool $render should the media be embedded inline or just linked
* @return array associative array with link config
*/
function _getMediaLinkConf($src, $title, $align, $width, $height, $cache, $render) {
public function _getMediaLinkConf($src, $title, $align, $width, $height, $cache, $render) {
global $conf;
$link = array();
@ -1852,7 +1835,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param array $atts - additional attributes for the <video> tag
* @return string
*/
function _video($src, $width, $height, $atts = null) {
public function _video($src, $width, $height, $atts = null) {
// prepare width and height
if(is_null($atts)) $atts = array();
$atts['width'] = (int) $width;
@ -1935,7 +1918,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @param array $atts - additional attributes for the <audio> tag
* @return string
*/
function _audio($src, $atts = array()) {
public function _audio($src, $atts = array()) {
$files = array();
$isExternal = media_isexternal($src);
@ -1994,7 +1977,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @access protected
* @return string revision ('' for current)
*/
function _getLastMediaRevisionAt($media_id){
protected function _getLastMediaRevisionAt($media_id){
if(!$this->date_at || media_isexternal($media_id)) return '';
$pagelog = new MediaChangeLog($media_id);
return $pagelog->getLastRevisionAt($this->date_at);

View File

@ -18,32 +18,25 @@ class Doku_Renderer_xhtmlsummary extends Doku_Renderer_xhtml {
// Namespace these variables to
// avoid clashes with parent classes
var $sum_paragraphs = 0;
var $sum_capture = true;
var $sum_inSection = false;
var $sum_summary = '';
var $sum_pageTitle = false;
protected $sum_paragraphs = 0;
protected $sum_capture = true;
protected $sum_inSection = false;
protected $sum_summary = '';
protected $sum_pageTitle = false;
function document_start() {
/** @inheritdoc */
public function document_start() {
$this->doc .= DOKU_LF.'<div>'.DOKU_LF;
}
function document_end() {
/** @inheritdoc */
public function document_end() {
$this->doc = $this->sum_summary;
$this->doc .= DOKU_LF.'</div>'.DOKU_LF;
}
// FIXME not supported anymore
function toc_open() {
$this->sum_summary .= $this->doc;
}
// FIXME not supported anymore
function toc_close() {
$this->doc = '';
}
function header($text, $level, $pos) {
/** @inheritdoc */
public function header($text, $level, $pos) {
if ( !$this->sum_pageTitle ) {
$this->info['sum_pagetitle'] = $text;
$this->sum_pageTitle = true;
@ -53,27 +46,31 @@ class Doku_Renderer_xhtmlsummary extends Doku_Renderer_xhtml {
$this->doc .= "</h$level>".DOKU_LF;
}
function section_open($level) {
/** @inheritdoc */
public function section_open($level) {
if ( $this->sum_capture ) {
$this->sum_inSection = true;
}
}
function section_close() {
/** @inheritdoc */
public function section_close() {
if ( $this->sum_capture && $this->sum_inSection ) {
$this->sum_summary .= $this->doc;
$this->sum_capture = false;
}
}
function p_open() {
/** @inheritdoc */
public function p_open() {
if ( $this->sum_capture && $this->sum_paragraphs < 2 ) {
$this->sum_paragraphs++;
}
parent :: p_open();
}
function p_close() {
/** @inheritdoc */
public function p_close() {
parent :: p_close();
if ( $this->sum_capture && $this->sum_paragraphs >= 2 ) {
$this->sum_summary .= $this->doc;