start.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * The main file for this plugin
  4. */
  5. require_once(dirname(__FILE__) . "/lib/functions.php");
  6. // register default elgg events
  7. elgg_register_event_handler("init", "system", "blog_tools_init");
  8. /**
  9. * This function gets called during the system initialization
  10. *
  11. * @return void
  12. */
  13. function blog_tools_init() {
  14. // extend css
  15. elgg_extend_view("css/elgg", "css/blog_tools/site");
  16. elgg_extend_view("js/elgg", "js/blog_tools/site");
  17. // extra blog views
  18. elgg_extend_view("object/blog", "blog_tools/full/navigation");
  19. elgg_extend_view("object/blog", "blog_tools/full/owner");
  20. elgg_extend_view("object/blog", "blog_tools/full/related");
  21. elgg_extend_view("blog/sidebar", "blog_tools/full/related");
  22. // register event handlers
  23. elgg_register_event_handler("delete", "object", array("\ColdTrick\BlogTools\DeleteHandler", "cleanupBlogIcon"));
  24. // register plugin hook handlers
  25. elgg_register_plugin_hook_handler("entity:url", "object", array("\ColdTrick\BlogTools\Widgets", "widgetUrl"));
  26. elgg_register_plugin_hook_handler("cron", "daily", array("\ColdTrick\BlogTools\Cron", "daily"));
  27. elgg_register_plugin_hook_handler("entity:icon:url", "object", array("\ColdTrick\BlogTools\EntityIcon", "blogIcon"));
  28. elgg_register_plugin_hook_handler("route", "blog", array("\ColdTrick\BlogTools\Router", "blog"));
  29. elgg_register_plugin_hook_handler("register", "menu:entity", array("\ColdTrick\BlogTools\EntityMenu", "register"));
  30. elgg_register_plugin_hook_handler("group_tool_widgets", "widget_manager", array("\ColdTrick\BlogTools\Widgets", "groupTools"));
  31. elgg_register_plugin_hook_handler("permissions_check:comment", "object", array("\ColdTrick\BlogTools\Access", "blogCanComment"));
  32. // extend editmenu
  33. elgg_extend_view("editmenu", "blog_tools/editmenu");
  34. // add featured filter menu item
  35. elgg_register_menu_item("filter", ElggMenuItem::factory(array(
  36. "name" => "featured",
  37. "text" => elgg_echo("blog_tools:menu:filter:featured"),
  38. "context" => "blog",
  39. "href" => "blog/featured",
  40. "priority" => 600
  41. )));
  42. // register index widget
  43. elgg_register_widget_type("index_blog", elgg_echo("blog"), elgg_echo("blog_tools:widgets:index_blog:description"), array("index"), true);
  44. elgg_register_widget_type("blog", elgg_echo("blog"), elgg_echo("blog:widget:description"), array("profile", "dashboard", "groups"));
  45. // overrule blog actions
  46. elgg_register_action("blog/save", dirname(__FILE__) . "/actions/blog/save.php");
  47. elgg_register_action("blog/auto_save_revision", dirname(__FILE__) . "/actions/blog/auto_save_revision.php");
  48. // register actions
  49. elgg_register_action("blog_tools/toggle_metadata", dirname(__FILE__) . "/actions/toggle_metadata.php", "admin");
  50. }