summaryrefslogtreecommitdiff
path: root/inc/parser/renderer.php
diff options
context:
space:
mode:
authorGuy Brand <gb@unistra.fr>2015-08-10 10:03:27 +0200
committerGuy Brand <gb@unistra.fr>2015-08-10 10:03:27 +0200
commit53a57d16b9c741bb44099fd93bf79efa06796341 (patch)
tree24a90a50afe9325926c8ebaa2ed90f9fa093e5b9 /inc/parser/renderer.php
parentcf6e6645c31a9f185cef3fb9452fb188882ede47 (diff)
parenta060d9973e7c1d5051f2cc426937881826e4972e (diff)
downloadrpg-53a57d16b9c741bb44099fd93bf79efa06796341.tar.gz
rpg-53a57d16b9c741bb44099fd93bf79efa06796341.tar.bz2
Merge branch master into stable
Diffstat (limited to 'inc/parser/renderer.php')
-rw-r--r--inc/parser/renderer.php39
1 files changed, 34 insertions, 5 deletions
diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php
index 09294539e..d7a3faef8 100644
--- a/inc/parser/renderer.php
+++ b/inc/parser/renderer.php
@@ -190,7 +190,7 @@ class Doku_Renderer extends DokuWiki_Plugin {
/**
* Render plain text data
*
- * @param $text
+ * @param string $text
*/
function cdata($text) {
}
@@ -343,8 +343,9 @@ class Doku_Renderer extends DokuWiki_Plugin {
* Open a list item
*
* @param int $level the nesting level
+ * @param bool $node true when a node; false when a leaf
*/
- function listitem_open($level) {
+ function listitem_open($level,$node=false) {
}
/**
@@ -707,6 +708,18 @@ class Doku_Renderer extends DokuWiki_Plugin {
}
/**
+ * Open a table body
+ */
+ function tabletbody_open() {
+ }
+
+ /**
+ * Close a table body
+ */
+ function tabletbody_close() {
+ }
+
+ /**
* Open a table row
*/
function tablerow_open() {
@@ -759,6 +772,9 @@ class Doku_Renderer extends DokuWiki_Plugin {
* casing and special chars
*
* @author Andreas Gohr <andi@splitbrain.org>
+ *
+ * @param string $name
+ * @return string
*/
function _simpleTitle($name) {
global $conf;
@@ -778,6 +794,11 @@ class Doku_Renderer extends DokuWiki_Plugin {
/**
* Resolve an interwikilink
+ *
+ * @param string $shortcut identifier for the interwiki link
+ * @param string $reference fragment that refers the content
+ * @param null|bool $exists reference which returns if an internal page exists
+ * @return string interwikilink
*/
function _resolveInterWiki(&$shortcut, $reference, &$exists = null) {
//get interwiki URL
@@ -785,18 +806,26 @@ class Doku_Renderer extends DokuWiki_Plugin {
$url = $this->interwiki[$shortcut];
} else {
// Default to Google I'm feeling lucky
- $url = 'http://www.google.com/search?q={URL}&amp;btnI=lucky';
+ $url = 'https://www.google.com/search?q={URL}&amp;btnI=lucky';
$shortcut = 'go';
}
//split into hash and url part
- @list($reference, $hash) = explode('#', $reference, 2);
+ $hash = strrchr($reference, '#');
+ if($hash) {
+ $reference = substr($reference, 0, -strlen($hash));
+ $hash = substr($hash, 1);
+ }
//replace placeholder
if(preg_match('#\{(URL|NAME|SCHEME|HOST|PORT|PATH|QUERY)\}#', $url)) {
//use placeholders
$url = str_replace('{URL}', rawurlencode($reference), $url);
- $url = str_replace('{NAME}', $reference, $url);
+ //wiki names will be cleaned next, otherwise urlencode unsafe chars
+ $url = str_replace('{NAME}', ($url{0} === ':') ? $reference :
+ preg_replace_callback('/[[\\\\\]^`{|}#%]/', function($match) {
+ return rawurlencode($match[0]);
+ }, $reference), $url);
$parsed = parse_url($reference);
if(!$parsed['port']) $parsed['port'] = 80;
$url = str_replace('{SCHEME}', $parsed['scheme'], $url);