style cleanup
This commit is contained in:
@@ -4,7 +4,6 @@ namespace dokuwiki\plugin\filelist;
|
||||
|
||||
class Crawler
|
||||
{
|
||||
|
||||
/** @var string regexp to check extensions */
|
||||
protected $ext;
|
||||
|
||||
|
||||
10
Path.php
10
Path.php
@@ -46,7 +46,7 @@ class Path
|
||||
// this is an alias for the last read root
|
||||
$line = trim(substr($line, 2));
|
||||
if (!isset($paths[$lastRoot])) continue; // no last root, no alias
|
||||
$alias = $this->cleanPath($line);
|
||||
$alias = static::cleanPath($line);
|
||||
$paths[$lastRoot]['alias'] = $alias;
|
||||
$paths[$alias] = &$paths[$lastRoot]; // alias references the original
|
||||
} elseif (str_starts_with($line, 'W>')) {
|
||||
@@ -56,7 +56,7 @@ class Path
|
||||
$paths[$lastRoot]['web'] = $line;
|
||||
} else {
|
||||
// this is a new path
|
||||
$line = $this->cleanPath($line);
|
||||
$line = static::cleanPath($line);
|
||||
$lastRoot = $line;
|
||||
$paths[$line] = [
|
||||
'root' => $line,
|
||||
@@ -78,13 +78,11 @@ class Path
|
||||
*/
|
||||
public function getPathInfo($path, $addTrailingSlash = true)
|
||||
{
|
||||
$path = $this->cleanPath($path, $addTrailingSlash);
|
||||
$path = static::cleanPath($path, $addTrailingSlash);
|
||||
|
||||
$paths = $this->paths;
|
||||
$allowed = array_keys($paths);
|
||||
usort($allowed, function ($a, $b) {
|
||||
return strlen($a) - strlen($b);
|
||||
});
|
||||
usort($allowed, static fn($a, $b) => strlen($a) - strlen($b));
|
||||
$allowed = array_map('preg_quote_cb', $allowed);
|
||||
$regex = '/^(' . implode('|', $allowed) . ')/';
|
||||
|
||||
|
||||
3
file.php
3
file.php
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
|
||||
|
||||
use dokuwiki\plugin\filelist\Path;
|
||||
|
||||
if (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../../');
|
||||
@@ -37,4 +39,3 @@ try {
|
||||
echo $e->getMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
14
syntax.php
14
syntax.php
@@ -88,7 +88,7 @@ class syntax_plugin_filelist extends SyntaxPlugin
|
||||
$path = Path::cleanPath($path, false);
|
||||
$parts = explode('/', $path);
|
||||
$pattern = array_pop($parts);
|
||||
$base = join('/', $parts) . '/';
|
||||
$base = implode('/', $parts) . '/';
|
||||
|
||||
return [$base, $pattern, $params];
|
||||
}
|
||||
@@ -121,7 +121,14 @@ class syntax_plugin_filelist extends SyntaxPlugin
|
||||
$crawler = new Crawler($this->getConf('extensions'));
|
||||
$crawler->setSortBy($params['sort']);
|
||||
$crawler->setSortReverse($params['order'] === 'desc');
|
||||
$result = $crawler->crawl($pathInfo['root'], $pathInfo['local'], $pattern, $params['recursive'], $params['titlefile']);
|
||||
|
||||
$result = $crawler->crawl(
|
||||
$pathInfo['root'],
|
||||
$pathInfo['local'],
|
||||
$pattern,
|
||||
$params['recursive'],
|
||||
$params['titlefile']
|
||||
);
|
||||
|
||||
// if we got nothing back, display a message
|
||||
if ($result == []) {
|
||||
@@ -139,10 +146,7 @@ class syntax_plugin_filelist extends SyntaxPlugin
|
||||
case 'table':
|
||||
$output->renderAsTable($params);
|
||||
break;
|
||||
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user