Get list of present plugins of given type.

@param string $type
@return array|null  list of presnet plugins $name=>$diskversion, null if unknown
10107
public function get_present_plugins($type) {
        $this->load_present_plugins();
        if (isset($this->presentplugins[$type])) {
            return $this->presentplugins[$type];
        }
        return null;
    }
823734
public function getFiles($type)
	{
		$f = $type . 'Files';

		if (property_exists($this, $f))
		{
			return self::${$f};
		}

		$this->say('Missing Files: ' . $type);

		return "";
	}
717900
public function load_plugins($subtype) {
        global $CFG;
        $result = array();

        $names = core_component::get_plugin_list($subtype);

        foreach ($names as $name => $path) {
            if (file_exists($path . '/locallib.php')) {
                require_once($path . '/locallib.php');

                $shortsubtype = substr($subtype, strlen('assign'));
                $pluginclass = 'assign_' . $shortsubtype . '_' . $name;

                $plugin = new $pluginclass($this, $name);

                if ($plugin instanceof assign_plugin) {
                    $idx = $plugin->get_sort_order();
                    while (array_key_exists($idx, $result)) {
                        $idx +=1;
                    }
                    $result[$idx] = $plugin;
                }
            }
        }
        ksort($result);
        return $result;
    }
1130021
public static function get_enabled_plugins() {
        global $DB;

        $plugins = core_plugin_manager::instance()->get_installed_plugins('format');
        if (!$plugins) {
            return array();
        }
        $installed = array();
        foreach ($plugins as $plugin => $version) {
            $installed[] = 'format_'.$plugin;
        }

        list($installed, $params) = $DB->get_in_or_equal($installed, SQL_PARAMS_NAMED);
        $disabled = $DB->get_records_select('config_plugins', "plugin $installed AND name = 'disabled'", $params, 'plugin ASC');
        foreach ($disabled as $conf) {
            if (empty($conf->value)) {
                continue;
            }
            list($type, $name) = explode('_', $conf->plugin, 2);
            unset($plugins[$name]);
        }

        $enabled = array();
        foreach ($plugins as $plugin => $version) {
            $enabled[$plugin] = $plugin;
        }

        return $enabled;
    }
1150582
public function getUnits($type = null)
    {
        if (!isset($type)) {
            return $this->units;
        }

        $filtered = array();
        foreach ($this->units as $key => $value) {
            if (isset($value['type']) && $value['type'] === $type) {
                $filtered[$key] = $value;
            }
        }

        return $filtered;
    }
1315337
public function get_enabled_plugins($type) {
        $this->load_enabled_plugins();
        if (isset($this->enabledplugins[$type])) {
            return $this->enabledplugins[$type];
        }
        return null;
    }
959291
public function get($type)
    {
        if (!isset($this->instances[$type])) {
            $this->instances[$type] = $this->loadFile($type);
        }

        return $this->instances[$type];
    }
363167
public static function getExtensionByType($type)
    {
        return empty($foundExtensions = array_keys(self::$_contentTypes, $type)) ? null : $foundExtensions[0];
    }
551729
public function getTypeOperations( string $type ): array {
		return array_intersect_key(
			$this->getArrayCopy(),
			array_flip( $this->typePointers[$type] )
		);
	}
633409
public static function getEventClasses($type)
    {
        $names = [PreUpsertsEvent::class, PostUpsertsEvent::class];

        if (Domain::TYPE_CREATE === $type) {
            $names = [PreCreatesEvent::class, PostCreatesEvent::class];
        } elseif (Domain::TYPE_UPDATE === $type) {
            $names = [PreUpdatesEvent::class, PostUpdatesEvent::class];
        } elseif (Domain::TYPE_DELETE === $type) {
            $names = [PreDeletesEvent::class, PostDeletesEvent::class];
        } elseif (Domain::TYPE_UNDELETE === $type) {
            $names = [PreUndeletesEvent::class, PostUndeletesEvent::class];
        }

        return $names;
    }
571966
protected static function getRoutesToFolder($type)
    {
        $type = $type . 's';

        $url = isset(self::$unify[$type]) ? self::$unify[$type] : self::$unify;

        return ['url' => $url, 'path' => self::getPathFromUrl($url)];
    }
1126890
public function version($type)
    {
        $version = $this->extractVersion($this->getVersionFromGit());

        return [
            'major' => $this->getMatchedVersionItem($version, 1),

            'minor' => $this->getMatchedVersionItem($version, 2),

            'patch' => $this->getMatchedVersionItem($version, 3),

            'build' => $this->getMatchedVersionItem($version, 4),
        ][$type];
    }
10745
protected function getPackages($type)
    {
        $packages = $this->packages->all();

        if (! is_null($type)) {
            $packages = $packages->where('type', $type);
        }

        $results = array();

        foreach ($packages->sortBy('basename') as $package) {
            $results[] = $this->getPackageInformation($package);
        }

        return array_filter($results);
    }
1170119
public function getChanges($type)
	{
		if ( ! isset($this->changes[$type]))
		{
			return null;
		}

		return $this->changes[$type];
	}
1302939
protected function _list($name = null)
    {
        if ($name === null) {
            $pluginsList = Plugin::loaded();
        } else {
            if (!Plugin::isLoaded($name)) {
                $this->err(sprintf('Plugin %s is not loaded.', $name));

                return [];
            }
            $pluginsList = [$name];
        }

        $plugins = [];

        foreach ($pluginsList as $plugin) {
            $path = Plugin::path($plugin) . 'webroot';
            if (!is_dir($path)) {
                $this->verbose('', 1);
                $this->verbose(
                    sprintf('Skipping plugin %s. It does not have webroot folder.', $plugin),
                    2
                );
                continue;
            }

            $link = Inflector::underscore($plugin);
            $dir = WWW_ROOT;
            $namespaced = false;
            if (strpos($link, '/') !== false) {
                $namespaced = true;
                $parts = explode('/', $link);
                $link = array_pop($parts);
                $dir = WWW_ROOT . implode(DIRECTORY_SEPARATOR, $parts) . DIRECTORY_SEPARATOR;
            }

            $plugins[$plugin] = [
                'srcPath' => Plugin::path($plugin) . 'webroot',
                'destDir' => $dir,
                'link' => $link,
                'namespaced' => $namespaced
            ];
        }

        return $plugins;
    }
1295014
public function getModifiersByType($type)
    {
        $modifiers = [];

        foreach ($this->modifiers as $modifier) {
            if ($modifier->getType() === $type) {
                $modifiers[$modifier->getIdentifier()->getFull()] = $modifier;
            }
        }

        return $modifiers;
    }
579508
public function getFinderByType($type)
    {
        if (is_dir($dir = $this->getSourceRoot() . DIRECTORY_SEPARATOR . "{$type}s")) {
            $finder = $this->getFinder()
                ->ignoreUnreadableDirs()
                ->depth('== 0')
                ->in($dir);

            return $finder;
        }

        return [];
    }