diff options
author | Esther Brunner <esther@kaffeehaus.ch> | 2005-08-16 21:23:01 +0200 |
---|---|---|
committer | Esther Brunner <esther@kaffeehaus.ch> | 2005-08-16 21:23:01 +0200 |
commit | 2ca1433524ebb3770ae90ae971572fde80c773b7 (patch) | |
tree | 80a51a275399c80a88f6bb520cd6f8c43c06564e /inc/parser/xhtml.php | |
parent | bc54ab520f404e26a95af051e9082aa8fad07d98 (diff) | |
download | rpg-2ca1433524ebb3770ae90ae971572fde80c773b7.tar.gz rpg-2ca1433524ebb3770ae90ae971572fde80c773b7.tar.bz2 |
fileicons for non image media #198
darcs-hash:20050816192301-283c4-764462bd6cef810b4385a228edda3951ff709468.gz
Diffstat (limited to 'inc/parser/xhtml.php')
-rw-r--r-- | inc/parser/xhtml.php | 54 |
1 files changed, 43 insertions, 11 deletions
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 112acc91c..cde1468ac 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -715,9 +715,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= $this->_formatLink($link); } - /** - * @todo don't add link for flash - */ function internalmedia ($src, $title=NULL, $align=NULL, $width=NULL, $height=NULL, $cache=NULL) { global $conf; @@ -735,15 +732,30 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $link['title'] = $this->_xmlEntities($src); list($ext,$mime) = mimetype($src); if(substr($mime,0,5) == 'image'){ - $link['url'] = ml($src,array('id'=>$ID,'cache'=>$cache),false); - }else{ - $link['url'] = ml($src,array('id'=>$ID,'cache'=>$cache),true); - } - $link['name'] = $this->_media ($src, $title, $align, $width, $height, $cache); + // link only jpeg images + // if ($ext != 'jpg' && $ext != 'jpeg') $noLink = TRUE; + $link['url'] = ml($src,array('id'=>$ID,'cache'=>$cache),false); + }elseif($mime == 'application/x-shockwave-flash'){ + // don't link flash movies + $noLink = TRUE; + }else{ + // add file icons + $link['class'] = 'urlextern'; + if(@file_exists(DOKU_INC.'lib/images/fileicons/'.$ext.'.png')){ + $link['style']='background-image: url('.DOKU_BASE.'lib/images/fileicons/'.$ext.'.png)'; + }elseif(@file_exists(DOKU_INC.'lib/images/fileicons/'.$ext.'.gif')){ + $link['style']='background-image: url('.DOKU_BASE.'lib/images/fileicons/'.$ext.'.gif)'; + }else{ + $link['style']='background-image: url('.DOKU_BASE.'lib/images/fileicons/file.gif)'; + } + $link['url'] = ml($src,array('id'=>$ID,'cache'=>$cache),true); + } + $link['name'] = $this->_media ($src, $title, $align, $width, $height, $cache); - //output formatted - $this->doc .= $this->_formatLink($link); + //output formatted + if ($noLink) $this->doc .= $link['name']; + else $this->doc .= $this->_formatLink($link); } /** @@ -766,8 +778,28 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $link['name'] = $this->_media ($src, $title, $align, $width, $height, $cache); + list($ext,$mime) = mimetype($src); + if(substr($mime,0,5) == 'image'){ + // link only jpeg images + // if ($ext != 'jpg' && $ext != 'jpeg') $noLink = TRUE; + }elseif($mime == 'application/x-shockwave-flash'){ + // don't link flash movies + $noLink = TRUE; + }else{ + // add file icons + $link['class'] = 'urlextern'; + if(@file_exists(DOKU_INC.'lib/images/fileicons/'. $ext.'.png')){ + $link['style']='background-image: url('.DOKU_BASE.'lib/images/fileicons/'.$ext.'.png)'; + }elseif(@file_exists(DOKU_INC.'lib/images/fileicons/'.$ext.'.gif')){ + $link['style']='background-image: url('.DOKU_BASE.'lib/images/fileicons/'.$ext.'.gif)'; + }else{ + $link['style']='background-image: url('.DOKU_BASE.'lib/images/fileicons/file.gif)'; + } + } + //output formatted - $this->doc .= $this->_formatLink($link); + if ($noLink) $this->doc .= $link['name']; + else $this->doc .= $this->_formatLink($link); } /** |