getBaseName(); $Identifier = "EnabledCheckbox-".$BaseName; return "IsEnabled() ? " checked" : "") .(($BaseName == "CWISCore" || $BaseName == "MetavusCore") ? " readonly disabled" : "") ." onchange='this.form.submit();'>"; } /** * Get content for "Name" column in plugin list. * @param Plugin $Plugin Plugin for this row. * @return string Generated content. */ function getContentForName(Plugin $Plugin): string { $Name = $Plugin->getName(); $BaseName = $Plugin->getBaseName(); return (str_replace(" ", "", $Name) == $BaseName) ? $Name : $Name." (".$BaseName.")"; } /** * Get content for "Dependencies" column in plugin list. * @param Plugin $Plugin Plugin for this row. * @return string Generated content. */ function getContentForDependencies(Plugin $Plugin): string { $Content = ""; } /** * Get content (if any) for "Actions" column in plugin list. * @param Plugin $Plugin Plugin for this row. * @return string Generated content. */ function getContentForActions(Plugin $Plugin): string { $Content = ""; $Attribs = $Plugin->getAttributes(); $BaseName = $Plugin->getBaseName(); if ($Plugin->isInstalled()) { $CfgLink = !is_null($Attribs["CfgPage"]) && strlen($Attribs["CfgPage"]) ? $Attribs["CfgPage"] : (count($Attribs["CfgSetup"]) ? "index.php?P=PluginConfig&PN=".$BaseName : ""); if (strlen($CfgLink)) { $Content .= "" ."Configure"; } if (($BaseName != "CWISCore") && ($BaseName != "MetavusCore")) { $Content .= "" ."Uninstall"; } } $Content .= ""; return $Content; } /** * Get CSS class (if any) for cells for item. * @param Plugin $Plugin Plugin for this row. * @return string CSS class (if any). */ function getCssClassForPluginRow(Plugin $Plugin) { return (!$Plugin->isReady()) ? "text-muted" : ""; } # ----- MAIN ----------------------------------------------------------------- PageTitle("Plugins"); if (!isset($H_StatusMsgs)) { throw new Exception("Status messages not loaded."); } if (!isset($H_ErrMsgs)) { throw new Exception("Error messages not loaded."); } $Plugins = $GLOBALS["G_PluginManager"]->GetPlugins(); usort( $Plugins, function ($A, $B) { return $A->getName() <=> $B->getName(); } ); $BasePlugins = []; $LocalPlugins = []; foreach ($Plugins as $Plugin) { if (preg_match("%/local/plugins/%", $Plugin->getClassFile())) { $LocalPlugins[$Plugin->getBaseName()] = $Plugin; } else { $BasePlugins[$Plugin->getBaseName()] = $Plugin; } } $ListFields = [ "Enabled" => [ "Heading" => "", "ValueFunction" => "getContentForEnabled", "AllowHTML" => true, ], "Name" => [ "ValueFunction" => "getContentForName", "ClassFunction" => "getCssClassForPluginRow", ], "Version" => [ "Heading" => "Ver", "ClassFunction" => "getCssClassForPluginRow", ], "Description" => [ "ClassFunction" => "getCssClassForPluginRow", "AllowHTML" => true, ], "Dependencies" => [ "ValueFunction" => "getContentForDependencies", "ClassFunction" => "getCssClassForPluginRow", "AllowHTML" => true, ], "Actions" => [ "Heading" => "", "ValueFunction" => "getContentForActions", "AllowHTML" => true, ], ]; $BaseListUI = new ItemListUI($ListFields); $BaseListUI->itemsPerPage(200); $BaseListUI->fieldsSortableByDefault(false); $LocalListUI = clone $BaseListUI; $BaseListUI->heading("Base Plugins"); $LocalListUI->heading("Local Plugins"); ?>

Plugins

pluginEnabled("Developer")) { print $GLOBALS["G_PluginManager"]->getPlugin("Developer")->getSettingsInfoHtml(); } ?>
display($BasePlugins); $LocalListUI->display($LocalPlugins); ?>