diff --git a/Crawler.php b/Crawler.php index f415a76..5a2311f 100644 --- a/Crawler.php +++ b/Crawler.php @@ -1,6 +1,6 @@ renderer instanceof \Doku_Renderer_xhtml) { - $this->renderer->doc .= '
'; + $this->renderer->doc .= '
'; } $this->renderListItems($this->files, $params); @@ -46,7 +46,7 @@ class Output public function renderAsTable($params) { if ($this->renderer instanceof \Doku_Renderer_xhtml) { - $this->renderer->doc .= '
'; + $this->renderer->doc .= '
'; } $items = $this->flattenResultTree($this->files); @@ -277,7 +277,7 @@ class Output protected function getLang($key) { - $syntax = plugin_load('syntax', 'filelistplus'); + $syntax = plugin_load('syntax', 'filetools'); return $syntax->getLang($key); } } diff --git a/Path.php b/Path.php index 9ac5b88..09b5f17 100644 --- a/Path.php +++ b/Path.php @@ -1,6 +1,6 @@ $line, - 'web' => DOKU_BASE . 'lib/plugins/filelistplus/file.php?root=' . rawurlencode($line) . '&file=', + 'web' => DOKU_BASE . 'lib/plugins/filetools/file.php?root=' . rawurlencode($line) . '&file=', ]; } } diff --git a/README b/README index dd5ad88..72e30db 100644 --- a/README +++ b/README @@ -1,14 +1,17 @@ -filelistplus plugin for DokuWiki +File Tools plugin for DokuWiki Lists files matching a given glob pattern. All documentation for this plugin can be found at -https://www.dokuwiki.org/plugin:filelistplus +https://www.dokuwiki.org/plugin:filetools If you install this plugin manually, make sure it is installed in -lib/plugins/filelistplus/ - if the folder is called different it +lib/plugins/filetools/ - if the folder is called different it will not work! +Syntax: + {{files>...}} + Please refer to http://www.dokuwiki.org/extensions for additional info on how to install extensions in DokuWiki. diff --git a/_test/GeneralTest.php b/_test/GeneralTest.php index c2dd6af..a306a2f 100644 --- a/_test/GeneralTest.php +++ b/_test/GeneralTest.php @@ -1,13 +1,13 @@ assertArrayHasKey('desc', $info); $this->assertArrayHasKey('url', $info); - $this->assertEquals('filelistplus', $info['base']); + $this->assertEquals('filetools', $info['base']); $this->assertRegExp('/^https?:\/\//', $info['url']); $this->assertTrue(mail_isvalid($info['email'])); $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); @@ -61,7 +61,7 @@ class GeneralTest extends DokuWikiTest $this->assertEquals( gettype($conf), gettype($meta), - 'Both ' . DOKU_PLUGIN . 'filelistplus/conf/default.php and ' . DOKU_PLUGIN . 'filelistplus/conf/metadata.php have to exist and contain the same keys.' + 'Both ' . DOKU_PLUGIN . 'filetools/conf/default.php and ' . DOKU_PLUGIN . 'filetools/conf/metadata.php have to exist and contain the same keys.' ); if ($conf !== null && $meta !== null) { @@ -69,7 +69,7 @@ class GeneralTest extends DokuWikiTest $this->assertArrayHasKey( $key, $meta, - 'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'filelistplus/conf/metadata.php' + 'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'filetools/conf/metadata.php' ); } @@ -77,7 +77,7 @@ class GeneralTest extends DokuWikiTest $this->assertArrayHasKey( $key, $conf, - 'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'filelistplus/conf/default.php' + 'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'filetools/conf/default.php' ); } } diff --git a/_test/PathTest.php b/_test/PathTest.php index 52cac5f..22b94dd 100644 --- a/_test/PathTest.php +++ b/_test/PathTest.php @@ -1,14 +1,14 @@ [ 'root' => 'C:/xampp/htdocs/wiki/', - 'web' => '/lib/plugins/filelistplus/file.php?root=C%3A%2Fxampp%2Fhtdocs%2Fwiki%2F&file=', + 'web' => '/lib/plugins/filetools/file.php?root=C%3A%2Fxampp%2Fhtdocs%2Fwiki%2F&file=', ], '\\\\server/share/path/' => [ 'root' => '\\\\server/share/path/', - 'web' => '/lib/plugins/filelistplus/file.php?root=%5C%5Cserver%2Fshare%2Fpath%2F&file=', + 'web' => '/lib/plugins/filetools/file.php?root=%5C%5Cserver%2Fshare%2Fpath%2F&file=', ], '/linux/file/path/' => [ 'root' => '/linux/file/path/', - 'web' => '/lib/plugins/filelistplus/file.php?root=%2Flinux%2Ffile%2Fpath%2F&file=', + 'web' => '/lib/plugins/filetools/file.php?root=%2Flinux%2Ffile%2Fpath%2F&file=', ], '/linux/another/path/' => [ 'root' => '/linux/another/path/', diff --git a/_test/SyntaxTest.php b/_test/SyntaxTest.php index 47e7e9a..8a31125 100644 --- a/_test/SyntaxTest.php +++ b/_test/SyntaxTest.php @@ -1,35 +1,35 @@ pluginsEnabled[] = 'filelistplus'; + $this->pluginsEnabled[] = 'filetools'; parent::setUp(); // Setup config so that access to the TMP directory will be allowed - $conf ['plugin']['filelistplus']['paths'] = TMP_DIR . '/filelistdata/' . "\n" . 'W> http://localhost/'; + $conf ['plugin']['filetools']['paths'] = TMP_DIR . '/filelistdata/' . "\n" . 'W> http://localhost/'; } @@ -76,7 +76,7 @@ class plugin_filelistplus_test extends DokuWikiTest global $conf; // Render filelist - $instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=list&direct=1}}'); + $instructions = p_get_instructions('{{files>' . TMP_DIR . '/filelistdata/*&style=list&direct=1}}'); $xhtml = p_render('xhtml', $instructions, $info); // We should find: @@ -94,7 +94,7 @@ class plugin_filelistplus_test extends DokuWikiTest public function test_recursive() { // Render filelist - $instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=list&direct=1&recursive=1}}'); + $instructions = p_get_instructions('{{files>' . TMP_DIR . '/filelistdata/*&style=list&direct=1&recursive=1}}'); $xhtml = p_render('xhtml', $instructions, $info); // We should find: @@ -119,21 +119,21 @@ class plugin_filelistplus_test extends DokuWikiTest public function testUnorderedList() { // Render filelist - $instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=list&direct=1&recursive=1}}'); + $instructions = p_get_instructions('{{files>' . TMP_DIR . '/filelistdata/*&style=list&direct=1&recursive=1}}'); $xhtml = p_render('xhtml', $instructions, $info); $doc = new Document(); $doc->html($xhtml); $structure = [ - 'div.filelistplus-plugin' => 1, - 'div.filelistplus-plugin > ul' => 1, - 'div.filelistplus-plugin > ul > li' => 3, - 'div.filelistplus-plugin > ul > li:nth-child(1)' => 1, - 'div.filelistplus-plugin > ul > li:nth-child(1) a' => 'example.txt', - 'div.filelistplus-plugin > ul > li:nth-child(2) ul' => 1, - 'div.filelistplus-plugin > ul > li:nth-child(2) ul > li' => 1, - 'div.filelistplus-plugin > ul > li:nth-child(2) ul > li a' => 'example2.txt', + 'div.filetools-plugin' => 1, + 'div.filetools-plugin > ul' => 1, + 'div.filetools-plugin > ul > li' => 3, + 'div.filetools-plugin > ul > li:nth-child(1)' => 1, + 'div.filetools-plugin > ul > li:nth-child(1) a' => 'example.txt', + 'div.filetools-plugin > ul > li:nth-child(2) ul' => 1, + 'div.filetools-plugin > ul > li:nth-child(2) ul > li' => 1, + 'div.filetools-plugin > ul > li:nth-child(2) ul > li a' => 'example2.txt', ]; $this->structureCheck($doc, $structure); @@ -146,21 +146,21 @@ class plugin_filelistplus_test extends DokuWikiTest public function testOrderedList() { // Render filelist - $instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=olist&direct=1&recursive=1}}'); + $instructions = p_get_instructions('{{files>' . TMP_DIR . '/filelistdata/*&style=olist&direct=1&recursive=1}}'); $xhtml = p_render('xhtml', $instructions, $info); $doc = new Document(); $doc->html($xhtml); $structure = [ - 'div.filelistplus-plugin' => 1, - 'div.filelistplus-plugin > ol' => 1, - 'div.filelistplus-plugin > ol > li' => 3, - 'div.filelistplus-plugin > ol > li:nth-child(1)' => 1, - 'div.filelistplus-plugin > ol > li:nth-child(1) a' => 'example.txt', - 'div.filelistplus-plugin > ol > li:nth-child(2) ol' => 1, - 'div.filelistplus-plugin > ol > li:nth-child(2) ol > li' => 1, - 'div.filelistplus-plugin > ol > li:nth-child(2) ol > li a' => 'example2.txt', + 'div.filetools-plugin' => 1, + 'div.filetools-plugin > ol' => 1, + 'div.filetools-plugin > ol > li' => 3, + 'div.filetools-plugin > ol > li:nth-child(1)' => 1, + 'div.filetools-plugin > ol > li:nth-child(1) a' => 'example.txt', + 'div.filetools-plugin > ol > li:nth-child(2) ol' => 1, + 'div.filetools-plugin > ol > li:nth-child(2) ol > li' => 1, + 'div.filetools-plugin > ol > li:nth-child(2) ol > li a' => 'example2.txt', ]; $this->structureCheck($doc, $structure); @@ -175,19 +175,19 @@ class plugin_filelistplus_test extends DokuWikiTest global $conf; // Render filelist - $instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=table&direct=1&recursive=1}}'); + $instructions = p_get_instructions('{{files>' . TMP_DIR . '/filelistdata/*&style=table&direct=1&recursive=1}}'); $xhtml = p_render('xhtml', $instructions, $info); $doc = new Document(); $doc->html($xhtml); $structure = [ - 'div.filelistplus-plugin' => 1, - 'div.filelistplus-plugin table' => 1, - 'div.filelistplus-plugin table > tbody > tr' => 3, - 'div.filelistplus-plugin table > tbody > tr:nth-child(1) a' => 'example.txt', - 'div.filelistplus-plugin table > tbody > tr:nth-child(2) a' => 'exampledir/example2.txt', - 'div.filelistplus-plugin table > tbody > tr:nth-child(3) a' => 'exampleimage.png', + 'div.filetools-plugin' => 1, + 'div.filetools-plugin table' => 1, + 'div.filetools-plugin table > tbody > tr' => 3, + 'div.filetools-plugin table > tbody > tr:nth-child(1) a' => 'example.txt', + 'div.filetools-plugin table > tbody > tr:nth-child(2) a' => 'exampledir/example2.txt', + 'div.filetools-plugin table > tbody > tr:nth-child(3) a' => 'exampleimage.png', ]; $this->structureCheck($doc, $structure); diff --git a/conf/default.php b/conf/default.php index c5db900..98e5e5b 100644 --- a/conf/default.php +++ b/conf/default.php @@ -1,7 +1,7 @@ */ diff --git a/file.php b/file.php index 9f4bbbe..33cf229 100644 --- a/file.php +++ b/file.php @@ -2,7 +2,7 @@ // phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols -use dokuwiki\plugin\filelistplus\Path; +use dokuwiki\plugin\filetools\Path; if (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../../'); if (!defined('NOSESSION')) define('NOSESSION', true); // we do not use a session or authentication here (better caching) @@ -11,7 +11,7 @@ require_once(DOKU_INC . 'inc/init.php'); global $INPUT; -$syntax = plugin_load('syntax', 'filelistplus'); +$syntax = plugin_load('syntax', 'filetools'); if (!$syntax) die('plugin disabled?'); $pathUtil = new Path($syntax->getConf('paths')); diff --git a/lang/de/settings.php b/lang/de/settings.php index f8c3751..be23671 100644 --- a/lang/de/settings.php +++ b/lang/de/settings.php @@ -1,3 +1,3 @@ */ -$lang['allow_in_comments'] = 'Of de filelistplus syntax toegestaan is voor gebruik in commentaar.'; +$lang['allow_in_comments'] = 'Of de files syntax toegestaan is voor gebruik in commentaar.'; $lang['defaults'] = 'Default options. Gebruik dezelfde syntax als de inline configuratie.'; $lang['extensions'] = 'Komma-gescheiden lijst van toegestane bestandsextensies voor de lijst.'; diff --git a/plugin.info.txt b/plugin.info.txt index a5f891d..24ccf86 100644 --- a/plugin.info.txt +++ b/plugin.info.txt @@ -1,7 +1,7 @@ -base filelistplus +base filetools author Gina Häußge, Dokufreaks, luxick email dokuwiki@luxick.de date 2026-01-05 -name Filelist Plus Plugin +name File Tools desc Lists files matching a given glob pattern. -url https://www.dokuwiki.org/plugin:filelistplus +url https://www.dokuwiki.org/plugin:filetools diff --git a/syntax.php b/syntax.php index 5184e05..b738b06 100644 --- a/syntax.php +++ b/syntax.php @@ -1,9 +1,9 @@ */ -class syntax_plugin_filelistplus extends SyntaxPlugin +class syntax_plugin_filetools extends SyntaxPlugin { /** @inheritdoc */ public function getType() @@ -34,7 +34,7 @@ class syntax_plugin_filelistplus extends SyntaxPlugin /** @inheritdoc */ public function connectTo($mode) { - $this->Lexer->addSpecialPattern('\{\{filelistplus>.+?\}\}', $mode, 'plugin_filelistplus'); + $this->Lexer->addSpecialPattern('\{\{files>.+?\}\}', $mode, 'plugin_filetools'); } /** @inheritdoc */ @@ -47,7 +47,7 @@ class syntax_plugin_filelistplus extends SyntaxPlugin return false; } - $match = substr($match, strlen('{{filelistplus>'), -2); + $match = substr($match, strlen('{{files>'), -2); [$path, $flags] = explode('&', $match, 2); // load default config options