Change project name to File List Plus

This commit is contained in:
2026-01-05 10:29:34 +01:00
parent 83e348f31e
commit a3558c470e
15 changed files with 78 additions and 78 deletions

View File

@@ -1,6 +1,6 @@
<?php <?php
namespace dokuwiki\plugin\filelist; namespace dokuwiki\plugin\filelistplus;
class Crawler class Crawler
{ {

View File

@@ -1,6 +1,6 @@
<?php <?php
namespace dokuwiki\plugin\filelist; namespace dokuwiki\plugin\filelistplus;
class Output class Output
{ {
@@ -28,7 +28,7 @@ class Output
public function renderAsList($params) public function renderAsList($params)
{ {
if ($this->renderer instanceof \Doku_Renderer_xhtml) { if ($this->renderer instanceof \Doku_Renderer_xhtml) {
$this->renderer->doc .= '<div class="filelist-plugin">'; $this->renderer->doc .= '<div class="filelistplus-plugin">';
} }
$this->renderListItems($this->files, $params); $this->renderListItems($this->files, $params);
@@ -46,7 +46,7 @@ class Output
public function renderAsTable($params) public function renderAsTable($params)
{ {
if ($this->renderer instanceof \Doku_Renderer_xhtml) { if ($this->renderer instanceof \Doku_Renderer_xhtml) {
$this->renderer->doc .= '<div class="filelist-plugin">'; $this->renderer->doc .= '<div class="filelistplus-plugin">';
} }
$items = $this->flattenResultTree($this->files); $items = $this->flattenResultTree($this->files);
@@ -277,7 +277,7 @@ class Output
protected function getLang($key) protected function getLang($key)
{ {
$syntax = plugin_load('syntax', 'filelist'); $syntax = plugin_load('syntax', 'filelistplus');
return $syntax->getLang($key); return $syntax->getLang($key);
} }
} }

View File

@@ -1,6 +1,6 @@
<?php <?php
namespace dokuwiki\plugin\filelist; namespace dokuwiki\plugin\filelistplus;
class Path class Path
{ {
@@ -60,7 +60,7 @@ class Path
$lastRoot = $line; $lastRoot = $line;
$paths[$line] = [ $paths[$line] = [
'root' => $line, 'root' => $line,
'web' => DOKU_BASE . 'lib/plugins/filelist/file.php?root=' . rawurlencode($line) . '&file=', 'web' => DOKU_BASE . 'lib/plugins/filelistplus/file.php?root=' . rawurlencode($line) . '&file=',
]; ];
} }
} }

6
README
View File

@@ -1,12 +1,12 @@
filelist plugin for DokuWiki filelistplus plugin for DokuWiki
Lists files matching a given glob pattern. Lists files matching a given glob pattern.
All documentation for this plugin can be found at All documentation for this plugin can be found at
https://www.dokuwiki.org/plugin:filelist https://www.dokuwiki.org/plugin:filelistplus
If you install this plugin manually, make sure it is installed in If you install this plugin manually, make sure it is installed in
lib/plugins/filelist/ - if the folder is called different it lib/plugins/filelistplus/ - if the folder is called different it
will not work! will not work!
Please refer to http://www.dokuwiki.org/extensions for additional info Please refer to http://www.dokuwiki.org/extensions for additional info

View File

@@ -1,13 +1,13 @@
<?php <?php
namespace dokuwiki\plugin\filelist\test; namespace dokuwiki\plugin\filelistplus\test;
use DokuWikiTest; use DokuWikiTest;
/** /**
* General tests for the filelist plugin * General tests for the filelistplus plugin
* *
* @group plugin_filelist * @group plugin_filelistplus
* @group plugins * @group plugins
*/ */
class GeneralTest extends DokuWikiTest class GeneralTest extends DokuWikiTest
@@ -31,7 +31,7 @@ class GeneralTest extends DokuWikiTest
$this->assertArrayHasKey('desc', $info); $this->assertArrayHasKey('desc', $info);
$this->assertArrayHasKey('url', $info); $this->assertArrayHasKey('url', $info);
$this->assertEquals('filelist', $info['base']); $this->assertEquals('filelistplus', $info['base']);
$this->assertRegExp('/^https?:\/\//', $info['url']); $this->assertRegExp('/^https?:\/\//', $info['url']);
$this->assertTrue(mail_isvalid($info['email'])); $this->assertTrue(mail_isvalid($info['email']));
$this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']);
@@ -61,7 +61,7 @@ class GeneralTest extends DokuWikiTest
$this->assertEquals( $this->assertEquals(
gettype($conf), gettype($conf),
gettype($meta), gettype($meta),
'Both ' . DOKU_PLUGIN . 'filelist/conf/default.php and ' . DOKU_PLUGIN . 'filelist/conf/metadata.php have to exist and contain the same keys.' 'Both ' . DOKU_PLUGIN . 'filelistplus/conf/default.php and ' . DOKU_PLUGIN . 'filelistplus/conf/metadata.php have to exist and contain the same keys.'
); );
if ($conf !== null && $meta !== null) { if ($conf !== null && $meta !== null) {
@@ -69,7 +69,7 @@ class GeneralTest extends DokuWikiTest
$this->assertArrayHasKey( $this->assertArrayHasKey(
$key, $key,
$meta, $meta,
'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'filelist/conf/metadata.php' 'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'filelistplus/conf/metadata.php'
); );
} }
@@ -77,7 +77,7 @@ class GeneralTest extends DokuWikiTest
$this->assertArrayHasKey( $this->assertArrayHasKey(
$key, $key,
$conf, $conf,
'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'filelist/conf/default.php' 'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'filelistplus/conf/default.php'
); );
} }
} }

