public static function load_plugins($_application = null, $_plugin_name = null, $_position = null) { /* * the global plugins */ $plugins = YamlBackend::load('etc/conf.d/plugins.yml'); if ($plugins) { foreach ((array) $plugins as $hook_name => $plugin) { if (!$plugin) { continue; } foreach ((array) $plugin as $plugin_name => $plugin_action) { self::register($hook_name, $plugin_name, $plugin_action); } } } /* * load the single application's plugins */ if ($_application) { $installed_apps = array($_application); } else { $installed_apps = ini('base/INSTALLED_APPS'); } $installed_apps_config = BaseConfig::get_apps_config($installed_apps); foreach ((array) $installed_apps_config as $app_config) { foreach ((array) $app_config['plugins'] as $hook_name => $ps) { if (!$ps) { continue; } /* * load the decided plugin */ if ($_plugin_name && $ps[$_plugin_name]) { self::register($hook_name, $_plugin_name, $ps[$_plugin_name]); return; } foreach ((array) $ps as $name => $plugin) { self::register($hook_name, $name, $plugin); } } } }