Commit 8c84a9bf authored by Elias Häußler's avatar Elias Häußler 🐛

[FEATURE] Do not include user-specific files if they start with `_`

parent c8ae3d01
......@@ -45,10 +45,11 @@ cp .env.dist .env
### Add user functions
The [`index.php`](public/index.php) serves as entry point for code execution. It includes all PHP files which are
located inside the `src/includes` directory and executes them.
located inside the `src/includes` directory and executes them. Files starting with an underscore (e.g. `_example.php`)
won't be included.
Each include file should return a closure which executes the user-specific code. The authenticated cPanel instance
should be passed as first instance. An example file can be found in [`src/includes/example.php`](src/includes/example.php).
should be passed as first instance. An example file can be found in [`src/includes/_example.php`](src/includes/_example.php).
## Example
......
......@@ -27,7 +27,7 @@ try {
$cPanel->authenticate();
// Include user-specific code
\EliasHaeussler\CpanelRequests\Utility::includeUserSpecificFunctions($cPanel, ROOT_PATH . "/src/includes/*.php");
\EliasHaeussler\CpanelRequests\Utility::includeUserSpecificFunctions($cPanel, ROOT_PATH . "/src/includes/[!_]*.php");
} catch (Exception $e) {
\EliasHaeussler\CpanelRequests\ErrorHandling::showError($e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment