blob: c8da5fdf6e4c6d555444873c7ad817a9e5caf3b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
<?php
namespace FlatFileForms;
class PluginLoader
{
public function __construct()
{
/**@var Utilities $utilities*/
global $utilities;
$pluginsDirectoryPath = $_ENV['app']['pluginsFolderPath'];
spl_autoload_register(function ($classname) use ($pluginsDirectoryPath) {
$classname = str_replace('FlatFileForms\\Plugins\\', '', $classname);
require_once
$pluginsDirectoryPath . '/' .
str_replace('\\', '/', $classname) .
'.php';
});
$pluginDirectories = $utilities->scandir($pluginsDirectoryPath);
foreach ($pluginDirectories as $directory) {
$pluginClass = 'FlatFileForms\\Plugins\\' . $directory . '\\Plugin';
$plugin = new $pluginClass();
}
}
}
|