3 namespace Friendica\Module\Admin\Addons;
5 use Friendica\Core\Addon;
6 use Friendica\Core\L10n;
7 use Friendica\Core\Renderer;
9 use Friendica\Module\BaseAdminModule;
11 class Index extends BaseAdminModule
13 public static function content(array $parameters = [])
15 parent::content($parameters);
19 // reload active themes
20 if (!empty($_GET['action'])) {
21 parent::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');
23 switch ($_GET['action']) {
26 info('Addons reloaded');
30 $addon = $_GET['addon'] ?? '';
31 if (Addon::isEnabled($addon)) {
32 Addon::uninstall($addon);
33 info(L10n::t('Addon %s disabled.', $addon));
34 } elseif (Addon::install($addon)) {
35 info(L10n::t('Addon %s enabled.', $addon));
37 info(L10n::t('Addon %s failed to install.', $addon));
44 DI::baseUrl()->redirect('admin/addons');
47 $addons = Addon::getAvailableList();
49 $t = Renderer::getMarkupTemplate('admin/addons/index.tpl');
50 return Renderer::replaceMacros($t, [
51 '$title' => L10n::t('Administration'),
52 '$page' => L10n::t('Addons'),
53 '$submit' => L10n::t('Save Settings'),
54 '$reload' => L10n::t('Reload active addons'),
55 '$baseurl' => $a->getBaseURL(true),
56 '$function' => 'addons',
58 '$pcount' => count($addons),
59 '$noplugshint' => L10n::t('There are currently no addons available on your node. You can find the official addon repository at %1$s and might find other interesting addons in the open addon registry at %2$s', 'https://github.com/friendica/friendica-addons', 'http://addons.friendi.ca'),
60 '$form_security_token' => parent::getFormSecurityToken('admin_addons'),