diff --git a/Crawler.php b/Crawler.php index 8fb777e..e8d4ccb 100644 --- a/Crawler.php +++ b/Crawler.php @@ -4,7 +4,6 @@ namespace dokuwiki\plugin\filelist; class Crawler { - /** @var string regexp to check extensions */ protected $ext; diff --git a/Path.php b/Path.php index 01c85a3..82944dc 100644 --- a/Path.php +++ b/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,11 +56,11 @@ 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, - 'web' => DOKU_BASE . 'lib/plugins/filelist/file.php?root=' . rawurlencode($line).'&file=', + 'web' => DOKU_BASE . 'lib/plugins/filelist/file.php?root=' . rawurlencode($line) . '&file=', ]; } } @@ -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) . ')/'; diff --git a/file.php b/file.php index e89049b..e3f5b9d 100644 --- a/file.php +++ b/file.php @@ -1,5 +1,7 @@ getMessage(); exit; } - diff --git a/syntax.php b/syntax.php index efd95da..86c2733 100644 --- a/syntax.php +++ b/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; - } - }