plugindisable.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * StatusNet - the distributed open-source microblogging tool
  4. * Copyright (C) 2010, StatusNet, Inc.
  5. *
  6. * Plugin enable action.
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. * PHP version 5
  22. *
  23. * @category Action
  24. * @package StatusNet
  25. * @author Brion Vibber <brion@status.net>
  26. * @copyright 2010 StatusNet, Inc.
  27. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
  28. * @link http://status.net/
  29. */
  30. if (!defined('STATUSNET')) {
  31. exit(1);
  32. }
  33. /**
  34. * Plugin enable action.
  35. *
  36. * (Re)-enables a plugin from the default plugins list.
  37. *
  38. * Takes parameters:
  39. *
  40. * - plugin: plugin name
  41. * - token: session token to prevent CSRF attacks
  42. * - ajax: boolean; whether to return Ajax or full-browser results
  43. *
  44. * Only works if the current user is logged in.
  45. *
  46. * @category Action
  47. * @package StatusNet
  48. * @author Brion Vibber <brion@status.net>
  49. * @copyright 2010 StatusNet, Inc.
  50. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
  51. * @link http://status.net/
  52. */
  53. class PluginDisableAction extends PluginEnableAction
  54. {
  55. /**
  56. * Value to save into $config['plugins']['disable-<name>']
  57. */
  58. protected function overrideValue()
  59. {
  60. return 1;
  61. }
  62. protected function successShortTitle()
  63. {
  64. // TRANS: Page title for AJAX form return when a disabling a plugin.
  65. return _m('plugin', 'Disabled');
  66. }
  67. protected function successNextForm()
  68. {
  69. return new EnablePluginForm($this, $this->plugin);
  70. }
  71. }