Returns the active plugin object of given name

@param   string  $name   The name the plugin is registered under.

@return  TheCMSThread\Classes\Plugin
497175
public function plugin(string $name): \TheCMSThread\Classes\Plugin
    {
        return $this->plugins->get($name);
    }
285572
public function get( $name ) {
		// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Calling native WordPress hook.
		foreach ( apply_filters( 'all_plugins', get_plugins() ) as $file => $_ ) {
			if ( "$name.php" === $file ||
				( $name && $file === $name ) ||
				( dirname( $file ) === $name && '.' !== $name ) ) {
				return (object) compact( 'name', 'file' );
			}
		}

		return false;
	}
1295429
public function get($name)
    {
        if (!isset($this->adapters[$name])) {
            throw new \InvalidArgumentException(sprintf('No Adapter with name "%s" is registered.', $name));
        }

        return $this->adapters[$name];
    }
367216
public function getComponent($name)
    {
        if (!$this->activePartial) {
            return null;
        }

        $component = $this->findComponentFromStack($name, $this->activePartial);
        if ($component !== null) {
            return $component;
        }

        foreach ($this->partialStack as $stack) {
            $component = $this->findComponentFromStack($name, $stack);
            if ($component !== null) {
                return $component;
            }
        }

        return null;
    }
735889
public function getBlockPlugin($name)
    {
        if (!$this->hasBlockPlugin($name)) {
            throw new PluginException(sprintf('Block plugin "%s" is not registered.', $name));
        }

        return $this->blockPlugins[$name];
    }
556500
public function getFormCode($name)
	{
		$templates = $this->getTemplates();
		return $templates->get($name, $this->plugin->name);
	}
617774
public static function getPluginPath($name = null)
	{
		$path = Config::get()->get('plugin.path');
		if ($name != null) {
			$path = $path . '/' . $name;
		}
		return $path;
	}
1115029
public static function getInstance(string $name)
    {
        if (!isset(self::$instances[$name]) || empty(self::$instances[$name])) {
            new static($name);
        }
        return (self::$instances[$name]);
    }
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 . '}';
	}
1180038
public function getCacheKey($name)
    {
        if (!$this->validateCmsObject($name)) {
            return parent::getCacheKey($name);
        }

        return $this->obj->getTwigCacheKey();
    }
263746
public function getCustomPlugin($name)
    {
        if (isset($this->plugins[$name])) {
            return $this->plugins[$name]['callback'];
        }

        return null;
    }
752096
public function get($name)
    {
        $name = ltrim($name, '\\');
        if (! isset($this->instances[$name])) {
            $this->instances[$name] = $this->newInstance($name);
        }
        return $this->instances[$name];
    }
616617
private function get(string $name){
		$method = 'magic_get_'.$name;

		return \method_exists($this, $method) ? $this->$method() : null;
	}
