]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/SensitiveContent/actions/sensitivecontentsettings.php
Merge branch 'nightly' into 'nightly'
[quix0rs-gnu-social.git] / plugins / SensitiveContent / actions / sensitivecontentsettings.php
1 <?php
2
3 if (!defined('GNUSOCIAL')) { exit(1); }
4
5 class SensitiveContentSettingsAction extends SettingsAction
6 {
7         function title()
8         {
9                 return _m('Sensitive content settings');
10         }
11
12         function getInstructions()
13         {
14                 return _m('Set preferences for display of "sensitive" content');
15         }
16
17         function showContent()
18         {
19
20                 $user = $this->scoped->getUser();
21
22                 $this->elementStart('form', array('method' => 'post',
23                         'id' => 'sensitivecontent',
24                         'class' => 'form_settings',
25                         'action' => common_local_url('sensitivecontentsettings')));
26
27                 $this->elementStart('fieldset');
28                 $this->hidden('token', common_session_token());
29                 $this->elementStart('ul', 'form_data');
30
31                 $this->elementStart('li');
32                         $this->checkbox('hidesensitive', _('Hide attachments in posts hashtagged #NSFW'),
33                                 ($this->arg('hidesensitive')) ?
34                                 $this->boolean('hidesensitive') : $this->scoped->getPref('MoonMan','hide_sensitive',0));
35                 $this->elementEnd('li');
36
37
38                 $this->elementEnd('ul');
39                 $this->submit('save', _m('BUTTON','Save'));
40
41                 $this->elementEnd('fieldset');
42                 $this->elementEnd('form');
43         }
44
45         function doPost()
46         {
47                 $hidesensitive = $this->booleanintstring('hidesensitive');
48                 $this->scoped->setPref('MoonMan','hide_sensitive', $hidesensitive);
49                 return _('Settings saved.');
50         }
51 }