From 7c2f8eec8f8dbd26e20f8afc516e38d5c6f1cc02 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Fri, 14 Feb 2014 23:54:54 +0100 Subject: handle interwiki without slashes as pageids. Added user interwiki * allowed urlparams * added `wiki:users:` as default user profile link --- inc/parser/xhtml.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 80701cd2e..fbdd8ada6 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -699,6 +699,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { //get interwiki URL $url = $this->_resolveInterWiki($wikiName,$wikiUri); + if(strpos($url,'/') === false) { + list($url, $urlparam) = explode('?', $url, 2); + $url = wl($url, $urlparam); + } + if ( !$isImage ) { $class = preg_replace('/[^_\-a-z0-9]+/i','_',$wikiName); $link['class'] = "interwiki iw_$class"; -- cgit v1.2.3 From b3d353e634614780173506006921f7545ca81305 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Sat, 15 Feb 2014 00:00:24 +0100 Subject: wikilink needs wiki target as well --- inc/parser/xhtml.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index fbdd8ada6..957dd992b 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -702,6 +702,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { if(strpos($url,'/') === false) { list($url, $urlparam) = explode('?', $url, 2); $url = wl($url, $urlparam); + $link['target'] = $conf['target']['wiki']; } if ( !$isImage ) { -- cgit v1.2.3 From 2345e871e407dbece52f3181cd8b077f07cbb0c1 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Sat, 15 Feb 2014 11:11:15 +0100 Subject: wikilink creating refactored to _resolveinterwiki(). Added DOKU_BASE for local target --- inc/parser/xhtml.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 957dd992b..f0a507721 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -699,12 +699,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer { //get interwiki URL $url = $this->_resolveInterWiki($wikiName,$wikiUri); - if(strpos($url,'/') === false) { - list($url, $urlparam) = explode('?', $url, 2); - $url = wl($url, $urlparam); - $link['target'] = $conf['target']['wiki']; - } - if ( !$isImage ) { $class = preg_replace('/[^_\-a-z0-9]+/i','_',$wikiName); $link['class'] = "interwiki iw_$class"; @@ -713,7 +707,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } //do we stay at the same server? Use local target - if( strpos($url,DOKU_URL) === 0 ){ + if( strpos($url,DOKU_URL) === 0 OR strpos($url,DOKU_BASE) === 0){ $link['target'] = $conf['target']['wiki']; } -- cgit v1.2.3 From 5a9ce44695f44ecc76f356c1fc26f0a1846231b7 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Sat, 15 Feb 2014 11:17:09 +0100 Subject: code reformatting --- inc/parser/xhtml.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index f0a507721..20cd8e9d6 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -685,7 +685,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } /** - */ + */ function interwikilink($match, $name = null, $wikiName, $wikiUri) { global $conf; @@ -697,17 +697,17 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $link['name'] = $this->_getLinkTitle($name, $wikiUri, $isImage); //get interwiki URL - $url = $this->_resolveInterWiki($wikiName,$wikiUri); + $url = $this->_resolveInterWiki($wikiName, $wikiUri); - if ( !$isImage ) { - $class = preg_replace('/[^_\-a-z0-9]+/i','_',$wikiName); + if(!$isImage) { + $class = preg_replace('/[^_\-a-z0-9]+/i', '_', $wikiName); $link['class'] = "interwiki iw_$class"; } else { $link['class'] = 'media'; } //do we stay at the same server? Use local target - if( strpos($url,DOKU_URL) === 0 OR strpos($url,DOKU_BASE) === 0){ + if(strpos($url, DOKU_URL) === 0 OR strpos($url, DOKU_BASE) === 0) { $link['target'] = $conf['target']['wiki']; } -- cgit v1.2.3 From 6496c33fc8e98f6e3acaaa5db0234d9c07bec4fe Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Sat, 15 Feb 2014 14:34:26 +0100 Subject: interwiki : prefixed configurls handled as wikilinks --- inc/parser/xhtml.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 20cd8e9d6..53a4dbcad 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -697,7 +697,8 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $link['name'] = $this->_getLinkTitle($name, $wikiUri, $isImage); //get interwiki URL - $url = $this->_resolveInterWiki($wikiName, $wikiUri); + $exists = null; + $url = $this->_resolveInterWiki($wikiName, $wikiUri, $exists); if(!$isImage) { $class = preg_replace('/[^_\-a-z0-9]+/i', '_', $wikiName); @@ -710,6 +711,14 @@ class Doku_Renderer_xhtml extends Doku_Renderer { if(strpos($url, DOKU_URL) === 0 OR strpos($url, DOKU_BASE) === 0) { $link['target'] = $conf['target']['wiki']; } + if($exists !== null && !$isImage) { + if($exists) { + $link['class'] .= ' wikilink1'; + } else { + $link['class'] .= ' wikilink2'; + $link['rel'] = 'nofollow'; + } + } $link['url'] = $url; $link['title'] = htmlspecialchars($link['url']); -- cgit v1.2.3 From 17954bb5e3033069554ebb963fb9040c52b4760b Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sat, 15 Feb 2014 22:46:32 +0000 Subject: added title to video/audio tags, use title for fallback links, refactored duplicate code --- inc/parser/xhtml.php | 51 ++++++++++++++++----------------------------------- 1 file changed, 16 insertions(+), 35 deletions(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 80701cd2e..9d75c271d 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -1096,48 +1096,30 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $ret .= ' />'; - }elseif(media_supportedav($mime, 'video')){ + }elseif(media_supportedav($mime, 'video') || media_supportedav($mime, 'audio')){ // first get the $title - if (!is_null($title)) { - $title = $this->_xmlEntities($title); - } - if (!$title) { - // just show the sourcename - $title = $this->_xmlEntities(utf8_basename(noNS($src))); - } + $title = !is_null($title) ? $this->_xmlEntities($title) : false; if (!$render) { - // if the video is not supposed to be rendered - // return the title of the video - return $title; + // if the file is not supposed to be rendered + // return the title of the file (just the sourcename if there is no title) + return $title ? $title : $this->_xmlEntities(utf8_basename(noNS($src))); } $att = array(); $att['class'] = "media$align"; - - //add video(s) - $ret .= $this->_video($src, $width, $height, $att); - - }elseif(media_supportedav($mime, 'audio')){ - // first get the $title - if (!is_null($title)) { - $title = $this->_xmlEntities($title); + if ($title) { + $att['title'] = $title; } - if (!$title) { - // just show the sourcename - $title = $this->_xmlEntities(utf8_basename(noNS($src))); + + if (media_supportedav($mime, 'video')) { + //add video + $ret .= $this->_video($src, $width, $height, $att); } - if (!$render) { - // if the video is not supposed to be rendered - // return the title of the video - return $title; + if (media_supportedav($mime, 'audio')) { + //add audio + $ret .= $this->_audio($src, $att); } - $att = array(); - $att['class'] = "media$align"; - - //add audio - $ret .= $this->_audio($src, $att); - }elseif($mime == 'application/x-shockwave-flash'){ if (!$render) { // if the flash is not supposed to be rendered @@ -1282,7 +1264,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * @return string */ function _video($src,$width,$height,$atts=null){ - // prepare width and height if(is_null($atts)) $atts = array(); $atts['width'] = (int) $width; @@ -1309,7 +1290,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // output source for each alternative video format foreach($alternatives as $mime => $file) { $url = ml($file,array('cache'=>$cache),true,'&'); - $title = $this->_xmlEntities(utf8_basename(noNS($file))); + $title = $atts['title'] ? $atts['title'] : $this->_xmlEntities(utf8_basename(noNS($file))); $out .= ''.NL; // alternative content (just a link to the file) @@ -1345,7 +1326,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // output source for each alternative audio format foreach($alternatives as $mime => $file) { $url = ml($file,array('cache'=>$cache),true,'&'); - $title = $this->_xmlEntities(utf8_basename(noNS($file))); + $title = $atts['title'] ? $atts['title'] : $this->_xmlEntities(utf8_basename(noNS($file))); $out .= ''.NL; // alternative content (just a link to the file) -- cgit v1.2.3 From f23eef27e07dfe76ab76fda68242d44de10e4022 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Mon, 17 Feb 2014 17:56:58 +0100 Subject: PHPDocs internallink --- inc/parser/xhtml.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 9d75c271d..315b4d640 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -562,6 +562,12 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * $search,$returnonly & $linktype are not for the renderer but are used * elsewhere - no need to implement them in other renderers * + * @param string $id pageid + * @param string|null $name link name + * @param string|null $search adds search url param + * @param bool $returnonly whether to return html or write to doc attribute + * @param string $linktype type to set use of headings + * @return void|string writes to doc attribute or returns html depends on $returnonly * @author Andreas Gohr */ function internallink($id, $name = null, $search=null,$returnonly=false,$linktype='content') { -- cgit v1.2.3 From 2ada8709d3a0cea872f117823b244b400fac5f87 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Tue, 25 Feb 2014 20:32:56 +0000 Subject: add renderers to autolader --- inc/parser/xhtml.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 315b4d640..184e62fe3 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -17,9 +17,6 @@ if ( !defined('DOKU_TAB') ) { define ('DOKU_TAB',"\t"); } -require_once DOKU_INC . 'inc/parser/renderer.php'; -require_once DOKU_INC . 'inc/html.php'; - /** * The Renderer */ -- cgit v1.2.3 From 6d2af55dde922ac10a288b4195b1bf338e7bc5a9 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Wed, 5 Mar 2014 22:01:20 +0000 Subject: suppress errors where list() may not fill all vars --- inc/parser/xhtml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 184e62fe3..4966f103a 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -606,7 +606,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } //keep hash anchor - list($id,$hash) = explode('#',$id,2); + @list($id,$hash) = explode('#',$id,2); if(!empty($hash)) $hash = $this->_headerToLink($hash); //prepare for formating -- cgit v1.2.3