start.php 930 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Tagcloud plugin
  4. */
  5. elgg_register_event_handler('init', 'system', 'tagcloud_init');
  6. function tagcloud_init() {
  7. elgg_extend_view('theme_sandbox/components', 'tagcloud/theme_sandbox/component');
  8. elgg_extend_view('css/elgg', 'css/elgg/tagcloud.css');
  9. elgg_register_page_handler('tags', 'tagcloud_tags_page_handler');
  10. elgg_register_widget_type('tagcloud', elgg_echo('tagcloud:widget:title'), elgg_echo('tagcloud:widget:description'));
  11. }
  12. /**
  13. * Page hander for sitewide tag cloud
  14. *
  15. * @param array $page Page array
  16. *
  17. * @return bool
  18. */
  19. function tagcloud_tags_page_handler($page) {
  20. $title = elgg_echo('tagcloud:site_cloud');
  21. $options = array(
  22. 'threshold' => 0,
  23. 'limit' => 100,
  24. 'tag_name' => 'tags',
  25. );
  26. $content = elgg_view_tagcloud($options);
  27. $body = elgg_view_layout('one_sidebar', array(
  28. 'title' => $title,
  29. 'content' => $content,
  30. ));
  31. echo elgg_view_page($title, $body);
  32. return true;
  33. }