✨ Auto-load plugins in bl-modules
This commit is contained in:
parent
2cb88bfc33
commit
57d9043f0e
2 changed files with 7 additions and 4 deletions
|
@ -34,6 +34,7 @@ if (DEBUG_MODE) {
|
||||||
define('PATH_LANGUAGES', PATH_ROOT . 'bl-languages' . DS);
|
define('PATH_LANGUAGES', PATH_ROOT . 'bl-languages' . DS);
|
||||||
define('PATH_THEMES', PATH_ROOT . 'bl-themes' . DS);
|
define('PATH_THEMES', PATH_ROOT . 'bl-themes' . DS);
|
||||||
define('PATH_PLUGINS', PATH_ROOT . 'bl-plugins' . DS);
|
define('PATH_PLUGINS', PATH_ROOT . 'bl-plugins' . DS);
|
||||||
|
define('PATH_MODULES', PATH_ROOT . 'bl-modules' . DS);
|
||||||
define('PATH_KERNEL', PATH_ROOT . 'bl-kernel' . DS);
|
define('PATH_KERNEL', PATH_ROOT . 'bl-kernel' . DS);
|
||||||
define('PATH_CONTENT', PATH_ROOT . 'bl-content' . DS);
|
define('PATH_CONTENT', PATH_ROOT . 'bl-content' . DS);
|
||||||
|
|
||||||
|
@ -188,6 +189,7 @@ define('HTML_PATH_UPLOADS_PAGES', HTML_PATH_UPLOADS . 'pages/');
|
||||||
define('HTML_PATH_UPLOADS_PROFILES', HTML_PATH_UPLOADS . 'profiles/');
|
define('HTML_PATH_UPLOADS_PROFILES', HTML_PATH_UPLOADS . 'profiles/');
|
||||||
define('HTML_PATH_UPLOADS_THUMBNAILS', HTML_PATH_UPLOADS . 'thumbnails/');
|
define('HTML_PATH_UPLOADS_THUMBNAILS', HTML_PATH_UPLOADS . 'thumbnails/');
|
||||||
define('HTML_PATH_PLUGINS', HTML_PATH_ROOT . 'bl-plugins/');
|
define('HTML_PATH_PLUGINS', HTML_PATH_ROOT . 'bl-plugins/');
|
||||||
|
define('HTML_PATH_MODULES', HTML_PATH_ROOT . 'bl-modules/');
|
||||||
|
|
||||||
// --- Objects with dependency ---
|
// --- Objects with dependency ---
|
||||||
$language = new Language($site->language());
|
$language = new Language($site->language());
|
||||||
|
|
|
@ -49,7 +49,7 @@ $pluginsInstalled = array();
|
||||||
// Functions
|
// Functions
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
function buildPlugins()
|
function buildPlugins($path, $autoActivate = false)
|
||||||
{
|
{
|
||||||
global $plugins;
|
global $plugins;
|
||||||
global $pluginsEvents;
|
global $pluginsEvents;
|
||||||
|
@ -61,7 +61,7 @@ function buildPlugins()
|
||||||
$currentDeclaredClasess = get_declared_classes();
|
$currentDeclaredClasess = get_declared_classes();
|
||||||
|
|
||||||
// List plugins directories
|
// List plugins directories
|
||||||
$list = Filesystem::listDirectories(PATH_PLUGINS);
|
$list = Filesystem::listDirectories($path);
|
||||||
// Load each plugin clasess
|
// Load each plugin clasess
|
||||||
foreach ($list as $pluginPath) {
|
foreach ($list as $pluginPath) {
|
||||||
// Check if the directory has the plugin.php
|
// Check if the directory has the plugin.php
|
||||||
|
@ -100,7 +100,7 @@ function buildPlugins()
|
||||||
$plugins['all'][$pluginClass] = $Plugin;
|
$plugins['all'][$pluginClass] = $Plugin;
|
||||||
|
|
||||||
// If the plugin is installed insert on the hooks
|
// If the plugin is installed insert on the hooks
|
||||||
if ($Plugin->installed()) {
|
if ($Plugin->installed() || $autoActivate) {
|
||||||
// Include custom hooks
|
// Include custom hooks
|
||||||
if (!empty($Plugin->customHooks)) {
|
if (!empty($Plugin->customHooks)) {
|
||||||
foreach ($Plugin->customHooks as $customHook) {
|
foreach ($Plugin->customHooks as $customHook) {
|
||||||
|
@ -131,4 +131,5 @@ function buildPlugins()
|
||||||
// Main
|
// Main
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
buildPlugins();
|
buildPlugins(PATH_PLUGINS);
|
||||||
|
buildPlugins(PATH_MODULES, true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue