Example #1
0
 /**
  * Load plugins that are marked as active.
  * This also checks for the implementation of PluginInterface in the main class of the plugin.
  */
 public static function loadActivePlugins()
 {
     $plugins = self::getActivePlugins();
     foreach ($plugins as $plugin) {
         try {
             $pluginClass = self::getEntryPointClassForPlugin($plugin);
             // Load class
             include_once PATH . 'plugins/' . $plugin->getPackageName() . '/Plugin.php';
             // Finally, start plugin
             $p = new $pluginClass($plugin->getPackageName(), $plugin->getTitle(), $plugin->getDescription(), $plugin->getAuthor(), $plugin->getURL(), 1, $plugin->getID());
             if (!$p instanceof PluginInterface) {
                 throw new InvalidManifestException('Plugin ' . $plugin->getPackageName() . ' does not implement PluginInterface.', 42);
             }
             $plugins[$plugin->getPackageName()] = $p;
         } catch (InvalidManifestException $e) {
             Functions::log(Functions::LOG_ERROR, $e->getMessage());
         } catch (InvalidPluginException $e) {
             Functions::log(Functions::LOG_ERROR, $e->getMessage());
         }
     }
     self::$loadedPlugins = $plugins;
 }