Allow opening folder lisings on client
Some checks failed
DokuWiki Default Tasks / all (push) Has been cancelled
Some checks failed
DokuWiki Default Tasks / all (push) Has been cancelled
This commit is contained in:
30
Output.php
30
Output.php
@@ -16,6 +16,9 @@ class Output
|
||||
/** @var array */
|
||||
protected $files;
|
||||
|
||||
/** @var Path|false|null */
|
||||
protected $openPathMapper = null;
|
||||
|
||||
|
||||
public function __construct(\Doku_Renderer $renderer, $basedir, $webdir, $files)
|
||||
{
|
||||
@@ -307,6 +310,8 @@ class Output
|
||||
return;
|
||||
}
|
||||
|
||||
$path = $this->mapOpenPath($path);
|
||||
|
||||
global $conf;
|
||||
/** @var \Doku_Renderer_xhtml $renderer */
|
||||
$renderer = $this->renderer;
|
||||
@@ -336,6 +341,31 @@ class Output
|
||||
$renderer->doc .= $renderer->_formatLink($link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map a filesystem path to an alias path (if configured).
|
||||
*
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
protected function mapOpenPath($path)
|
||||
{
|
||||
if ($this->openPathMapper === false) return $path;
|
||||
|
||||
if ($this->openPathMapper === null) {
|
||||
$syntax = plugin_load('syntax', 'luxtools');
|
||||
$pathConfig = $syntax ? (string)$syntax->getConf('paths') : '';
|
||||
|
||||
if (trim($pathConfig) === '') {
|
||||
$this->openPathMapper = false;
|
||||
return $path;
|
||||
}
|
||||
|
||||
$this->openPathMapper = new Path($pathConfig);
|
||||
}
|
||||
|
||||
return $this->openPathMapper->mapToAliasPath($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a file link on the XHTML renderer
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user