start.php 880 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Elgg Messages Extended
  4. */
  5. elgg_register_event_handler('init', 'system', 'messages_extended_init');
  6. /**
  7. * Messages Extended init
  8. *
  9. * @return void
  10. */
  11. function messages_extended_init() {
  12. elgg_extend_view('css/elgg', 'messages_extended/css');
  13. elgg_register_plugin_hook_handler('output:before', 'layout', 'messages_extended_view');
  14. }
  15. function messages_extended_view($hook, $type, $return, $params) {
  16. global $CONFIG;
  17. $context = elgg_get_context();
  18. if ($context != 'messages') {
  19. return $return;
  20. }
  21. $message = get_entity(get_input('guid'));
  22. if (!$message || !elgg_instanceof($message, "object", "messages")) {
  23. return $return;
  24. }
  25. if (isset($CONFIG->messages_extended_once)) {
  26. return $return;
  27. }
  28. $return['content'] .= elgg_view('messages_extended/history', [
  29. 'message' => $message
  30. ]);
  31. $CONFIG->messages_extended_once = true;
  32. return $return;
  33. }