mirror of
https://github.com/slawkens/myaac.git
synced 2025-06-07 21:34:31 +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\Cache\Cache;
|
||||||
use MyAAC\CsrfToken;
|
use MyAAC\CsrfToken;
|
||||||
use MyAAC\Hooks;
|
use MyAAC\Hooks;
|
||||||
|
use MyAAC\Plugins;
|
||||||
use MyAAC\Models\Town;
|
use MyAAC\Models\Town;
|
||||||
use MyAAC\Settings;
|
use MyAAC\Settings;
|
||||||
|
|
||||||
@ -46,6 +47,11 @@ if(isset($config['gzip_output']) && $config['gzip_output'] && isset($_SERVER['HT
|
|||||||
global $cache;
|
global $cache;
|
||||||
$cache = Cache::getInstance();
|
$cache = Cache::getInstance();
|
||||||
|
|
||||||
|
// load plugins init.php
|
||||||
|
foreach (Plugins::getInits() as $init) {
|
||||||
|
require $init;
|
||||||
|
}
|
||||||
|
|
||||||
// event system
|
// event system
|
||||||
global $hooks;
|
global $hooks;
|
||||||
$hooks = new Hooks();
|
$hooks = new Hooks();
|
||||||
|
@ -11,6 +11,25 @@ class Plugins {
|
|||||||
private static $error = null;
|
private static $error = null;
|
||||||
private static $plugin_json = [];
|
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()
|
public static function getAdminPages()
|
||||||
{
|
{
|
||||||
return Cache::remember('plugins_admin_pages', 10 * 60, function () {
|
return Cache::remember('plugins_admin_pages', 10 * 60, function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user