Only load plugins derived from 'Plugin' class

This commit is contained in:
torkel104 2016-11-09 16:43:16 +01:00
parent ff8fe8dc02
commit d105fdf6d8
1 changed files with 7 additions and 21 deletions

View File

@ -75,27 +75,13 @@ function buildPlugins()
foreach($pluginsDeclaredClasess as $pluginClass) foreach($pluginsDeclaredClasess as $pluginClass)
{ {
$Plugin = new $pluginClass(); // Ignore non-plugin classes
if ( !is_subclass_of( $pluginClass, 'Plugin' ) )
// Deprecated {
// // Check if the plugin is translated. continue;
// $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'; $Plugin = new $pluginClass();
// }
// $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);
// }
// Push Plugin to array all plugins installed and not installed. // Push Plugin to array all plugins installed and not installed.
$plugins['all'][$pluginClass] = $Plugin; $plugins['all'][$pluginClass] = $Plugin;