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);
17 // reload active themes
18 if (!empty($_GET['action'])) {
19 parent::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');
21 switch ($_GET['action']) {
24 info('Addons reloaded');
28 $addon = $_GET['addon'] ?? '';
29 if (Addon::isEnabled($addon)) {
30 Addon::uninstall($addon);
31 info(L10n::t('Addon %s disabled.', $addon));
32 } elseif (Addon::install($addon)) {
33 info(L10n::t('Addon %s enabled.', $addon));
35 info(L10n::t('Addon %s failed to install.', $addon));
42 DI::baseUrl()->redirect('admin/addons');
45 $addons = Addon::getAvailableList();
47 $t = Renderer::getMarkupTemplate('admin/addons/index.tpl');
48 return Renderer::replaceMacros($t, [
49 '$title' => L10n::t('Administration'),
50 '$page' => L10n::t('Addons'),
51 '$submit' => L10n::t('Save Settings'),
52 '$reload' => L10n::t('Reload active addons'),
53 '$baseurl' => DI::baseUrl()->get(true),
54 '$function' => 'addons',
56 '$pcount' => count($addons),
57 '$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'),
58 '$form_security_token' => parent::getFormSecurityToken('admin_addons'),