mirror of
https://github.com/slawkens/myaac.git
synced 2025-06-07 13:24:29 +02:00
feat: AutoLoad plugins init.php, by default disabled
This commit is contained in:
parent
8fdea94376
commit
207d6bc691
@ -12,6 +12,7 @@ use DebugBar\StandardDebugBar;
|
||||
use MyAAC\Cache\Cache;
|
||||
use MyAAC\CsrfToken;
|
||||
use MyAAC\Hooks;
|
||||
use MyAAC\Plugins;
|
||||
use MyAAC\Models\Town;
|
||||
use MyAAC\Settings;
|
||||
|
||||
@ -46,6 +47,11 @@ if(isset($config['gzip_output']) && $config['gzip_output'] && isset($_SERVER['HT
|
||||
global $cache;
|
||||
$cache = Cache::getInstance();
|
||||
|
||||
// load plugins init.php
|
||||
foreach (Plugins::getInits() as $init) {
|
||||
require $init;
|
||||
}
|
||||
|
||||
// event system
|
||||
global $hooks;
|
||||
$hooks = new Hooks();
|
||||
|
@ -11,6 +11,25 @@ class Plugins {
|
||||
private static $error = null;
|
||||
private static $plugin_json = [];
|
||||
|
||||
public static function getInits()
|
||||
{
|
||||
return Cache::remember('plugins_inits', 10 * 60, function () {
|
||||
$inits = [];
|
||||
foreach(self::getAllPluginsJson() as $plugin) {
|
||||
if (!self::getAutoLoadOption($plugin, 'init', false)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$pluginInits = glob(PLUGINS . $plugin['filename'] . '/init.php');
|
||||
foreach ($pluginInits as $path) {
|
||||
$inits[] = $path;
|
||||
}
|
||||
}
|
||||
|
||||
return $inits;
|
||||
});
|
||||
}
|
||||
|
||||
public static function getAdminPages()
|
||||
{
|
||||
return Cache::remember('plugins_admin_pages', 10 * 60, function () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user