summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/html.php17
-rw-r--r--inc/parser/xhtml.php8
2 files changed, 13 insertions, 12 deletions
diff --git a/inc/html.php b/inc/html.php
index 42aba6965..06060e2db 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -15,19 +15,14 @@
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function html_wikilink($url,$name='',$search=''){
- global $conf;
- $link = array();
- $link['url'] = $url;
- $link['name'] = $name;
- $link = format_link_wiki($link);
-
- if($search){
- ($conf['userewrite']) ? $link['url'].='?s=' : $link['url'].='&amp;s=';
- $link['url'] .= urlencode($search);
+function html_wikilink($id,$name='',$search=''){
+ require_once(DOKU_INC.'inc/parser/xhtml.php');
+ static $xhtml_renderer = NULL;
+ if(is_null($xhtml_renderer)){
+ $xhtml_renderer = new Doku_Renderer_xhtml();
}
- return format_link_build($link);
+ return $xhtml_renderer->internallink($id,$name,$search);
}
/**
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index 52efa9f72..0b1531a65 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -388,7 +388,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$this->internallink($link,$link);
}
- function internallink($id, $name = NULL) {
+ function internallink($id, $name = NULL, $search=NULL) {
global $conf;
$name = $this->_getLinkTitle($name, $this->_simpleTitle($id), $isImage, $id);
@@ -415,6 +415,12 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$link['name'] = $name;
$link['title'] = $id;
+ //add search string
+ if($search){
+ ($conf['userewrite']) ? $link['url'].='?s=' : $link['url'].='&amp;s=';
+ $link['url'] .= urlencode($search);
+ }
+
//output formatted
echo $this->_formatLink($link);
}