3 namespace Friendica\Module\Admin\Addons;
5 use Friendica\Core\Addon;
6 use Friendica\Core\Renderer;
8 use Friendica\Module\BaseAdmin;
10 class Index extends BaseAdmin
12 public static function content(array $parameters = [])
14 parent::content($parameters);
16 // reload active themes
17 if (!empty($_GET['action'])) {
18 parent::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');
20 switch ($_GET['action']) {
23 info('Addons reloaded');
27 $addon = $_GET['addon'] ?? '';
28 if (Addon::isEnabled($addon)) {
29 Addon::uninstall($addon);
30 info(DI::l10n()->t('Addon %s disabled.', $addon));
31 } elseif (Addon::install($addon)) {
32 info(DI::l10n()->t('Addon %s enabled.', $addon));
34 info(DI::l10n()->t('Addon %s failed to install.', $addon));
41 DI::baseUrl()->redirect('admin/addons');
44 $addons = Addon::getAvailableList();
46 $t = Renderer::getMarkupTemplate('admin/addons/index.tpl');
47 return Renderer::replaceMacros($t, [
48 '$title' => DI::l10n()->t('Administration'),
49 '$page' => DI::l10n()->t('Addons'),
50 '$submit' => DI::l10n()->t('Save Settings'),
51 '$reload' => DI::l10n()->t('Reload active addons'),
52 '$baseurl' => DI::baseUrl()->get(true),
53 '$function' => 'addons',
55 '$pcount' => count($addons),
56 '$noplugshint' => DI::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'),
57 '$form_security_token' => parent::getFormSecurityToken('admin_addons'),