pluginenableform.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. /**
  32. * Plugin to enable/disable
  33. */
  34. public $plugin = null;
  35. /**
  36. * Constructor
  37. *
  38. * @param HTMLOutputter $out output channel
  39. * @param string $plugin plugin to enable/disable
  40. */
  41. public function __construct($out = null, $plugin = null)
  42. {
  43. parent::__construct($out);
  44. $this->plugin = $plugin;
  45. }
  46. /**
  47. * ID of the form
  48. *
  49. * @return string ID of the form
  50. */
  51. public function id()
  52. {
  53. return 'plugin-enable-' . $this->plugin;
  54. }
  55. /**
  56. * class of the form
  57. *
  58. * @return string of the form class
  59. */
  60. public function formClass()
  61. {
  62. return 'form_plugin_enable';
  63. }
  64. /**
  65. * Action of the form
  66. *
  67. * @return string URL of the action
  68. */
  69. public function action()
  70. {
  71. return common_local_url(
  72. 'pluginenable',
  73. ['plugin' => $this->plugin]
  74. );
  75. }
  76. /**
  77. * Action elements
  78. *
  79. * @return void
  80. * @throws Exception
  81. */
  82. public function formActions()
  83. {
  84. // TRANS: Plugin admin panel controls
  85. $this->out->submit('submit', _m('plugin', 'Enable'));
  86. }
  87. }