Add the plugin

@param  PluginInterface $plugin
@param  string $name
@return Translator
173100
public function addPlugin(PluginInterface $plugin, $name = null) {
		if ($name === null) {
			$this->plugins[] = $plugin;
			
			return $this;
		}
		
		$this->plugins[$name] = $plugin;
		
		return $this;
	}
672084
public function process(PluginInterface $plugin, Bot $bot)
    {
        if ($plugin instanceof EventQueueFactoryAwareInterface) {
            $plugin->setEventQueueFactory($bot->getEventQueueFactory());
        }
    }
828779
public function addPlugin($name, array $args)
    {
        $plugin = ['class' => $name, 'args' => $args];
        $this->config[$this->pointer][$this->field]['type'] = $plugin;
        
        return $this;
    }
84330
public function process(PluginInterface $plugin, Bot $bot)
    {
        if ($plugin instanceof ClientAwareInterface) {
            $plugin->setClient($bot->getClient());
        }
    }
271744
public function addPlugins(array $plugins) {
		foreach ($plugins as $name => $plugin) {
			if (is_numeric($name)) {
				$this->addPlugin($plugin);
				continue;
			}
			
			$this->addPlugin($plugin, $name);
		}
		
		return $this;
	}
697314
public function plugin($name = null) {
        $this->out();

        $pluginName = $name ?: $this->args[0];
        $plugin = Admin::getPlugin($pluginName);

        if (!$plugin) {
            $this->err(sprintf('<error>%s plugin does not exist</error>', $pluginName));
            return;
        }

        $this->out(sprintf('<success>Installing %s...</success>', $pluginName));

        // Create parent object
        $parent_id = $this->ControlObject->addObject($pluginName);
        $adminAlias = Configure::read('Admin.aliases.administrator');

        // Create children objects
        foreach ($plugin['models'] as $model) {
            $this->out($model['title']);

            $this->ControlObject->addObject($model['id'], $parent_id);

            // Give admin access
            $this->Permission->allow($adminAlias, $pluginName . '/' . $model['id']);
        }

        $this->out(sprintf('<success>%s model ACOs installed</success>', $pluginName));
    }
1123051
public function install(PluginBundleInterface $plugin)
    {
        $this->baseInstaller->install($plugin);

        $pluginEntity = $this->pluginManager->getPluginByShortName(
            $plugin->getName()
        );

        if (!$this->pluginManager->isReady($pluginEntity) || !$this->pluginManager->isActivatedByDefault($pluginEntity)) {
            $errors = $this->pluginManager->getMissingRequirements($pluginEntity);

            foreach ($errors['extensions'] as $extension) {
                $this->log(sprintf('<fg=red>Extension %s missing for %s !</fg=red>', $extension, $plugin->getName()));
            }

            foreach ($errors['plugins'] as $bundle) {
                $this->log(sprintf('<fg=red>The plugin %s is required for %s ! You must enable it first to use %s.</fg=red>', $bundle, $plugin->getName(), $plugin->getName()));
            }

            foreach ($errors['extras'] as $extra) {
                $this->log(sprintf('<fg=red>The plugin %s has extra requirements ! %s.</fg=red>', $plugin->getName(), $this->translator->trans($extra, [], 'error')));
            }

            $this->log(sprintf('<fg=red>Disabling %s...</fg=red>', $plugin->getName()));
            $this->pluginManager->disable($pluginEntity);
        }

        $this->versionManager->setLogger($this->logger);
        $version = $this->versionManager->register($plugin);
        $this->versionManager->execute($version);
    }
1177445
public function getPlugin($name)
    {
        return isset($this->_plugins[$name]) ? $this->_plugins[$name] : null;
    }
384123
public function addBlockPlugin(BlockPluginInterface $plugin)
    {
        if ($this->hasBlockPlugin($plugin->getName())) {
            throw new PluginException(sprintf(
                'Block plugin named "%s" is already registered.',
                $plugin->getName()
            ));
        }

        if ($plugin instanceof PluginRegistryAwareInterface) {
            $plugin->setPluginRegistry($this);
        }

        $this->blockPlugins[$plugin->getName()] = $plugin;
    }
