pluginenableform.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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('STATUSNET') || die();
  17. require_once INSTALLDIR . '/lib/util/form.php';
  18. /**
  19. * Form for enabling a plugin
  20. *
  21. * @category Form
  22. * @package StatusNet
  23. * @author Brion Vibber <brion@status.net>
  24. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  25. * @link http://status.net/
  26. *
  27. * @see PluginDisableForm
  28. */
  29. class PluginEnableForm extends Form
  30. {
  31. public $widgetOpts;
  32. public $scoped;
  33. /**
  34. * Plugin to enable/disable
  35. */
  36. public $plugin = null;
  37. /**
  38. * Constructor
  39. *
  40. * @param HTMLOutputter $out output channel
  41. * @param string $plugin plugin to enable/disable
  42. */
  43. public function __construct($out = null, $plugin = null)
  44. {
  45. parent::__construct($out);
  46. $this->plugin = $plugin;
  47. }
  48. /**
  49. * ID of the form
  50. *
  51. * @return string ID of the form
  52. */
  53. public function id()
  54. {
  55. return 'plugin-enable-' . $this->plugin;
  56. }
  57. /**
  58. * class of the form
  59. *
  60. * @return string of the form class
  61. */
  62. public function formClass()
  63. {
  64. return 'form_plugin_enable';
  65. }
  66. /**
  67. * Action of the form
  68. *
  69. * @return string URL of the action
  70. */
  71. public function action()
  72. {
  73. return common_local_url(
  74. 'pluginenable',
  75. ['plugin' => $this->plugin]
  76. );
  77. }
  78. /**
  79. * Action elements
  80. *
  81. * @return void
  82. * @throws Exception
  83. */
  84. public function formActions()
  85. {
  86. // TRANS: Plugin admin panel controls
  87. $this->out->submit('submit', _m('plugin', 'Enable'));
  88. }
  89. }