@param array $plugins

@return bool
@throws ClientException
541935
public function setPluginsFromPluginArray(array $plugins = [])
    {
        if ((bool) $plugins === true) {
            foreach ($plugins as $key => $plugin) {
                if (is_subclass_of($plugin, Plugin::class)) {
                    $this->pluginStorage[$key]['plugin']   = $plugin;
                    $this->pluginStorage[$key]['priority'] = $plugin->priority;
                } else {
                    throw new ClientException('Could not initialize plugin. Is not a subclass of frankmayer\ArangoDbPhpCore\Plugins\PluginPlugin');
                }
            }
        }
        uksort($this->pluginStorage, [$this, 'comparePluginPriorities']);

        return true;
    }
919769
protected function clientSettings(array $configs, ContainerBuilder $container)
    {
        foreach($configs as $key => $infos){
            $clientDefinition = new Definition();
            $clientDefinition->setClass($infos['class']);
            
            $hostsSettings = $this->hostSettings($infos);
            $logPathSettings = $this->logPathSettings($infos);
            $logLevelSettings = $this->logLevelSettings($infos);
            
            $options = array(
                            'hosts' => $hostsSettings,
                            'logPath' => $logPathSettings,
                            'logLevel' => $logLevelSettings
                            );
            
            $clientDefinition->setArguments(array($options));
            
            $clientServiceId = 'ushios_elastic_search_client';
            if ($key == 'default'){
                $container->setDefinition($clientServiceId, $clientDefinition);
                $clientServiceId = $clientServiceId.'.default';
            }else{
                $clientServiceId = $clientServiceId.'.'.$key;
            }
    
            $container->setDefinition($clientServiceId, $clientDefinition);
        }
    }
150751
protected function call_pluginfo_service(array $params) {

        $serviceurl = $this->get_serviceurl_pluginfo();
        $response = $this->call_service($serviceurl, $params);

        if ($response) {
            if ($response->info['http_code'] == 404) {
                // There is no such plugin found in the plugins directory.
                return false;

            } else if ($response->info['http_code'] == 200 and isset($response->data->status)
                    and $response->data->status === 'OK' and $response->data->apiver == self::APIVER
                    and isset($response->data->pluginfo)) {
                    return $this->validate_pluginfo_format($response->data->pluginfo);

            } else {
                debugging('cURL: Unexpected response', DEBUG_DEVELOPER);
                return false;
            }
        }

        return false;
    }
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;
	}
235501
protected function setInstalledIds(array $pluginIds)
    {
        $app = $this->app->getRecord();
        $app['pluginIds'] = array_filter($pluginIds);
        $app->save();

        return $this;
    }
577199
public function select($keyOrKeys)
    {
        if ($keyOrKeys instanceof Plugin) {
            $keys = [$keyOrKeys->getKey()];
        } elseif (is_array($keyOrKeys)) {
            $keys = [];
            foreach ($keyOrKeys as $kok) {
                $keys[] = $kok instanceof Plugin ? $kok->getKey() : $kok;
            }
        } else {
            $keys = [$keyOrKeys];
        }

        $this->selectedPlugins = array_unique(array_merge($this->selectedPlugins, $keys));
    }
117751
private function allAreGlobal(array $namespaces): bool
    {
        foreach ($namespaces as $namespace) {
            if ($namespace->name && $namespace->name->toString() !== '') {
                return false;
            }
        }
        return true;
    }
1105589
private function loadPlugins($pluginsDirectory) {
            $pluginsDirectory = MISC::findFile($pluginsDirectory);

            if(file_exists($pluginsDirectory)) {
                $tmp_plugins = array();

                foreach (glob($pluginsDirectory . '/*/*.json') as $file) {
                    $config = json_decode(file_get_contents($file), true);

                    $tmp_plugins[] = array(
                        'name'      => $config['name'],
                        'priority'  => $config['priority'],
                        'directory' => dirname($file),
                        'mainClass' => $config['mainClass'],
                        'classes'   => $config['classes']
                    );
                }

                MISC::array_sort_key($tmp_plugins, 'priority');

                foreach($tmp_plugins as $tmp_plugin) {
                    $plugin = new Plugin($tmp_plugin['name']);
                    $plugin->setMainClass($tmp_plugin['mainClass'])
                        ->setDirectory($tmp_plugin['directory'])
                        ->setPriority($tmp_plugin['priority'])
                        ->setClasses($tmp_plugin['classes']);

                    $this->plugins[] = $plugin;
                    new Logger('Plugin ['. $plugin->getName() .'] successfully loaded.', Logger::INFO, __FILE__, __LINE__);
                }

                new Logger('Plugins successfully loaded.', Logger::INFO, __FILE__, __LINE__);
                return true;
            } else {
                new Logger('Plugins directory wasn\'t found. (' . $pluginsDirectory . ')', Logger::WARNING, __FILE__, __LINE__);
                return false;
            }
        }