67220
public static function loadPlugin($name)
    {
        $name = ucfirst($name);
        if (($config = &self::getRef("plugins.$name")) === null) {
            $config = array();
        }
        return self::loadCustomPlugin($name, $config);
    }
47219
public function getPlugin( string $name, array $data = [], bool $rawResult = false )
	{
		if( ! isset($this->plugins[$name]) )
		{
			return "The '{$name}' plugin not found";
		}

		$plug = $this->plugins[$name];
		$class_name = $plug["class_name"];
		if( !is_array($data) )
		{
			$data = [$data];
		}

		/** @var Plugin $plugin */
		$plugin = new $class_name($data);

		if( !$plugin instanceof Plugin )
		{
			throw new \RuntimeException("Plugin must be inherited of " . Plugin::class, 500);
		}

		if( $rawResult )
		{
			return $plugin
				->load()
				->getPluginData();
		}

		$cache_type = $plugin->cacheType();
		$cache_view = $cache_type === "view";

		if( $cache_view || $cache_type === "plugin" )
		{
			$cache_name = Str::snake($name);
			$cache_data = $plugin->cacheData();
			$id = $name;
			if( isset($cache_data["id"]) )
			{
				$id = $cache_data["id"];
				unset($cache_data["id"]);
			}

			$cache = new Cache( $id, "plugin/" . $cache_name, $cache_data );
			if( $cache->ready() )
			{
				$content = $cache->import();
			}
			else
			{
				$content = $plugin
					->load()
					->getRenderContent($this);

				$cache->export($content);
			}

			if($cache_view) {
				return $content;
			}
		}
		else
		{
			$content = $plugin
				->load()
				->getRenderContent($this);
		}

		$number = $this->plugin_index ++;
		$hash = md5(mt_rand( 1000, 100000 )) . "-" . time();
		$this->plugin[$number] = [
			"package"       => $plug["package_name"],
			"name"          => $name,
			"cache"         => $cache_type,
			"cache_data"    => $plugin->cacheData(),
			"content"       => $content,
			"data"          => $data,
			"hash"          => $hash
		];

		return '{plugin:' . $number . ':' . $hash . '}';
	}
830430
def add_plugin(self, plugin):
        """"""
        # allow plugins loaded via entry points to override builtin plugins
        new_name = self.plugin_name(plugin)
        self._plugins[:] = [p for p in self._plugins
                            if self.plugin_name(p) != new_name]
        self._plugins.append(plugin)
898001
def register_plugin(self, name, plugin):
        
        if self.has_plugin(name):
            self.release_plugin(name)
        self._active_plugins[name] = plugin
        setattr(self, name, plugin)
        return plugin
1157643
protected function installPlugin(string $name)
    {
        $this->info('Downloading plugin...');

        $this->files->copy($this->option('url'), $this->temp);

        if (true !== $this->zip->open($this->temp)) {
            $this->error('Cannot open plugin zip file.');

            return;
        }

        $this->zip->extractTo($this->path());
        $this->zip->close();

        $this->files->move(
            $this->path($this->option('dir')),
            $this->path($name)
        );

        $this->files->delete($this->temp);
    }
405909
public function attachPlugin($name, Plugin $plugin)
    {
        $plugin->register($this);
        $this->plugins[$name] = $plugin;
        return $this;
    }
939567
public function getPlugin(string $pluginName): ExtensionPluginInterface
    {
        if (!isset($this->plugins[$pluginName])) {
            throw new RuntimeException(
                sprintf(
                    'Extension plugin "%s" does not exist',
                    $pluginName
                )
            );
        }

        return $this->plugins[$pluginName];
    }
300489
public function addPlugin(Plugin $plugin): Builder
    {
        $this->plugins[]          = $plugin;
        $this->httpClientModified = true;

        return $this;
    }