diff options
Diffstat (limited to 'inc/parser')
-rw-r--r-- | inc/parser/xhtml.php | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index fd02c0ce0..2070c3af6 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -28,6 +28,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // @access public var $doc = ''; // will contain the whole document var $toc = array(); // will contain the Table of Contents + var $date_at = ''; // link pages and media against this revision var $sectionedits = array(); // A stack of section edit data private $lastsecid = 0; // last section edit id, used by startSectionEdit @@ -618,6 +619,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } $link['more'] = ''; $link['class'] = $class; + if($this->date_at) { + $params['at'] = $this->date_at; + } $link['url'] = wl($id, $params); $link['name'] = $name; $link['title'] = $id; @@ -792,7 +796,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { list($ext,$mime,$dl) = mimetype($src,false); if(substr($mime,0,5) == 'image' && $render){ - $link['url'] = ml($src,array('id'=>$ID,'cache'=>$cache),($linking=='direct')); + $link['url'] = ml($src,array('id'=>$ID,'cache'=>$cache,'rev'=>$this->_getLastMediaRevisionAt($src)),($linking=='direct')); }elseif($mime == 'application/x-shockwave-flash' && $render){ // don't link flash movies $noLink = true; @@ -800,7 +804,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // add file icons $class = preg_replace('/[^_\-a-z0-9]+/i','_',$ext); $link['class'] .= ' mediafile mf_'.$class; - $link['url'] = ml($src,array('id'=>$ID,'cache'=>$cache),true); + $link['url'] = ml($src,array('id'=>$ID,'cache'=>$cache,'rev'=>$this->_getLastMediaRevisionAt($src)),true); if ($exists) $link['title'] .= ' (' . filesize_h(filesize(mediaFN($src))).')'; } @@ -1048,7 +1052,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $height=null, $cache=null, $render = true) { $ret = ''; - list($ext,$mime,$dl) = mimetype($src); if(substr($mime,0,5) == 'image'){ // first get the $title @@ -1073,7 +1076,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { return $title; } //add image tag - $ret .= '<img src="'.ml($src,array('w'=>$width,'h'=>$height,'cache'=>$cache)).'"'; + $ret .= '<img src="'.ml($src,array('w'=>$width,'h'=>$height,'cache'=>$cache,'rev'=>$this->_getLastMediaRevisionAt($src))).'"'; $ret .= ' class="media'.$align.'"'; if ($title) { @@ -1221,6 +1224,21 @@ class Doku_Renderer_xhtml extends Doku_Renderer { return $link; } + + /** + * _getLastMediaRevisionAt is a helperfunction to internalmedia() and _media() + * which returns an existing media revision less or equal to rev or date_at + * + * @author lisps + * @param string $media_id + * @access protected + * @return string revision ('' for current) + */ + function _getLastMediaRevisionAt($media_id){ + if(!$this->date_at || media_isexternal($media_id)) return ''; + $pagelog = new MediaChangeLog($media_id); + return $pagelog->getLastRevisionAt($this->date_at); + } } |