start.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. require_once(dirname(__FILE__) . "/lib/functions.php");
  3. /**
  4. * Init function for the language selector
  5. *
  6. * @return void
  7. */
  8. function language_selector_plugins_boot() {
  9. language_selector_set_logged_out_user_language();
  10. elgg_extend_view("css/elgg", "language_selector/css/site");
  11. }
  12. /**
  13. * Extends the header with the language selector
  14. *
  15. * @return void
  16. */
  17. function language_selector_pagesetup() {
  18. if (elgg_get_plugin_setting("show_in_header", "language_selector") == "yes") {
  19. elgg_extend_view("page/elements/header", "language_selector/default");
  20. }
  21. }
  22. // register hooks
  23. elgg_register_plugin_hook_handler("all", "plugin", "language_selector_invalidate_setting");
  24. // register events
  25. elgg_register_event_handler("language:merge", "translation_editor", "language_selector_invalidate_setting");
  26. elgg_register_event_handler("all", "plugin", "language_selector_invalidate_setting");
  27. // Default event handlers for plugin functionality
  28. elgg_register_event_handler('plugins_boot', 'system', 'language_selector_plugins_boot');
  29. elgg_register_event_handler('pagesetup', 'system', 'language_selector_pagesetup');
  30. elgg_register_event_handler('upgrade', 'system', 'language_selector_invalidate_setting');
  31. // actions
  32. elgg_register_action('language_selector/change', dirname(__FILE__) . '/actions/change.php', "logged_in");