]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/settingsnav.php
Last type-hint is an array, added.
[quix0rs-gnu-social.git] / lib / settingsnav.php
1 <?php
2 /**
3  * StatusNet - the distributed open-source microblogging tool
4  * Copyright (C) 2010,2011, StatusNet, Inc.
5  *
6  * Settings menu
7  *
8  * PHP version 5
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Affero General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Affero General Public License for more details.
19  *
20  * You should have received a copy of the GNU Affero General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  * @category  Widget
24  * @package   StatusNet
25  * @author    Evan Prodromou <evan@status.net>
26  * @copyright 2010,2011 StatusNet, Inc.
27  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
28  * @link      http://status.net/
29  */
30
31 if (!defined('STATUSNET')) {
32     // This check helps protect against security problems;
33     // your code file can't be executed directly from the web.
34     exit(1);
35 }
36
37 /**
38  * A widget for showing the settings group local nav menu
39  *
40  * @category Widget
41  * @package  StatusNet
42  * @author   Evan Prodromou <evan@status.net>
43  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
44  * @link     http://status.net/
45  *
46  * @see      HTMLOutputter
47  */
48 class SettingsNav extends Menu
49 {
50     /**
51      * Show the menu
52      *
53      * @return void
54      */
55     function show()
56     {
57         $actionName = $this->action->trimmed('action');
58         $user = common_current_user();
59         $nickname = $user->nickname;
60         $name = $user->getProfile()->getBestName();
61
62         $stub = new HomeStubNav($this->action);
63         $this->submenu(_m('MENU','Home'), $stub);
64         
65         $this->action->elementStart('ul');
66         $this->action->elementStart('li');
67         // TRANS: Header in settings navigation panel.
68         $this->action->element('h3', null, _m('HEADER','Settings'));
69         $this->action->elementStart('ul', array('class' => 'nav'));
70
71         if (Event::handle('StartAccountSettingsNav', array(&$this->action))) {
72             $this->action->menuItem(common_local_url('profilesettings'),
73                                     // TRANS: Menu item in settings navigation panel.
74                                     _m('MENU','Profile'),
75                                     // TRANS: Menu item title in settings navigation panel.
76                                     _('Change your profile settings'),
77                                     $actionName == 'profilesettings');
78
79             $this->action->menuItem(common_local_url('avatarsettings'),
80                                     // TRANS: Menu item in settings navigation panel.
81                                     _m('MENU','Avatar'),
82                                     // TRANS: Menu item title in settings navigation panel.
83                                     _('Upload an avatar'),
84                                     $actionName == 'avatarsettings');
85
86             $this->action->menuItem(common_local_url('passwordsettings'),
87                                     // TRANS: Menu item in settings navigation panel.
88                                     _m('MENU','Password'),
89                                     // TRANS: Menu item title in settings navigation panel.
90                                     _('Change your password'),
91                                     $actionName == 'passwordsettings');
92
93             $this->action->menuItem(common_local_url('emailsettings'),
94                                     // TRANS: Menu item in settings navigation panel.
95                                     _m('MENU','Email'),
96                                     // TRANS: Menu item title in settings navigation panel.
97                                     _('Change email handling'),
98                                     $actionName == 'emailsettings');
99
100             $this->action->menuItem(common_local_url('urlsettings'),
101                                     // TRANS: Menu item in settings navigation panel.
102                                     _m('MENU','URL'),
103                                     // TRANS: Menu item title in settings navigation panel.
104                                     _('URL shorteners'),
105                                     $actionName == 'urlsettings');
106
107             Event::handle('EndAccountSettingsNav', array(&$this->action));
108
109             $haveImPlugin = false;
110
111             Event::handle('HaveImPlugin', array(&$haveImPlugin));
112
113             if ($haveImPlugin) {
114                 $this->action->menuItem(common_local_url('imsettings'),
115                                         // TRANS: Menu item in settings navigation panel.
116                                         _m('MENU','IM'),
117                                         // TRANS: Menu item title in settings navigation panel.
118                                         _('Updates by instant messenger (IM)'),
119                                         $actionName == 'imsettings');
120             }
121
122             if (common_config('sms', 'enabled')) {
123                 $this->action->menuItem(common_local_url('smssettings'),
124                                         // TRANS: Menu item in settings navigation panel.
125                                         _m('MENU','SMS'),
126                                         // TRANS: Menu item title in settings navigation panel.
127                                         _('Updates by SMS'),
128                                         $actionName == 'smssettings');
129             }
130
131             $this->action->menuItem(common_local_url('oauthconnectionssettings'),
132                                     // TRANS: Menu item in settings navigation panel.
133                                     _m('MENU','Connections'),
134                                     // TRANS: Menu item title in settings navigation panel.
135                                     _('Authorized connected applications'),
136                                     $actionName == 'oauthconnectionsettings');
137
138             if (common_config('oldschool', 'enabled')) {
139                 $this->action->menuItem(common_local_url('oldschoolsettings'),
140                                         // TRANS: Menu item in settings navigation panel.
141                                         _m('MENU','Old school'),
142                                         // TRANS: Menu item title in settings navigation panel.
143                                         _('UI tweaks for old-school users'),
144                                         $actionName == 'oldschoolsettings');
145             }
146
147             Event::handle('EndConnectSettingsNav', array(&$this->action));
148         }
149
150         $this->action->elementEnd('ul');
151         $this->action->elementEnd('li');
152         $this->action->elementEnd('ul');
153     }
154 }