Quick access to the plugins
@return array the registered plugins
339051
public function getPlugins(){
        $config = [];
        $registry = self::getRegistry();

        if ($registry->isRegistered(self::CREATOR)) {
            $config = $registry->get(self::CREATOR);
        }

        if (!isset($config['plugins'])) {
            return [];
        }

        return $config['plugins'];
    }
893630
public function getControllerPluginConfig()
    {
        return [
            'factories' => [
                Controller\Plugin\Config::class => Controller\Plugin\Factory\ConfigFactory::class,
                Controller\Plugin\Env::class => Controller\Plugin\Factory\EnvFactory::class,
                Controller\Plugin\Server::class => Controller\Plugin\Factory\ServerFactory::class,
            ],
            'aliases' => [
                'pluginConfig' => Controller\Plugin\Config::class,
                'pluginEnv' => Controller\Plugin\Env::class,
                'pluginServer' => Controller\Plugin\Server::class,
            ],
        ];
    }
725643
public function getInstalledPlugins()
    {
        $arr = array();

        foreach ($this->pluginInformations as $single) {
            $arr = array_merge($arr, $single->getInstalledPlugins());
        }

        return $arr;
    }
121597
public function index()
    {
        $collection = plugin()->filter(function ($plugin) {
            return !$plugin->isTheme;
        });
        $plugins = $collection;
        $enabled = count($collection->filter(function ($plugin) {
            return $plugin->status;
        })->toArray());
        $disabled = count($collection->filter(function ($plugin) {
            return !$plugin->status;
        })->toArray());

        $this->title(__d('system', 'Plugins'));
        $this->set(compact('plugins', 'all', 'enabled', 'disabled'));
        $this->_awaitingPlugins();
        $this->Breadcrumb->push('/admin/system/plugins');
    }
1093146
protected function _load()
    {
        if (empty($this->_plugins)) {
            $this->_plugins = AnService::get('repos:settings.plugin')
                              ->getQuery()
                              ->where('enabled', '=', 1)
                              ->toEntityset();
        }

        return $this->_plugins;
    }
1220997
protected function getPluggables()
    {
        $pluggables = $this->pluggable->all();
        $results = [];

        foreach ($pluggables as $pluggable) {
            $results[] = $this->getPluggableInformation($pluggable);
        }

        return array_filter($results);
    }
136927
public static function get_enabled_plugins() {
        $plugins = core_plugin_manager::instance()->get_installed_plugins('qbehaviour');
        if (!$plugins) {
            return array();
        }
        if ($disabled = get_config('question', 'disabledbehaviours')) {
            $disabled = explode(',', $disabled);
        } else {
            $disabled = array();
        }

        $enabled = array();
        foreach ($plugins as $plugin => $version) {
            if (in_array($plugin, $disabled)) {
                continue;
            }
            $enabled[$plugin] = $plugin;
        }

        return $enabled;
    }
785060
public function getSelectedPlugins()
    {
        $manager = $this;

        return array_filter($this->selectedPlugins, function ($plugin) use ($manager) {
            return $manager->isAvailable($plugin);
        });
    }
255249
public function loadActivatedPlugins()
    {
        $pluginsToLoad = $this->getActivatedPluginsFromConfig();
        if (!SettingsPiwik::isInternetEnabled()) {
            $pluginsToLoad = array_filter($pluginsToLoad, function($name) {
                $plugin = Manager::makePluginClass($name);
                return !$plugin->requiresInternetConnection();
            });
        }
        $this->loadPlugins($pluginsToLoad);
    }
824364
private function get_current_plugins() {
		$updates_avail = get_site_transient( 'update_plugins' );

		$msg = '';
		foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
			$plugin_data = get_plugin_data( $plugin );

			$plugin_file = str_replace( trailingslashit( WP_PLUGIN_DIR ), '', $plugin );

			if ( isset( $updates_avail->response[ $plugin_file ] ) ) {
				$msg .= '<i class="icon-close1"></i> ';
			}
			$msg .= '<a href="' . $plugin_data['PluginURI'] . '">' . $plugin_data['Name'] . '</a> v' . $plugin_data['Version'] . '<br/>';
		}

		return $msg;
	}
