public static function discover(ContextManager $context) { // XXX: try to load plugins from <plugins> section if ($context->config()->property('plugin.autodiscovery') === false) { return array(); } $context->logger()->debug(strtolower(__METHOD__) . ' [hint: set `plugin.autodiscovery` to false to disable plugins]'); // plugins.path then fall to default $plugins_path = $context->config()->property('plugin.path') ? $context->config()->property('plugin.path') : MEDICK_PATH . '/../../vendor/plugins'; foreach (new DirectoryIterator($plugins_path) as $plugin_path) { Plugins::load_plugin($context, $plugin_path); } return Plugins::$registry; }
public final function __construct(ContextManager $context) { $this->context = $context; $this->logger = $context->logger(); $this->config = $context->config(); }
public function __construct(ContextManager $context) { $this->metadata = array('name' => $this->class_name(), 'author' => 'Joe Doe', 'version' => 0.1, 'url' => 'http://example.com/foo_plugin'); $context->logger()->debugf("Plugin %s loaded", $this->name()); parent::__construct($context); }