start.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * The main file for this plugin
  4. */
  5. define('CONTENT_SUBSCRIPTIONS_SUBSCRIPTION', 'content_subscription');
  6. define('CONTENT_SUBSCRIPTIONS_BLOCK', 'content_block_subscription');
  7. require_once(dirname(__FILE__) . '/lib/functions.php');
  8. // register default Elgg events
  9. elgg_register_event_handler('init', 'system', 'content_subscriptions_init');
  10. /**
  11. * This function is called when the Elgg system gets initialized
  12. *
  13. * @return void
  14. */
  15. function content_subscriptions_init() {
  16. // JS
  17. elgg_extend_view('js/elgg', 'js/content_subscriptions/site.js');
  18. // settings
  19. elgg_extend_view('notifications/subscriptions/personal', 'content_subscriptions/notifications/settings');
  20. // register event handlers
  21. elgg_register_event_handler('create', 'object', '\ColdTrick\ContentSubscriptions\Comments::createObject');
  22. elgg_register_event_handler('create', 'annotation', '\ColdTrick\ContentSubscriptions\Likes::create');
  23. elgg_register_event_handler('upgrade', 'system', '\ColdTrick\ContentSubscriptions\Upgrade::registerScript');
  24. elgg_register_notification_event('object', 'comment');
  25. elgg_register_plugin_hook_handler('prepare', 'notification:create:object:comment', '\ColdTrick\ContentSubscriptions\Comments::prepareNotification');
  26. // register plugin hooks
  27. elgg_register_plugin_hook_handler('register', 'menu:entity', '\ColdTrick\ContentSubscriptions\EntityMenu::register');
  28. elgg_register_plugin_hook_handler('get', 'subscriptions', '\ColdTrick\ContentSubscriptions\Subscriptions::verifySubscribersSettings', 400);
  29. elgg_register_plugin_hook_handler('get', 'subscriptions', '\ColdTrick\ContentSubscriptions\Subscriptions::addDiscussionOwner');
  30. elgg_register_plugin_hook_handler('get', 'subscriptions', '\ColdTrick\ContentSubscriptions\Subscriptions::removeUnsubscribedGroupMembers', 999);
  31. elgg_register_plugin_hook_handler('action', 'notificationsettings/save', '\ColdTrick\ContentSubscriptions\UserSettings::notificationSettingsSaveAction');
  32. // register actions
  33. elgg_register_action('content_subscriptions/subscribe', dirname(__FILE__) . '/actions/subscribe.php');
  34. elgg_register_action('content_subscriptions/upgrade', dirname(__FILE__) . '/actions/upgrade.php', 'admin');
  35. }