Added option 'randlinks' to create random links with a timestamp attached to it as a URL parameter.
This prevents the referenced resource from being cached. The user will see the latest version of a file if he clicks on it, at least after refreshing the page. See #9.
This commit is contained in:
@@ -96,6 +96,7 @@ class syntax_plugin_filelist extends DokuWiki_Syntax_Plugin {
|
|||||||
'recursive' => 0,
|
'recursive' => 0,
|
||||||
'titlefile' => '_title.txt',
|
'titlefile' => '_title.txt',
|
||||||
'cache' => 0,
|
'cache' => 0,
|
||||||
|
'randlinks' => 0,
|
||||||
);
|
);
|
||||||
foreach($flags as $flag) {
|
foreach($flags as $flag) {
|
||||||
list($name, $value) = explode('=', $flag);
|
list($name, $value) = explode('=', $flag);
|
||||||
@@ -216,10 +217,14 @@ class syntax_plugin_filelist extends DokuWiki_Syntax_Plugin {
|
|||||||
$link['suf'] = '';
|
$link['suf'] = '';
|
||||||
$link['more'] = '';
|
$link['more'] = '';
|
||||||
$link['class'] = 'media';
|
$link['class'] = 'media';
|
||||||
|
$urlparams = '';
|
||||||
|
if ($params['randlinks']) {
|
||||||
|
$urlparams = '?'.time();
|
||||||
|
}
|
||||||
if (!$params['direct']) {
|
if (!$params['direct']) {
|
||||||
$link['url'] = ml(':'.$this->_convert_mediapath($filepath));
|
$link['url'] = ml(':'.$this->_convert_mediapath($filepath)).$urlparams;
|
||||||
} else {
|
} else {
|
||||||
$link['url'] = $webdir.substr($filepath, strlen($basedir));
|
$link['url'] = $webdir.substr($filepath, strlen($basedir)).$urlparams;
|
||||||
}
|
}
|
||||||
$link['name'] = $filename;
|
$link['name'] = $filename;
|
||||||
$link['title'] = $renderer->_xmlEntities($link['url']);
|
$link['title'] = $renderer->_xmlEntities($link['url']);
|
||||||
|
|||||||
Reference in New Issue
Block a user