. /** * Adds a setting to allow a user to hide #NSFW-hashtagged notices behind a * blocker image until clicked. * * @package GNUsocial * @author MoonMan * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ defined('GNUSOCIAL') || die(); /** * Class SensitiveContentSettingsAction * Handles the settings action for this plugin * * @package GNUsocial * @author MoonMan * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ class SensitiveContentSettingsAction extends SettingsAction { public function title() { return _m('Sensitive content settings'); } public function getInstructions() { return _m('Set preferences for display of "sensitive" content'); } public function showContent() { $user = $this->scoped->getUser(); $this->elementStart( 'form', [ 'method' => 'post', 'id' => 'sensitivecontent', 'class' => 'form_settings', 'action' => common_local_url('sensitivecontentsettings'), ] ); $this->elementStart('fieldset'); $this->hidden('token', common_session_token()); $this->elementStart('ul', 'form_data'); $this->elementStart('li'); $this->checkbox( 'hidesensitive', _('Hide attachments in posts hashtagged #NSFW'), ($this->arg('hidesensitive') ? $this->boolean('hidesensitive') : $this->scoped->getPref('MoonMan', 'hide_sensitive', 0)) ); $this->elementEnd('li'); $this->elementEnd('ul'); $this->submit('save', _m('BUTTON', 'Save')); $this->elementEnd('fieldset'); $this->elementEnd('form'); } public function doPost() { $hidesensitive = $this->boolean('hidesensitive') ? '1' : '0'; $this->scoped->setPref('MoonMan', 'hide_sensitive', $hidesensitive); return _m('Settings saved.'); } }