/** * Gathers and returns the information about all plugins of the given type, * either on disk or previously installed. * * @param string $type the name of the plugintype, eg. mod, auth or workshopform * @param string $typerootdir full path to the location of the plugin dir * @param string $typeclass the name of the actually called class * @param core_plugin_manager $pluginman the plugin manager calling this method * @return array of plugintype classes, indexed by the plugin name */ public static function get_plugins($type, $typerootdir, $typeclass, $pluginman) { $return = array(); $plugins = $pluginman->get_installed_plugins($type); foreach ($plugins as $name => $version) { $plugin = new $typeclass(); $plugin->type = $type; $plugin->typerootdir = $typerootdir; $plugin->name = $name; $plugin->rootdir = null; $plugin->displayname = $name; $plugin->versiondb = $version; $plugin->pluginman = $pluginman; $plugin->init_is_standard(); $return[$name] = $plugin; } return $return; }