242633
protected function getPluginType($name)
	{
		$pluginType = -1;

		if (($this->securityPolicy === null && (function_exists($name) || strtolower($name) === 'isset' || strtolower($name) === 'empty')) ||
			($this->securityPolicy !== null && in_array(strtolower($name), $this->securityPolicy->getAllowedPhpFunctions()) !== false)) {
			$phpFunc = true;
		}

		while ($pluginType <= 0) {
			if (isset($this->templatePlugins[$name])) {
				$pluginType = Dwoo::TEMPLATE_PLUGIN | Dwoo::COMPILABLE_PLUGIN;
			} elseif (isset($this->customPlugins[$name])) {
				$pluginType = $this->customPlugins[$name]['type'] | Dwoo::CUSTOM_PLUGIN;
			} elseif (class_exists('Dwoo_Plugin_'.$name, false) !== false) {
				if (is_subclass_of('Dwoo_Plugin_'.$name, 'Dwoo_Block_Plugin')) {
					$pluginType = Dwoo::BLOCK_PLUGIN;
				} else {
					$pluginType = Dwoo::CLASS_PLUGIN;
				}
				$interfaces = class_implements('Dwoo_Plugin_'.$name, false);
				if (in_array('Dwoo_ICompilable', $interfaces) !== false || in_array('Dwoo_ICompilable_Block', $interfaces) !== false) {
					$pluginType |= Dwoo::COMPILABLE_PLUGIN;
				}
			} elseif (function_exists('Dwoo_Plugin_'.$name) !== false) {
				$pluginType = Dwoo::FUNC_PLUGIN;
			} elseif (function_exists('Dwoo_Plugin_'.$name.'_compile')) {
				$pluginType = Dwoo::FUNC_PLUGIN | Dwoo::COMPILABLE_PLUGIN;
			} elseif (function_exists('smarty_modifier_'.$name) !== false) {
				$pluginType = Dwoo::SMARTY_MODIFIER;
			} elseif (function_exists('smarty_function_'.$name) !== false) {
				$pluginType = Dwoo::SMARTY_FUNCTION;
			} elseif (function_exists('smarty_block_'.$name) !== false) {
				$pluginType = Dwoo::SMARTY_BLOCK;
			} else {
				if ($pluginType===-1) {
					try {
						$this->dwoo->getLoader()->loadPlugin($name, isset($phpFunc)===false);
					} catch (Exception $e) {
						if (isset($phpFunc)) {
							$pluginType = Dwoo::NATIVE_PLUGIN;
						} elseif (is_object($this->dwoo->getPluginProxy()) && $this->dwoo->getPluginProxy()->handles($name)) {
							$pluginType = Dwoo::PROXY_PLUGIN;
							break;
						} else {
							throw $e;
						}
					}
				} else {
					throw new Dwoo_Exception('Plugin "'.$name.'" could not be found');
				}
				$pluginType++;
			}
		}

		if (($pluginType & Dwoo::COMPILABLE_PLUGIN) === 0 && ($pluginType & Dwoo::NATIVE_PLUGIN) === 0 && ($pluginType & Dwoo::PROXY_PLUGIN) === 0) {
			$this->addUsedPlugin($name, $pluginType);
		}

		return $pluginType;
	}
797432
protected function get($name)
    {
        $this->load();

        return isset($this->lng[$name]) ? $this->lng[$name] : $name;
    }
63861
public function deactivate($name)
    {
        $name = Container::get('hooks')->fire('model.plugin.deactivate.name', $name);
        $activePlugins = $this->manager->getActivePlugins();

        // Check if plugin is actually activated
        if (($k = array_search($name, $activePlugins)) !== false) {
            $plugin = DB::forTable('plugins')->where('name', $name)->find_one();
            if (!$plugin) {
                $plugin = DB::forTable('plugins')->create()->set('name', $name);
            }
            $plugin->set('active', 0);

            // Allow additionnal deactivate functions
            $this->manager->deactivate($name);

            $plugin = Container::get('hooks')->fireDB('model.plugin.deactivate', $plugin);
            $plugin->save();

            $this->manager->setActivePlugins();

            return $plugin;
        }
        return true;
    }
845968
public function get($name)
    {
        switch (true) {
            case isset($this->active[$name]):
                return $this->values[$name];

            case isset($this->values[$name]):
                break;

            case \array_key_exists($name, $this->values):
                break;

            case isset($this->alias[$name]):
                $this->active[$name] = true;

                return $this->values[$name] = $this->get($this->alias[$name]);

            case isset($this->factory[$name]):
                $factory = $this->factory[$name];

                if (\is_string($factory) && \class_exists($factory)) {
                    $this->values[$name] = $this->create($factory, $this->factoryMap[$name]);
                } else {
                    $this->values[$name] = $this->call($factory, $this->factoryMap[$name]);
                }
                break;

            case \class_exists($name):
                return $this->build($name);

            default:
                throw new NotFoundException($name);
        }

        $this->active[$name] = true;


        if (null !== $configures = $this->getConfigure($name)) {
            foreach ($configures as $index => $config) {
                $value = $this->call($config, $this->configMap[$name][$index]);

                if ($value !== null) {
                    $this->values[$name] = $value;
                }
            }
        }

        return $this->values[$name];
    }