mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 09:19:22 +02:00
Support for subfolders in plugins/pages
This commit is contained in:
parent
e9c6017e60
commit
127e03081c
@ -23,6 +23,9 @@ class Plugins {
|
||||
|
||||
$routes = [];
|
||||
foreach(self::getAllPluginsJson() as $plugin) {
|
||||
//
|
||||
// Get all plugins/*/pages/*.php pages
|
||||
//
|
||||
$pluginPages = glob(PLUGINS . $plugin['filename'] . '/pages/*.php');
|
||||
foreach ($pluginPages as $file) {
|
||||
$file = str_replace(PLUGINS, 'plugins/', $file);
|
||||
@ -31,6 +34,22 @@ class Plugins {
|
||||
$routes[] = [['get', 'post'], $name, $file, 1000];
|
||||
}
|
||||
|
||||
//
|
||||
// Get all plugins/*/pages/subFolder/*.php pages
|
||||
//
|
||||
$pluginSubFolders = glob(PLUGINS . $plugin['filename'] . '/pages/*', GLOB_ONLYDIR);
|
||||
foreach ($pluginSubFolders as $folder) {
|
||||
$folderName = pathinfo($folder, PATHINFO_FILENAME);
|
||||
|
||||
$subFolders = glob(PLUGINS . $plugin['filename'] . '/pages/' . $folderName . '/*.php');
|
||||
foreach ($subFolders as $file) {
|
||||
$file = str_replace(PLUGINS, 'plugins/', $file);
|
||||
$name = $folderName . '/' . pathinfo($file, PATHINFO_FILENAME);
|
||||
|
||||
$routes[] = [['get', 'post'], $name, $file, 1000];
|
||||
}
|
||||
}
|
||||
|
||||
$warningPreTitle = 'Plugin: ' . $plugin['name'] . ' - ';
|
||||
|
||||
if (isset($plugin['routes'])) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user