linkbacksettings.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. if (!defined('GNUSOCIAL')) { exit(1); }
  26. /**
  27. * Settings for Linkback
  28. *
  29. * Lets users opt out of sending linkbacks
  30. *
  31. * @category Settings
  32. * @author Stephen Paul Weber <singpolyma@singpolyma.net>
  33. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  34. */
  35. class LinkbacksettingsAction extends SettingsAction
  36. {
  37. /**
  38. * Title of the page
  39. *
  40. * @return string Page title
  41. */
  42. function title()
  43. {
  44. // TRANS: Title of Linkback settings page for a user.
  45. return _m('TITLE','Linkback settings');
  46. }
  47. /**
  48. * Instructions for use
  49. *
  50. * @return string Instructions for use
  51. */
  52. function getInstructions()
  53. {
  54. // TRANS: Form instructions for Linkback settings.
  55. return _m('Linkbacks inform post authors when you link to them. ' .
  56. 'You can disable this feature here.');
  57. }
  58. function showContent()
  59. {
  60. $this->elementStart('form', array('method' => 'post',
  61. 'class' => 'form_settings',
  62. 'action' =>
  63. common_local_url('linkbacksettings')));
  64. $this->hidden('token', common_session_token());
  65. $this->elementStart('fieldset');
  66. $this->element('legend', null, _m('LEGEND','Preferences'));
  67. $this->checkbox('disable_linkbacks', "Opt out of sending linkbacks for URLs you post", $this->scoped->getPref("linkbackplugin", "disable_linkbacks"));
  68. // TRANS: Button text to save OpenID prefs
  69. $this->submit('settings_linkback_prefs_save', _m('BUTTON','Save'), 'submit', 'save_prefs');
  70. $this->elementEnd('fieldset');
  71. $this->elementEnd('form');
  72. }
  73. /**
  74. * Handle a POST request
  75. *
  76. * @return void
  77. */
  78. protected function doPost()
  79. {
  80. $x = $this->scoped->setPref("linkbackplugin", "disable_linkbacks", $this->boolean('disable_linkbacks'));
  81. return _m('Linkback preferences saved.');
  82. }
  83. }