pluginsadminpanel.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /**
  3. * StatusNet, the distributed open-source microblogging tool
  4. *
  5. * Plugins administration panel
  6. *
  7. * PHP version 5
  8. *
  9. * LICENCE: This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. * @category Settings
  23. * @package StatusNet
  24. * @author Brion Vibber <brion@status.net>
  25. * @copyright 2010 StatusNet, Inc.
  26. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  27. * @link http://status.net/
  28. */
  29. if (!defined('STATUSNET')) {
  30. exit(1);
  31. }
  32. /**
  33. * Plugins settings
  34. *
  35. * @category Admin
  36. * @package StatusNet
  37. * @author Brion Vibber <brion@status.net>
  38. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  39. * @link http://status.net/
  40. */
  41. class PluginsadminpanelAction extends AdminPanelAction
  42. {
  43. /**
  44. * Returns the page title
  45. *
  46. * @return string page title
  47. */
  48. function title()
  49. {
  50. // TRANS: Tab and title for plugins admin panel.
  51. return _m('TITLE','Plugins');
  52. }
  53. /**
  54. * Instructions for using this form.
  55. *
  56. * @return string instructions
  57. */
  58. function getInstructions()
  59. {
  60. // TRANS: Instructions at top of plugin admin page.
  61. return _('Additional plugins can be enabled and configured manually. ' .
  62. 'See the <a href="http://status.net/wiki/Plugins">online plugin ' .
  63. 'documentation</a> for more details.');
  64. }
  65. /**
  66. * Show the plugins admin panel form
  67. *
  68. * @return void
  69. */
  70. function showForm()
  71. {
  72. $this->elementStart('fieldset', array('id' => 'settings_plugins_default'));
  73. // TRANS: Admin form section header
  74. $this->element('legend', null, _('Default plugins'), 'default');
  75. $this->showDefaultPlugins();
  76. $this->elementEnd('fieldset');
  77. }
  78. /**
  79. * Until we have a general plugin metadata infrastructure, for now
  80. * we'll just list up the ones we know from the global default
  81. * plugins list.
  82. */
  83. protected function showDefaultPlugins()
  84. {
  85. $plugins = array_keys(common_config('plugins', 'default'));
  86. natsort($plugins);
  87. if ($plugins) {
  88. $list = new PluginList($plugins, $this);
  89. $list->show();
  90. } else {
  91. $this->element('p', null,
  92. // TRANS: Text displayed on plugin admin page when no plugin are enabled.
  93. _('All default plugins have been disabled from the ' .
  94. 'site\'s configuration file.'));
  95. }
  96. }
  97. }