searchunsub.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. // This file is part of GNU social - https://www.gnu.org/software/social
  3. //
  4. // GNU social is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Affero General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // GNU social is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Affero General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Affero General Public License
  15. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  16. defined('GNUSOCIAL') || die();
  17. /**
  18. * Form for subscribing to a user
  19. *
  20. * @category Plugin
  21. * @package SearchSubPlugin
  22. * @author Brion Vibber <brion@status.net>
  23. * @author Evan Prodromou <evan@status.net>
  24. * @author Sarven Capadisli <csarven@status.net>
  25. * @copyright 2011-2019 Free Software Foundation, Inc http://www.fsf.org
  26. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  27. *
  28. * @see UnsubscribeForm
  29. */
  30. class SearchUnsubForm extends SearchSubForm
  31. {
  32. /**
  33. * ID of the form
  34. *
  35. * @return int ID of the form
  36. */
  37. public function id()
  38. {
  39. return 'search-unsubscribe-' . $this->search;
  40. }
  41. /**
  42. * class of the form
  43. *
  44. * @return string of the form class
  45. */
  46. public function formClass()
  47. {
  48. // class to match existing styles...
  49. return 'form_user_unsubscribe ajax';
  50. }
  51. /**
  52. * Action of the form
  53. *
  54. * @return string URL of the action
  55. */
  56. public function action()
  57. {
  58. return common_local_url('searchunsub', array('search' => $this->search));
  59. }
  60. /**
  61. * Legend of the Form
  62. *
  63. * @return void
  64. * @throws Exception
  65. */
  66. public function formLegend()
  67. {
  68. // TRANS: Form legend.
  69. $this->out->element('legend', null, _m('Unsubscribe from this search'));
  70. }
  71. /**
  72. * Action elements
  73. *
  74. * @return void
  75. * @throws Exception
  76. */
  77. public function formActions()
  78. {
  79. $this->out->submit(
  80. 'submit',
  81. // TRANS: Button text for unsubscribing from a text search.
  82. _m('BUTTON', 'Unsubscribe'),
  83. 'submit',
  84. null,
  85. // TRANS: Button title for unsubscribing from a text search.
  86. _m('Unsubscribe from this search.')
  87. );
  88. }
  89. }