]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Linkback/actions/linkbacksettings.php
Merge branch 'fix-webfinger-link-header' into 'master'
[quix0rs-gnu-social.git] / plugins / Linkback / actions / linkbacksettings.php
1 <?php
2 /**
3  * Settings for Linkback
4  *
5  * PHP version 5
6  *
7  * LICENCE: 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 published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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 <http://www.gnu.org/licenses/>.
19  *
20  * @category  Settings
21  * @package   StatusNet
22  * @author    Stephen Paul Weber <singpolyma@singpolyma.net>
23  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
24  */
25
26 if (!defined('GNUSOCIAL')) { exit(1); }
27
28 /**
29  * Settings for Linkback
30  *
31  * Lets users opt out of sending linkbacks
32  *
33  * @category Settings
34  * @author   Stephen Paul Weber <singpolyma@singpolyma.net>
35  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
36  */
37 class LinkbacksettingsAction extends SettingsAction
38 {
39     /**
40      * Title of the page
41      *
42      * @return string Page title
43      */
44     function title()
45     {
46         // TRANS: Title of Linkback settings page for a user.
47         return _m('TITLE','Linkback settings');
48     }
49
50     /**
51      * Instructions for use
52      *
53      * @return string Instructions for use
54      */
55     function getInstructions()
56     {
57         // TRANS: Form instructions for Linkback settings.
58         return _m('Linkbacks inform post authors when you link to them. ' .
59                  'You can disable this feature here.');
60     }
61
62     function showContent()
63     {
64         $this->elementStart('form', array('method' => 'post',
65                                           'class' => 'form_settings',
66                                           'action' =>
67                                           common_local_url('linkbacksettings')));
68         $this->hidden('token', common_session_token());
69
70         $this->elementStart('fieldset');
71         $this->element('legend', null, _m('LEGEND','Preferences'));
72         $this->checkbox('disable_linkbacks', "Opt out of sending linkbacks for URLs you post", $this->scoped->getPref("linkbackplugin", "disable_linkbacks"));
73         // TRANS: Button text to save OpenID prefs
74         $this->submit('settings_linkback_prefs_save', _m('BUTTON','Save'), 'submit', 'save_prefs');
75         $this->elementEnd('fieldset');
76
77         $this->elementEnd('form');
78     }
79
80     /**
81      * Handle a POST request
82      *
83      * @return void
84      */
85     protected function doPost()
86     {
87         $x = $this->scoped->setPref("linkbackplugin", "disable_linkbacks", $this->boolean('disable_linkbacks'));
88
89         return _m('Linkback preferences saved.');
90     }
91 }