$plugins[$plugin]['notinstalled'] = array(); } foreach (array_keys($plugins) as $plugin) { if (table_exists(new XMLDBTable($plugin . '_installed'))) { if ($installed = plugins_installed($plugin, true)) { foreach ($installed as $i) { $key = $i->name; if ($plugin == 'blocktype') { $key = blocktype_single_to_namespaced($i->name, $i->artefactplugin); } if (!safe_require_plugin($plugin, $key)) { continue; } $plugins[$plugin]['installed'][$key] = array('active' => $i->active, 'disableable' => call_static_method(generate_class_name($plugin, $key), 'can_be_disabled')); if ($plugins[$plugin]['installed'][$key]['disableable'] || !$i->active) { $plugins[$plugin]['installed'][$key]['activateform'] = activate_plugin_form($plugin, $i); } if ($plugin == 'artefact') { $plugins[$plugin]['installed'][$key]['types'] = array(); safe_require('artefact', $key); if ($types = call_static_method(generate_class_name('artefact', $i->name), 'get_artefact_types')) { foreach ($types as $t) { $classname = generate_artefact_class_name($t); if ($collapseto = call_static_method($classname, 'collapse_config')) { $plugins[$plugin]['installed'][$key]['types'][$collapseto] = true; } else { $plugins[$plugin]['installed'][$key]['types'][$t] = call_static_method($classname, 'has_config'); } } } } else {
require_once 'pieforms/pieform.php'; $plugintype = param_alpha('plugintype'); $pluginname = param_variable('pluginname'); define('SECTION_PLUGINTYPE', $plugintype); define('SECTION_PLUGINNAME', $pluginname); define('SECTION_PAGE', 'pluginconfig'); safe_require($plugintype, $pluginname); $enable = param_integer('enable', 0); $disable = param_integer('disable', 0); if ($disable && !call_static_method(generate_class_name($plugintype, $pluginname), 'can_be_disabled')) { throw new UserException("Plugin {$plugintype} {$pluginname} cannot be disabled"); } if ($enable || $disable) { require_once get_config('libroot') . 'upgrade.php'; clear_menu_cache(); activate_plugin_form($plugintype, get_record($plugintype . '_installed', 'name', $pluginname)); } if ($plugintype == 'artefact') { $type = param_alpha('type'); $classname = generate_artefact_class_name($type); } else { $type = ''; $classname = generate_class_name($plugintype, $pluginname); } if (!call_static_method($classname, 'has_config')) { throw new InvalidArgumentException("{$classname} doesn't have config options available"); } $form = call_static_method($classname, 'get_config_options'); $form['plugintype'] = $plugintype; $form['pluginname'] = $pluginname; $form['name'] = 'pluginconfig';