start.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * main file for this plugin
  4. */
  5. define('SITE_ANNOUNCEMENT_SUBTYPE', 'site_announcement');
  6. define('SITE_ANNOUNCEMENT_RELATIONSHIP', 'site_announcement_read');
  7. require_once(dirname(__FILE__) . '/lib/functions.php');
  8. // register default Elgg events
  9. elgg_register_event_handler('init', 'system', 'site_announcements_init');
  10. /**
  11. * Gets called when the system initializes
  12. *
  13. * @return void
  14. */
  15. function site_announcements_init() {
  16. // extend css / js
  17. elgg_extend_view('css/elgg', 'css/site_announcements/site');
  18. elgg_extend_view('js/elgg', 'js/site_announcements/site');
  19. // pagehandler
  20. elgg_register_page_handler('announcements', array('\ColdTrick\SiteAnnouncements\PageHandler', 'announcements'));
  21. // extends views
  22. elgg_extend_view('page/elements/body', 'site_announcements/site', 400);
  23. // register plugin hooks
  24. elgg_register_plugin_hook_handler('register', 'menu:entity', array('\ColdTrick\SiteAnnouncements\EntityMenu', 'register'));
  25. elgg_register_plugin_hook_handler('register', 'menu:filter', array('\ColdTrick\SiteAnnouncements\FilterMenu', 'register'));
  26. elgg_register_plugin_hook_handler('register', 'menu:footer', array('\ColdTrick\SiteAnnouncements\FooterMenu', 'register'));
  27. elgg_register_plugin_hook_handler('register', 'menu:user_hover', array('\ColdTrick\SiteAnnouncements\UserHoverMenu', 'register'));
  28. elgg_register_plugin_hook_handler('register', 'menu:page', array('\ColdTrick\SiteAnnouncements\PageMenu', 'register'));
  29. elgg_register_plugin_hook_handler('access:collections:write', 'user', array('\ColdTrick\SiteAnnouncements\Access', 'userWriteCollections'));
  30. elgg_register_plugin_hook_handler('container_permissions_check', 'object', array('\ColdTrick\SiteAnnouncements\Access', 'containerPermissionsCheck'));
  31. elgg_register_plugin_hook_handler('permissions_check', 'object', array('\ColdTrick\SiteAnnouncements\Access', 'permissionsCheck'));
  32. elgg_register_plugin_hook_handler('permissions_check:comment', 'object', array('\ColdTrick\SiteAnnouncements\Access', 'commentPermissionsCheck'));
  33. // register actions
  34. elgg_register_action('site_announcements/edit', dirname(__FILE__) . '/actions/edit.php');
  35. elgg_register_action('announcements/delete', dirname(__FILE__) . '/actions/delete.php');
  36. elgg_register_action('site_announcements/mark', dirname(__FILE__) . '/actions/mark.php', 'public');
  37. elgg_register_action('site_announcements/toggle_editor', dirname(__FILE__) . '/actions/toggle_editor.php', 'admin');
  38. }