diff options
author | joe.lapp <joe.lapp@pobox.com> | 2005-09-15 05:23:48 +0200 |
---|---|---|
committer | joe.lapp <joe.lapp@pobox.com> | 2005-09-15 05:23:48 +0200 |
commit | dc673a5b4730b9b706001e8f06ded3dc9986908c (patch) | |
tree | 0379f7a7020605d48adf556d6c9e427dacea0151 /inc/parser | |
parent | d190794c06440de91345d1dfbc0440dbe766e5e8 (diff) | |
download | rpg-dc673a5b4730b9b706001e8f06ded3dc9986908c.tar.gz rpg-dc673a5b4730b9b706001e8f06ded3dc9986908c.tar.bz2 |
Added media 'nolink' and 'direct' options
{{image.jpg?nolink}}
darcs-hash:20050915032348-36b45-f298b21de05001cd9a56b4859bf265079b57bf69.gz
Diffstat (limited to 'inc/parser')
-rw-r--r-- | inc/parser/handler.php | 15 | ||||
-rw-r--r-- | inc/parser/xhtml.php | 11 |
2 files changed, 18 insertions, 8 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php index 55cbcf342..20a9433bd 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -459,7 +459,8 @@ class Doku_Handler { $this->_addCall( $p['type'], - array($p['src'], $p['title'], $p['align'], $p['width'], $p['height'], $p['cache']), + array($p['src'], $p['title'], $p['align'], $p['width'], + $p['height'], $p['cache'], $p['linking']), $pos ); return TRUE; @@ -589,13 +590,22 @@ function Doku_Handler_Parse_Media($match) { ($size[3]) ? $h = $size[3] : $h = NULL; } + //get linking command + if(preg_match('/nolink/i',$param)){ + $linking = 'nolink'; + }else if(preg_match('/direct/i',$param)){ + $linking = 'direct'; + }else{ + $linking = 'details'; + } + //get caching command if (preg_match('/(nocache|recache)/i',$param,$cachemode)){ $cache = $cachemode[1]; }else{ $cache = 'cache'; } - + // Check whether this is a local or remote image if ( preg_match('#^(https?|ftp)#i',$src) ) { $call = 'externalmedia'; @@ -611,6 +621,7 @@ function Doku_Handler_Parse_Media($match) { 'width'=>$w, 'height'=>$h, 'cache'=>$cache, + 'linking'=>$linking, ); return $params; diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 3ae3c49d1..7c7370943 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -689,7 +689,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } function internalmedia ($src, $title=NULL, $align=NULL, $width=NULL, - $height=NULL, $cache=NULL) { + $height=NULL, $cache=NULL, $linking=NULL) { global $conf; global $ID; resolve_mediaid(getNS($ID),$src, $exists); @@ -707,7 +707,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { if(substr($mime,0,5) == 'image'){ // link only jpeg images // if ($ext != 'jpg' && $ext != 'jpeg') $noLink = TRUE; - $link['url'] = ml($src,array('id'=>$ID,'cache'=>$cache),false); + $link['url'] = ml($src,array('id'=>$ID,'cache'=>$cache),($linking=='direct')); }elseif($mime == 'application/x-shockwave-flash'){ // don't link flash movies $noLink = TRUE; @@ -725,9 +725,8 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } $link['name'] = $this->_media ($src, $title, $align, $width, $height, $cache); - //output formatted - if ($noLink) $this->doc .= $link['name']; + if ($linking == 'nolink' || $noLink) $this->doc .= $link['name']; else $this->doc .= $this->_formatLink($link); } @@ -735,7 +734,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * @todo don't add link for flash */ function externalmedia ($src, $title=NULL, $align=NULL, $width=NULL, - $height=NULL, $cache=NULL) { + $height=NULL, $cache=NULL, $linking=NULL) { global $conf; $link = array(); @@ -771,7 +770,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } //output formatted - if ($noLink) $this->doc .= $link['name']; + if ($linking == 'nolink' || $noLink) $this->doc .= $link['name']; else $this->doc .= $this->_formatLink($link); } |