Adds a plugin, activates it and registers it with the event dispatcher

@param PluginInterface $plugin Plugin instance

@return void
966656
public function addPlugin(PluginInterface $plugin)
    {
        $this->plugins[] = $plugin;

        $plugin->activate($this->eventDispatcher);

        if ($plugin instanceof EventSubscriberInterface) {
            $this->eventDispatcher->addSubscriber($plugin);
        }
    }
1294660
public function registerPlugin(string $plugin)
    {
        if (!in_array($plugin, $this->plugins)) {
            $this->plugins[] = $plugin;
        }

        return true;
    }
809079
public function activatePlugin($pluginName)
    {
        $plugins = $this->pluginList->getActivatedPlugins();
        if (in_array($pluginName, $plugins)) {
            // plugin is already activated
            return;
        }

        if (!$this->isPluginInFilesystem($pluginName)) {
            throw new \Exception("Plugin '$pluginName' cannot be found in the filesystem in plugins/ directory.");
        }
        $this->deactivateThemeIfTheme($pluginName);

        // Load plugin
        $plugin = $this->loadPlugin($pluginName);
        if ($plugin === null) {
            throw new \Exception("The plugin '$pluginName' was found in the filesystem, but could not be loaded.'");
        }
        $this->installPluginIfNecessary($plugin);
        $plugin->activate();

        EventDispatcher::getInstance()->postPendingEventsTo($plugin);

        $this->pluginsToLoad[] = $pluginName;

        $this->updatePluginsConfig($this->pluginsToLoad);
        PiwikConfig::getInstance()->forceSave();

        $this->clearCache($pluginName);

        /**
         * Event triggered after a plugin has been activated.
         *
         * @param string $pluginName The plugin that has been activated.
         */
        Piwik::postEvent('PluginManager.pluginActivated', array($pluginName));
    }
484900
protected function activatePlugin(string $plugin): void
    {
        require_once WPMU_PLUGIN_DIR.'/'.$plugin;

        do_action('activate_'.$plugin);

        $plugins = $this->getActivePlugins();
        $plugins[] = $plugin;

        $this->setActivePlugins($plugins);
    }
1051879
protected function _triggerAfterEvents(PluginPackage $plugin)
    {
        $affix = ucwords($this->params['status']);
        try {
            $this->trigger("Plugin.{$plugin->name}.after{$affix}");
        } catch (\Exception $e) {
            $this->err(__d('installer', 'Plugin did not respond to "after{0}" callback properly.', $affix));
        }
    }
23751
def add_plugin(self, plugin):
        
        self.plugin_by_name[plugin.get_plugin_name()] = plugin
        self.plugins.append(plugin)
784218
public void addPlugin(ComponentPlugin plugin)
   {
      if (plugin instanceof AddActionsPlugin)
      {
         AddActionsPlugin cplugin = (AddActionsPlugin)plugin;
         for (ActionConfiguration ac : cplugin.getActions())
         {
            try
            {
               SessionEventMatcher matcher =
                  new SessionEventMatcher(getEventTypes(ac.getEventTypes()), getPaths(ac.getPath()), ac.isDeep(),
                     getWorkspaces(ac.getWorkspace()), getNames(ac.getNodeTypes()), typeDataManager);

               Action action =
                  ac.getAction() != null ? ac.getAction() : (Action)ClassLoading.forName(ac.getActionClassName(), this)
                     .newInstance();

               addAction(matcher, action);
            }
            catch (Exception e)
            {
               log.error(e.getLocalizedMessage(), e);
            }
         }
      }
   }
235594
public void addPlugin(String pluginTypeName) {
		try {
			Class<?> pluginType = Class.forName(pluginTypeName);
			if (SimonConsolePlugin.class.isAssignableFrom(pluginType)) {
				addPlugin((Class<? extends SimonConsolePlugin>) pluginType);
			} else {
				throw new IllegalArgumentException("Invalid plugin type " + pluginTypeName);
			}
		} catch (ClassNotFoundException classNotFoundException) {
			throw new IllegalArgumentException("Invalid plugin type " + pluginTypeName, classNotFoundException);
		}
	}
853371
private function initializePlugin($pluginId) {

		$configData = $this->config->plugins[$pluginId];

		// load class file

		$class	= str_replace('/', '\\', $configData['class']);
		
		$file	= $this->rootPath . 'src/' . $configData['classPath'] . $class . '.php';

		if(!file_exists($file)) {
			throw new ApplicationException(sprintf("Class file '%s' for plugin '%s' not found.", $file, $pluginId));
		}

		require $file;
		
		// create instance

		$plugin = new $class;
		
		// check whether instance implements SubscriberInterface
		
		if(!$plugin instanceof SubscriberInterface) {
			throw new ApplicationException(sprintf("Plugin '%s' (class %s) does not implement the SubscriberInterface.", $pluginId, $class));
		}
		
		// set parameters
		
		if(!empty($configData['parameters'])) {

			if(!method_exists($plugin, 'setParameters')) {
				throw new ApplicationException(sprintf("Plugin '%s' (class %s) does not provide a 'setParameters' method but has parameters configured.", $pluginId, $class));
			}
			
			$plugin->setParameters($configData['parameters']);
		}

		// register plugin with dispatcher

		EventDispatcher::getInstance()->addSubscriber($plugin);
		
		return $plugin;

	}
787132
private function createPluginsNode(ArrayNodeDefinition $rootNode): void
    {
        $pluginsNode = $rootNode
            ->children()
                ->arrayNode('plugins')
                ->children();

        foreach ($this->plugins as $plugin) {
            $pluginNode = new ArrayNodeDefinition($plugin->getPluginName());
            $plugin->addConfiguration($pluginNode);

            $pluginsNode->append($pluginNode);
        }
    }
68777
public function init()
    {
        parent::init();

        self::$plugin = $this;

        $this->_setPluginComponents();
        $this->_setLogging();
        $this->_registerCpRoutes();
        $this->_registerEventHandlers();
    }
820848
public void pluginAppears( PluginInterface pi ) {
		if( pi != null ) {
			this.logger.info( "Plugin '" + pi.getPluginName() + "' is now available in Roboconf's agent." );
			this.plugins.add( pi );
			listPlugins();
		}
	}
347816
public function register(PluginBundle $plugin, array $pluginConfiguration)
    {
        $pluginFqcn = get_class($plugin);
        $this->dbWriter->insert($plugin, $pluginConfiguration);
    }
712650
function registerPlugin(name, obj) {
    if (name && name.length && obj) {
        plugins[name] = obj;
    }
}
500400
protected function executing($action, $plugin)
    {
        $this->io->write('  - ' . ucfirst($this->getActionExecuting($action)) . ' plugin <info>' . $plugin . '</info>');
        $this->io->write('');
    }
236379
public static function add($hook, $plugin)
    {
        // Make sure the hook index exists
        if (!isset(static::$plugins[$hook])) {
            static::$plugins[$hook] = array();
        }

        // Add the plugin
        static::$plugins[$hook][] = $plugin;
    }
878194
public function plugin($plugin)
    {
        $this->out('<info>Compiling one ' . $plugin . '\'s templates</info>');
        $this->walkIterator(Scanner::plugin($plugin));
    }