From c20b4826165fafce14d55f833f0b9833280c8ade Mon Sep 17 00:00:00 2001 From: luxick Date: Fri, 9 Jan 2026 11:45:27 +0100 Subject: [PATCH] Refactor project structure --- README.md | 8 ++++++ _test/PathTest.php | 2 ++ _test/ScratchpadMapTest.php | 2 ++ autoload.php | 30 ++++++++++++++++++++++ file.php | 2 ++ scratchpad.php | 2 ++ Crawler.php => src/Crawler.php | 2 +- Output.php => src/Output.php | 0 Path.php => src/Path.php | 0 ScratchpadMap.php => src/ScratchpadMap.php | 0 syntax/AbstractSyntax.php | 2 ++ syntax/scratchpad.php | 2 ++ 12 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 autoload.php rename Crawler.php => src/Crawler.php (99%) rename Output.php => src/Output.php (100%) rename Path.php => src/Path.php (100%) rename ScratchpadMap.php => src/ScratchpadMap.php (100%) diff --git a/README.md b/README.md index 25e07a0..ee4319b 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,14 @@ If you install this plugin manually, make sure it is installed in: If the folder is called differently, DokuWiki will not load it. +## Project structure (developer notes) + +This repository follows DokuWiki's plugin conventions at the top level (e.g. `syntax.php`, `conf/`, `lang/`, endpoints like `file.php`). + +Reusable PHP code lives in `src/` and is loaded via `autoload.php`. +When adding new internal classes under the `dokuwiki\plugin\luxtools\` namespace, place them in `src/.php`. + + ## Configuration luxtools is configured via its dedicated admin page: diff --git a/_test/PathTest.php b/_test/PathTest.php index 6ecbf4a..5a6fe36 100644 --- a/_test/PathTest.php +++ b/_test/PathTest.php @@ -5,6 +5,8 @@ namespace dokuwiki\plugin\luxtools\test; use dokuwiki\plugin\luxtools\Path; use DokuWikiTest; +require_once(__DIR__ . '/../autoload.php'); + /** * Path related tests for the luxtools plugin * diff --git a/_test/ScratchpadMapTest.php b/_test/ScratchpadMapTest.php index 8346450..6a5fb7e 100644 --- a/_test/ScratchpadMapTest.php +++ b/_test/ScratchpadMapTest.php @@ -5,6 +5,8 @@ namespace dokuwiki\plugin\luxtools\test; use dokuwiki\plugin\luxtools\ScratchpadMap; use DokuWikiTest; +require_once(__DIR__ . '/../autoload.php'); + /** * ScratchpadMap tests for the luxtools plugin * diff --git a/autoload.php b/autoload.php new file mode 100644 index 0000000..67e4ba3 --- /dev/null +++ b/autoload.php @@ -0,0 +1,30 @@ + trim(preg_replace('/\s*#.*$/', '', $line)), $ignore); $ignore = array_filter($ignore); diff --git a/Output.php b/src/Output.php similarity index 100% rename from Output.php rename to src/Output.php diff --git a/Path.php b/src/Path.php similarity index 100% rename from Path.php rename to src/Path.php diff --git a/ScratchpadMap.php b/src/ScratchpadMap.php similarity index 100% rename from ScratchpadMap.php rename to src/ScratchpadMap.php diff --git a/syntax/AbstractSyntax.php b/syntax/AbstractSyntax.php index 6935531..eceab84 100644 --- a/syntax/AbstractSyntax.php +++ b/syntax/AbstractSyntax.php @@ -5,6 +5,8 @@ use dokuwiki\plugin\luxtools\Crawler; use dokuwiki\plugin\luxtools\Output; use dokuwiki\plugin\luxtools\Path; +require_once(__DIR__ . '/../autoload.php'); + /** * luxtools Plugin: Abstract base class for file-listing syntax handlers. * diff --git a/syntax/scratchpad.php b/syntax/scratchpad.php index f2499a7..f05813e 100644 --- a/syntax/scratchpad.php +++ b/syntax/scratchpad.php @@ -4,6 +4,8 @@ use dokuwiki\Extension\SyntaxPlugin; use dokuwiki\plugin\luxtools\Path; use dokuwiki\plugin\luxtools\ScratchpadMap; +require_once(__DIR__ . '/../autoload.php'); + /** * luxtools Plugin: Scratchpad syntax. *