ConversationTreePlugin.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. /**
  17. * The ConversationTree plugin displays conversation replies in a hierarchical
  18. * manner like StatusNet pre-v1.0 used to.
  19. *
  20. * @category UI
  21. * @package ConversationTreePlugin
  22. * @author Mikael Nordfeldth <mmn@hethane.se>
  23. * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
  24. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  25. */
  26. defined('GNUSOCIAL') || die();
  27. class ConversationTreePlugin extends Plugin
  28. {
  29. const PLUGIN_VERSION = '2.0.0';
  30. public function onStartShowConversation(Action $action, Conversation $conv, Profile $scoped = null): bool
  31. {
  32. $nl = new ConversationTree($conv->getNotices($action->getScoped()), $action);
  33. $nl->show();
  34. return false;
  35. }
  36. public function onPluginVersion(array &$versions): bool
  37. {
  38. $versions[] = [
  39. 'name' => 'ConversationTree',
  40. 'version' => self::PLUGIN_VERSION,
  41. 'author' => 'Evan Prodromou, Mikael Nordfeldth',
  42. 'homepage' => 'http://gnu.io/',
  43. 'rawdescription' =>
  44. // TRANS: Module description.
  45. _m('Enables conversation tree view.')
  46. ];
  47. return true;
  48. }
  49. }