From d105fdf6d8191d43e6978291b77c28e9e68102e7 Mon Sep 17 00:00:00 2001 From: torkel104 Date: Wed, 9 Nov 2016 16:43:16 +0100 Subject: [PATCH] Only load plugins derived from 'Plugin' class --- bl-kernel/boot/rules/60.plugins.php | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/bl-kernel/boot/rules/60.plugins.php b/bl-kernel/boot/rules/60.plugins.php index 77611470..1311fcc9 100755 --- a/bl-kernel/boot/rules/60.plugins.php +++ b/bl-kernel/boot/rules/60.plugins.php @@ -75,27 +75,13 @@ function buildPlugins() foreach($pluginsDeclaredClasess as $pluginClass) { - $Plugin = new $pluginClass(); - - // Deprecated - // // Check if the plugin is translated. - // $languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.$Site->locale().'.json'; - // if( !Sanitize::pathFile($languageFilename) ) { - // $languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.'en_US.json'; - // } - - // $database = file_get_contents($languageFilename); - // $database = json_decode($database, true); - - // // Set name and description from the language file. - // $Plugin->setMetadata('name',$database['plugin-data']['name']); - // $Plugin->setMetadata('description',$database['plugin-data']['description']); - - // // Remove name and description, and add new words if there are. - // unset($database['plugin-data']); - // if(!empty($database)) { - // $Language->add($database); - // } + // Ignore non-plugin classes + if ( !is_subclass_of( $pluginClass, 'Plugin' ) ) + { + continue; + } + + $Plugin = new $pluginClass(); // Push Plugin to array all plugins installed and not installed. $plugins['all'][$pluginClass] = $Plugin;