diff options
author | lisps <stummp@loewen.de> | 2014-03-19 08:07:16 +0100 |
---|---|---|
committer | lisps <stummp@loewen.de> | 2014-03-19 08:07:16 +0100 |
commit | e310313d794a3336d279ee09973508e794dbf08e (patch) | |
tree | 7f90b51d344f7163c6fbb109f04ff22dea5ae129 /inc/parser/renderer.php | |
parent | cdb5e9613f7c4b1be4515715652aca451493d5d5 (diff) | |
parent | 177ef92c4ddd38cb906dd7d5f0208c698048cd57 (diff) | |
download | rpg-e310313d794a3336d279ee09973508e794dbf08e.tar.gz rpg-e310313d794a3336d279ee09973508e794dbf08e.tar.bz2 |
Merge remote-tracking branch 'remotes/origin/master' into revisions_local
Diffstat (limited to 'inc/parser/renderer.php')
-rw-r--r-- | inc/parser/renderer.php | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index e3401fd48..0c3c56c56 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -6,8 +6,6 @@ * @author Andreas Gohr <andi@splitbrain.org> */ if(!defined('DOKU_INC')) die('meh.'); -require_once DOKU_INC . 'inc/plugin.php'; -require_once DOKU_INC . 'inc/pluginutils.php'; /** * An empty renderer, produces no output @@ -273,17 +271,17 @@ class Doku_Renderer extends DokuWiki_Plugin { * * @author Andreas Gohr <andi@splitbrain.org> */ - function _simpleTitle($name){ + function _simpleTitle($name) { global $conf; //if there is a hash we use the ancor name only - list($name,$hash) = explode('#',$name,2); + @list($name, $hash) = explode('#', $name, 2); if($hash) return $hash; - if($conf['useslash']){ - $name = strtr($name,';/',';:'); - }else{ - $name = strtr($name,';',':'); + if($conf['useslash']) { + $name = strtr($name, ';/', ';:'); + } else { + $name = strtr($name, ';', ':'); } return noNSorNS($name); @@ -292,9 +290,9 @@ class Doku_Renderer extends DokuWiki_Plugin { /** * Resolve an interwikilink */ - function _resolveInterWiki(&$shortcut,$reference){ + function _resolveInterWiki(&$shortcut, $reference, &$exists=null) { //get interwiki URL - if ( isset($this->interwiki[$shortcut]) ) { + if(isset($this->interwiki[$shortcut])) { $url = $this->interwiki[$shortcut]; } else { // Default to Google I'm feeling lucky @@ -303,25 +301,31 @@ class Doku_Renderer extends DokuWiki_Plugin { } //split into hash and url part - list($reference,$hash) = explode('#',$reference,2); + @list($reference, $hash) = explode('#', $reference, 2); //replace placeholder - if(preg_match('#\{(URL|NAME|SCHEME|HOST|PORT|PATH|QUERY)\}#',$url)){ + 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); + $url = str_replace('{URL}', rawurlencode($reference), $url); + $url = str_replace('{NAME}', $reference, $url); $parsed = parse_url($reference); if(!$parsed['port']) $parsed['port'] = 80; - $url = str_replace('{SCHEME}',$parsed['scheme'],$url); - $url = str_replace('{HOST}',$parsed['host'],$url); - $url = str_replace('{PORT}',$parsed['port'],$url); - $url = str_replace('{PATH}',$parsed['path'],$url); - $url = str_replace('{QUERY}',$parsed['query'],$url); - }else{ + $url = str_replace('{SCHEME}', $parsed['scheme'], $url); + $url = str_replace('{HOST}', $parsed['host'], $url); + $url = str_replace('{PORT}', $parsed['port'], $url); + $url = str_replace('{PATH}', $parsed['path'], $url); + $url = str_replace('{QUERY}', $parsed['query'], $url); + } else { //default - $url = $url.rawurlencode($reference); + $url = $url . rawurlencode($reference); + } + //handle as wiki links + if($url{0} === ':') { + list($id, $urlparam) = explode('?', $url, 2); + $url = wl(cleanID($id), $urlparam); + $exists = page_exists($id); } - if($hash) $url .= '#'.rawurlencode($hash); + if($hash) $url .= '#' . rawurlencode($hash); return $url; } |