1238019
public static function check_dependency( $plugin_file_array ) {
		$plugins = (array) get_option( 'active_plugins' );
		foreach ( (array) $plugin_file_array as $file ) {
			$found = false;
			foreach ( $plugins as $plugin ) {
				if ( false !== strpos( $plugin, $file ) ) {
					$found = true;
					break;
				}
			}
			// This plugin is not found.
			// So, check failed.
			if ( ! $found ) {
				return false;
			}
		}
		return true;
	}
1165248
private static function isCompatable(Plugin $plugin) : bool
  {
    $frameworkVersion = substr(self::getVersion(), 0, strrpos(self::getVersion(), '*'));
    $pluginVersions   = explode('|', $plugin::FRAMEWORK);

    foreach($pluginVersions as $version) {
      $version = substr($version, 0, strrpos($version, '*'));

      return starts_with($frameworkVersion, $version);
    }

    return false;
  }
866733
public function validatePlugin($plugin)
    {
        if($plugin instanceof AdapterInterface) {
            return;
        }

        throw new InvalidPluginException(sprintf(
            'Plugin of type %s is invalid; must implement %s\AdapterInterface and set ID',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            __NAMESPACE__
        ));
    }
903195
public function appendPlugin(Plugin ...$plugins)
    {
        foreach ($plugins as $plugin) {
            $this->appendPlugins[] = $plugin;
        }

        return $this;
    }
1088701
protected function _loadPlugins($plugins)
    {
        $app_plugins = [];
        foreach ($this->filesystem->glob('@app/Plugins/*Plugin.php') as $item) {
            $app_plugins[basename($item, '.php')] = 1;
        }

        foreach ($plugins as $k => $v) {
            $plugin = is_string($k) ? $k : $v;
            if (($pos = strrpos($plugin, 'Plugin')) === false || $pos !== strlen($plugin) - 6) {
                $plugin .= 'Plugin';
            }

            if ($plugin[0] === '!') {
                unset($app_plugins[ucfirst(substr($plugin, 1))]);
                continue;
            }

            $plugin = ucfirst($plugin);

            $pluginClassName = isset($app_plugins[$plugin]) ? $this->alias->get('@ns.app') . "\\Plugins\\$plugin" : "ManaPHP\Plugins\\$plugin";
            unset($app_plugins[$plugin]);

            $plugin = lcfirst($plugin);
            $this->_di->setShared($plugin, is_int($k) ? $pluginClassName : array_merge($v, ['class' => $pluginClassName]))->getShared($plugin);
        }

        foreach ($app_plugins as $plugin => $_) {
            $pluginClassName = $this->alias->get('@ns.app') . "\\Plugins\\$plugin";
            $plugin = lcfirst($plugin);
            $this->_di->setShared($plugin, $pluginClassName)->getShared($plugin);
        }
    }
110117
public function call(string $method, array $arguments): Response
    {
        try {
            return $this->request('GET', $method, [
                'query' => $arguments
            ]);
        } catch (\Exception $e) {
            throw new ClientException($e->getMessage(), $e->getCode(), $e);
        }
    }
1093562
protected function clientSubmit($buttons)
    {
        if (empty($buttons)) {
            return false;
        }
        $scripts = false;
        foreach ($buttons as $button) {
            if (array_get($button instanceof AbstractType ? $button->getAttributes() : $button->attributes, 'type') !== 'submit' or array_get($button instanceof AbstractType ? $button->getAttributes() : $button->attributes, 'disable_client_submit', false) == true
            ) {
                continue;
            }
            $atttibutes = $button instanceof AbstractType ? $button->getAttributes() : $button->attributes;
            if (isset($atttibutes['disable_client_submit'])) {
                unset($atttibutes['disable_client_submit']);
            }
            $atttibutes['class'] = array_get($atttibutes, 'class', '') . ' client-submit';


            $atttibutes['data-title'] = trans('antares/foundation::messages.are_you_sure');
            $button->attributes       = $button instanceof AbstractType ? $button->getAttributes() : $button->attributes;
            $scripts                  = true;
        }
        if ($scripts) {
            publish(null, '/packages/core/js/submitter.js');
        }
        return $buttons;
    }
683255
public static function isEnabled($plugin)
    {
        $plugin_list = static::getPluginList();

        return (is_array($plugin_list) && in_array($plugin, $plugin_list)) ? true : false;
    }
158500
public function isPluginDismissed( $plugin ) {
		$dismissed = false;

		$plugin_prompts = $this->getPluginPrompts( $plugin );

		foreach ( $plugin_prompts as $prompt ) {
			if ( ! empty( $prompt['time_dismissed'] ) ) {
				$dismissed = true;
			}
		}

		return $dismissed;
	}