View File

@@ -1,14 +1,14 @@
<?php <?php
namespace dokuwiki\plugin\filelist\test; namespace dokuwiki\plugin\filelistplus\test;
use dokuwiki\plugin\filelist\Path; use dokuwiki\plugin\filelistplus\Path;
use DokuWikiTest; use DokuWikiTest;
/** /**
* Path related tests for the filelist plugin * Path related tests for the filelistplus plugin
* *
* @group plugin_filelist * @group plugin_filelistplus
* @group plugins * @group plugins
*/ */
class PathTest extends DokuWikiTest class PathTest extends DokuWikiTest
@@ -40,15 +40,15 @@ EOT
$expect = [ $expect = [
'C:/xampp/htdocs/wiki/' => [ 'C:/xampp/htdocs/wiki/' => [
'root' => 'C:/xampp/htdocs/wiki/', 'root' => 'C:/xampp/htdocs/wiki/',
'web' => '/lib/plugins/filelist/file.php?root=C%3A%2Fxampp%2Fhtdocs%2Fwiki%2F&file=', 'web' => '/lib/plugins/filelistplus/file.php?root=C%3A%2Fxampp%2Fhtdocs%2Fwiki%2F&file=',
], ],
'\\\\server/share/path/' => [ '\\\\server/share/path/' => [
'root' => '\\\\server/share/path/', 'root' => '\\\\server/share/path/',
'web' => '/lib/plugins/filelist/file.php?root=%5C%5Cserver%2Fshare%2Fpath%2F&file=', 'web' => '/lib/plugins/filelistplus/file.php?root=%5C%5Cserver%2Fshare%2Fpath%2F&file=',
], ],
'/linux/file/path/' => [ '/linux/file/path/' => [
'root' => '/linux/file/path/', 'root' => '/linux/file/path/',
'web' => '/lib/plugins/filelist/file.php?root=%2Flinux%2Ffile%2Fpath%2F&file=', 'web' => '/lib/plugins/filelistplus/file.php?root=%2Flinux%2Ffile%2Fpath%2F&file=',
], ],
'/linux/another/path/' => [ '/linux/another/path/' => [
'root' => '/linux/another/path/', 'root' => '/linux/another/path/',

View File

@@ -1,35 +1,35 @@
<?php <?php
namespace dokuwiki\plugin\filelist\test; namespace dokuwiki\plugin\filelistplus\test;
use DokuWikiTest; use DokuWikiTest;
use DOMWrap\Document; use DOMWrap\Document;
/** /**
* Tests for the filelist plugin. * Tests for the filelistplus plugin.
* *
* These test assume that the directory filelist has the following content: * These test assume that the directory filelistplus has the following content:
* - exampledir (directory) * - exampledir (directory)
* - example2.txt (text file) * - example2.txt (text file)
* - example.txt (text file) * - example.txt (text file)
* - exampleimage.png (image file) * - exampleimage.png (image file)
* *
* @group plugin_filelist * @group plugin_filelistplus
* @group plugins * @group plugins
*/ */
class plugin_filelist_test extends DokuWikiTest class plugin_filelistplus_test extends DokuWikiTest
{ {
public function setUp(): void public function setUp(): void
{ {
global $conf; global $conf;
$this->pluginsEnabled[] = 'filelist'; $this->pluginsEnabled[] = 'filelistplus';
parent::setUp(); parent::setUp();
// Setup config so that access to the TMP directory will be allowed // Setup config so that access to the TMP directory will be allowed
$conf ['plugin']['filelist']['paths'] = TMP_DIR . '/filelistdata/' . "\n" . 'W> http://localhost/'; $conf ['plugin']['filelistplus']['paths'] = TMP_DIR . '/filelistdata/' . "\n" . 'W> http://localhost/';
} }
@@ -76,7 +76,7 @@ class plugin_filelist_test extends DokuWikiTest
global $conf; global $conf;
// Render filelist // Render filelist
$instructions = p_get_instructions('{{filelist>' . TMP_DIR . '/filelistdata/*&style=list&direct=1}}'); $instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=list&direct=1}}');
$xhtml = p_render('xhtml', $instructions, $info); $xhtml = p_render('xhtml', $instructions, $info);
// We should find: // We should find:
@@ -94,7 +94,7 @@ class plugin_filelist_test extends DokuWikiTest
public function test_recursive() public function test_recursive()
{ {
// Render filelist // Render filelist
$instructions = p_get_instructions('{{filelist>' . TMP_DIR . '/filelistdata/*&style=list&direct=1&recursive=1}}'); $instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=list&direct=1&recursive=1}}');
$xhtml = p_render('xhtml', $instructions, $info); $xhtml = p_render('xhtml', $instructions, $info);
// We should find: // We should find:
@@ -119,21 +119,21 @@ class plugin_filelist_test extends DokuWikiTest
public function testUnorderedList() public function testUnorderedList()
{ {
// Render filelist // Render filelist
$instructions = p_get_instructions('{{filelist>' . TMP_DIR . '/filelistdata/*&style=list&direct=1&recursive=1}}'); $instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=list&direct=1&recursive=1}}');
$xhtml = p_render('xhtml', $instructions, $info); $xhtml = p_render('xhtml', $instructions, $info);
$doc = new Document(); $doc = new Document();
$doc->html($xhtml); $doc->html($xhtml);
$structure = [ $structure = [
'div.filelist-plugin' => 1, 'div.filelistplus-plugin' => 1,
'div.filelist-plugin > ul' => 1, 'div.filelistplus-plugin > ul' => 1,
'div.filelist-plugin > ul > li' => 3, 'div.filelistplus-plugin > ul > li' => 3,
'div.filelist-plugin > ul > li:nth-child(1)' => 1, 'div.filelistplus-plugin > ul > li:nth-child(1)' => 1,
'div.filelist-plugin > ul > li:nth-child(1) a' => 'example.txt', 'div.filelistplus-plugin > ul > li:nth-child(1) a' => 'example.txt',
'div.filelist-plugin > ul > li:nth-child(2) ul' => 1, 'div.filelistplus-plugin > ul > li:nth-child(2) ul' => 1,
'div.filelist-plugin > ul > li:nth-child(2) ul > li' => 1, 'div.filelistplus-plugin > ul > li:nth-child(2) ul > li' => 1,
'div.filelist-plugin > ul > li:nth-child(2) ul > li a' => 'example2.txt', 'div.filelistplus-plugin > ul > li:nth-child(2) ul > li a' => 'example2.txt',
]; ];
$this->structureCheck($doc, $structure); $this->structureCheck($doc, $structure);
@@ -146,21 +146,21 @@ class plugin_filelist_test extends DokuWikiTest
public function testOrderedList() public function testOrderedList()
{ {
// Render filelist // Render filelist
$instructions = p_get_instructions('{{filelist>' . TMP_DIR . '/filelistdata/*&style=olist&direct=1&recursive=1}}'); $instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=olist&direct=1&recursive=1}}');
$xhtml = p_render('xhtml', $instructions, $info); $xhtml = p_render('xhtml', $instructions, $info);
$doc = new Document(); $doc = new Document();
$doc->html($xhtml); $doc->html($xhtml);
$structure = [ $structure = [
'div.filelist-plugin' => 1, 'div.filelistplus-plugin' => 1,
'div.filelist-plugin > ol' => 1, 'div.filelistplus-plugin > ol' => 1,
'div.filelist-plugin > ol > li' => 3, 'div.filelistplus-plugin > ol > li' => 3,
'div.filelist-plugin > ol > li:nth-child(1)' => 1, 'div.filelistplus-plugin > ol > li:nth-child(1)' => 1,
'div.filelist-plugin > ol > li:nth-child(1) a' => 'example.txt', 'div.filelistplus-plugin > ol > li:nth-child(1) a' => 'example.txt',
'div.filelist-plugin > ol > li:nth-child(2) ol' => 1, 'div.filelistplus-plugin > ol > li:nth-child(2) ol' => 1,
'div.filelist-plugin > ol > li:nth-child(2) ol > li' => 1, 'div.filelistplus-plugin > ol > li:nth-child(2) ol > li' => 1,
'div.filelist-plugin > ol > li:nth-child(2) ol > li a' => 'example2.txt', 'div.filelistplus-plugin > ol > li:nth-child(2) ol > li a' => 'example2.txt',
]; ];
$this->structureCheck($doc, $structure); $this->structureCheck($doc, $structure);
@@ -175,19 +175,19 @@ class plugin_filelist_test extends DokuWikiTest
global $conf; global $conf;
// Render filelist // Render filelist
$instructions = p_get_instructions('{{filelist>' . TMP_DIR . '/filelistdata/*&style=table&direct=1&recursive=1}}'); $instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=table&direct=1&recursive=1}}');
$xhtml = p_render('xhtml', $instructions, $info); $xhtml = p_render('xhtml', $instructions, $info);
$doc = new Document(); $doc = new Document();
$doc->html($xhtml); $doc->html($xhtml);
$structure = [ $structure = [
'div.filelist-plugin' => 1, 'div.filelistplus-plugin' => 1,
'div.filelist-plugin table' => 1, 'div.filelistplus-plugin table' => 1,
'div.filelist-plugin table > tbody > tr' => 3, 'div.filelistplus-plugin table > tbody > tr' => 3,
'div.filelist-plugin table > tbody > tr:nth-child(1) a' => 'example.txt', 'div.filelistplus-plugin table > tbody > tr:nth-child(1) a' => 'example.txt',
'div.filelist-plugin table > tbody > tr:nth-child(2) a' => 'exampledir/example2.txt', 'div.filelistplus-plugin table > tbody > tr:nth-child(2) a' => 'exampledir/example2.txt',
'div.filelist-plugin table > tbody > tr:nth-child(3) a' => 'exampleimage.png', 'div.filelistplus-plugin table > tbody > tr:nth-child(3) a' => 'exampleimage.png',
]; ];
$this->structureCheck($doc, $structure); $this->structureCheck($doc, $structure);

View File

@@ -1,7 +1,7 @@
<?php <?php
/** /**
* Options for the filelist plugin * Options for the filelistplus plugin
*/ */
$conf['paths'] = ''; $conf['paths'] = '';

View File

@@ -2,7 +2,7 @@
/** /**
* Metadata for configuration manager plugin * Metadata for configuration manager plugin
* Additions for the filelist plugin * Additions for the filelistplus plugin
* *
* @author Gina Haeussge <osd@foosel.net> * @author Gina Haeussge <osd@foosel.net>
*/ */

View File

@@ -2,7 +2,7 @@
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols // phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
use dokuwiki\plugin\filelist\Path; use dokuwiki\plugin\filelistplus\Path;
if (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../../'); 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) 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; global $INPUT;
$syntax = plugin_load('syntax', 'filelist'); $syntax = plugin_load('syntax', 'filelistplus');
if (!$syntax) die('plugin disabled?'); if (!$syntax) die('plugin disabled?');
$pathUtil = new Path($syntax->getConf('paths')); $pathUtil = new Path($syntax->getConf('paths'));

View File

@@ -1,3 +1,3 @@
<?php <?php
$lang['allow_in_comments'] = 'Filelistsyntax in Kommentaren erlauben.'; $lang['allow_in_comments'] = 'Filelistplus-Syntax in Kommentaren erlauben.';

View File

@@ -1,5 +1,5 @@
<?php <?php
$lang['allow_in_comments'] = 'Whether to allow the filelist syntax to be used in comments.'; $lang['allow_in_comments'] = 'Whether to allow the filelistplus syntax to be used in comments.';
$lang['defaults'] = 'Default options. Use the same syntax as in inline configuration'; $lang['defaults'] = 'Default options. Use the same syntax as in inline configuration';
$lang['extensions'] = 'Comma-separated list of allowed file extensions to list'; $lang['extensions'] = 'Comma-separated list of allowed file extensions to list';

View File

@@ -4,6 +4,6 @@
* *
* @author Mark C. Prins <mprins@users.sf.net> * @author Mark C. Prins <mprins@users.sf.net>
*/ */
$lang['allow_in_comments'] = 'Of de filelist syntax toegestaan is voor gebruik in commentaar.'; $lang['allow_in_comments'] = 'Of de filelistplus syntax toegestaan is voor gebruik in commentaar.';
$lang['defaults'] = 'Default options. Gebruik dezelfde syntax als de inline configuratie.'; $lang['defaults'] = 'Default options. Gebruik dezelfde syntax als de inline configuratie.';
$lang['extensions'] = 'Komma-gescheiden lijst van toegestane bestandsextensies voor de lijst.'; $lang['extensions'] = 'Komma-gescheiden lijst van toegestane bestandsextensies voor de lijst.';

View File

@@ -1,7 +1,7 @@
base filelist base filelistplus
author Gina Häußge, Dokufreaks author Gina Häußge, Dokufreaks, luxick
email freaks@dokuwiki.org email dokuwiki@luxick.de
date 2024-07-03 date 2026-01-05
name Filelist Plugin name Filelist Plus Plugin
desc Lists files matching a given glob pattern. desc Lists files matching a given glob pattern.
url https://www.dokuwiki.org/plugin:filelist url https://www.dokuwiki.org/plugin:filelistplus

View File

@@ -1,17 +1,17 @@
<?php <?php
use dokuwiki\Extension\SyntaxPlugin; use dokuwiki\Extension\SyntaxPlugin;
use dokuwiki\plugin\filelist\Crawler; use dokuwiki\plugin\filelistplus\Crawler;
use dokuwiki\plugin\filelist\Output; use dokuwiki\plugin\filelistplus\Output;
use dokuwiki\plugin\filelist\Path; use dokuwiki\plugin\filelistplus\Path;
/** /**
* Filelist Plugin: Lists files matching a given glob pattern. * Filelist Plus Plugin: Lists files matching a given glob pattern.
* *
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Gina Haeussge <osd@foosel.net> * @author Gina Haeussge <osd@foosel.net>
*/ */
class syntax_plugin_filelist extends SyntaxPlugin class syntax_plugin_filelistplus extends SyntaxPlugin
{ {
/** @inheritdoc */ /** @inheritdoc */
public function getType() public function getType()
@@ -34,7 +34,7 @@ class syntax_plugin_filelist extends SyntaxPlugin
/** @inheritdoc */ /** @inheritdoc */
public function connectTo($mode) public function connectTo($mode)
{ {
$this->Lexer->addSpecialPattern('\{\{filelist>.+?\}\}', $mode, 'plugin_filelist'); $this->Lexer->addSpecialPattern('\{\{filelistplus>.+?\}\}', $mode, 'plugin_filelistplus');
} }
/** @inheritdoc */ /** @inheritdoc */
@@ -47,7 +47,7 @@ class syntax_plugin_filelist extends SyntaxPlugin
return false; return false;
} }
$match = substr($match, strlen('{{filelist>'), -2); $match = substr($match, strlen('{{filelistplus>'), -2);
[$path, $flags] = explode('&', $match, 2); [$path, $flags] = explode('&', $match, 2);
// load default config options // load default config options