1191032
public static function get_enabled_plugins() {
        global $CFG;

        $enabled = array();
        foreach (explode(',', $CFG->enrol_plugins_enabled) as $enrol) {
            $enabled[$enrol] = $enrol;
        }

        return $enabled;
    }
252265
protected function getUiPlugins()
    {
        $rtn = array();
        $path = APPLICATION_PATH . 'public/assets/js/build-plugins/';
        $dir = opendir($path);

        while ($item = readdir($dir)) {
            if (substr($item, 0, 1) == '.' || substr($item, -3) != '.js') {
                continue;
            }

            $rtn[] = $item;
        }

        return $rtn;
    }
915605
protected function load_installed_plugins() {
        global $DB, $CFG;

        if ($this->installedplugins) {
            return;
        }

        if (empty($CFG->version)) {
            // Nothing installed yet.
            $this->installedplugins = array();
            return;
        }

        $cache = cache::make('core', 'plugin_manager');
        $installed = $cache->get('installed');

        if (is_array($installed)) {
            $this->installedplugins = $installed;
            return;
        }

        $this->installedplugins = array();

        $versions = $DB->get_records('config_plugins', array('name'=>'version'));
        foreach ($versions as $version) {
            $parts = explode('_', $version->plugin, 2);
            if (!isset($parts[1])) {
                // Invalid component, there must be at least one "_".
                continue;
            }
            // Do not verify here if plugin type and name are valid.
            $this->installedplugins[$parts[0]][$parts[1]] = $version->value;
        }

        foreach ($this->installedplugins as $key => $value) {
            ksort($this->installedplugins[$key]);
        }

        $cache->set('installed', $this->installedplugins);
    }
87069
protected function loadPlugins()
    {
        $pluginsDirs = array(
            __DIR__.'/../../data/plugins/Ladybug/Plugin',
            __DIR__.'/../../../ladybug-plugins/Ladybug/Plugin',
            __DIR__.'/../../../ladybug-themes/Ladybug/Plugin'
        );

        foreach ($pluginsDirs as $dir) {
            if (is_dir($dir)) {
                $finder = new Finder();
                $finder->in($dir)->files()->depth(1)->name('*Plugin.php');

                foreach ($finder as $file) {
                    /** @var SplFileInfo $file */
                    $this->registerPlugin($file);
                }
            }
        }
    }
362855
protected function getConfigs()
    {
        if ($this->hasCache()) {
            return $this->getCache();
        }

        $pluginConfigs = $this->pluginConfig;

        $configs = [];

        foreach ($pluginConfigs as $name => $pluginConfig) {
            $config = $this->configFields->convertBc(
                $name,
                $pluginConfig
            );

            $configs[] = new ConfigBasic($config);
        }

        $newConfigs = $this->configRepositoryJson->find();

        $configs = array_merge($configs, $newConfigs);

        $this->setCache($configs);

        return $configs;
    }
1352577
public function listPluginDataBySubdirectory() {
    $plugin_types_data = $this->listPluginData('AnnotatedClassDiscovery');
    $plugin_types_data_by_subdirectory = [];
    foreach ($plugin_types_data as $plugin_id => $plugin_definition) {
      if (!empty($plugin_definition['subdir'])) {
        $subdir = substr($plugin_definition['subdir'], strlen('Plugin/'));

        $plugin_types_data_by_subdirectory[$subdir] = $plugin_definition;
      }
    }
    return $plugin_types_data_by_subdirectory;
  }
662019
public function loadPlugins()
    {
        $activePlugins = $this->getActivePlugins();
        foreach ($activePlugins as $plugin) {
            if ($class = $this->load($plugin)) {
                $class->run();
            }
        }
    }