]> git.mxchange.org Git - friendica.git/blob - src/Module/BaseSettings.php
1a20fc3dc97caf0f9107456c0a07d4d9bdf6f821
[friendica.git] / src / Module / BaseSettings.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2021, the Friendica project
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  */
21
22 namespace Friendica\Module;
23
24 use Friendica\BaseModule;
25 use Friendica\Content\Feature;
26 use Friendica\Core\Renderer;
27 use Friendica\DI;
28
29 class BaseSettings extends BaseModule
30 {
31         public static function content()
32         {
33                 $a = DI::app();
34
35                 $tpl = Renderer::getMarkupTemplate('settings/head.tpl');
36                 DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
37                         '$ispublic' => DI::l10n()->t('everybody')
38                 ]);
39
40                 $tabs = [];
41
42                 $tabs[] = [
43                         'label' => DI::l10n()->t('Account'),
44                         'url' => 'settings',
45                         'selected' => ((DI::args()->getArgc() == 1) && (DI::args()->getArgv() === 'settings') ? 'active' : ''),
46                         'accesskey' => 'o',
47                 ];
48
49                 $tabs[] = [
50                         'label' => DI::l10n()->t('Two-factor authentication'),
51                         'url' => 'settings/2fa',
52                         'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === '2fa') ? 'active' : ''),
53                         'accesskey' => 'o',
54                 ];
55
56                 $tabs[] = [
57                         'label' => DI::l10n()->t('Profile'),
58                         'url' => 'settings/profile',
59                         'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'profile') ? 'active' : ''),
60                         'accesskey' => 'p',
61                 ];
62
63                 if (Feature::get()) {
64                         $tabs[] = [
65                                 'label' => DI::l10n()->t('Additional features'),
66                                 'url' => 'settings/features',
67                                 'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'features') ? 'active' : ''),
68                                 'accesskey' => 't',
69                         ];
70                 }
71
72                 $tabs[] = [
73                         'label' => DI::l10n()->t('Display'),
74                         'url' => 'settings/display',
75                         'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'display') ? 'active' : ''),
76                         'accesskey' => 'i',
77                 ];
78
79                 $tabs[] = [
80                         'label' => DI::l10n()->t('Social Networks'),
81                         'url' => 'settings/connectors',
82                         'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'connectors') ? 'active' : ''),
83                         'accesskey' => 'w',
84                 ];
85
86                 $tabs[] = [
87                         'label' => DI::l10n()->t('Addons'),
88                         'url' => 'settings/addon',
89                         'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'addon') ? 'active' : ''),
90                         'accesskey' => 'l',
91                 ];
92
93                 $tabs[] = [
94                         'label' => DI::l10n()->t('Manage Accounts'),
95                         'url' => 'settings/delegation',
96                         'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'delegation') ? 'active' : ''),
97                         'accesskey' => 'd',
98                 ];
99
100                 $tabs[] = [
101                         'label' => DI::l10n()->t('Connected apps'),
102                         'url' => 'settings/oauth',
103                         'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'oauth') ? 'active' : ''),
104                         'accesskey' => 'b',
105                 ];
106
107                 $tabs[] = [
108                         'label' => DI::l10n()->t('Export personal data'),
109                         'url' => 'settings/userexport',
110                         'selected' => ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'userexport') ? 'active' : ''),
111                         'accesskey' => 'e',
112                 ];
113
114                 $tabs[] = [
115                         'label' => DI::l10n()->t('Remove account'),
116                         'url' => 'removeme',
117                         'selected' => ((DI::args()->getArgc() == 1) && (DI::args()->getArgv() === 'removeme') ? 'active' : ''),
118                         'accesskey' => 'r',
119                 ];
120
121
122                 $tabtpl = Renderer::getMarkupTemplate("generic_links_widget.tpl");
123                 DI::page()['aside'] = Renderer::replaceMacros($tabtpl, [
124                         '$title' => DI::l10n()->t('Settings'),
125                         '$class' => 'settings-widget',
126                         '$items' => $tabs,
127                 ]);
128         }
129 }