start.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. /**
  3. * Aalborg theme plugin
  4. *
  5. * @package AalborgTheme
  6. */
  7. elgg_register_event_handler('init','system','aalborg_theme_init');
  8. function aalborg_theme_init() {
  9. elgg_register_event_handler('pagesetup', 'system', 'aalborg_theme_pagesetup', 1000);
  10. // theme specific CSS
  11. elgg_extend_view('css/elgg', 'aalborg_theme/css');
  12. elgg_unextend_view('page/elements/header', 'search/header');
  13. elgg_extend_view('page/elements/sidebar', 'search/header', 0);
  14. elgg_register_plugin_hook_handler('head', 'page', 'aalborg_theme_setup_head');
  15. // non-members do not get visible links to RSS feeds
  16. if (!elgg_is_logged_in()) {
  17. elgg_unregister_plugin_hook_handler('output:before', 'layout', 'elgg_views_add_rss_link');
  18. }
  19. }
  20. /**
  21. * Rearrange menu items
  22. */
  23. function aalborg_theme_pagesetup() {
  24. if (elgg_is_logged_in()) {
  25. elgg_register_menu_item('topbar', array(
  26. 'name' => 'account',
  27. 'text' => elgg_echo('account'),
  28. 'href' => "#",
  29. 'priority' => 100,
  30. 'section' => 'alt',
  31. 'link_class' => 'elgg-topbar-dropdown',
  32. ));
  33. if (elgg_is_active_plugin('dashboard')) {
  34. $item = elgg_unregister_menu_item('topbar', 'dashboard');
  35. if ($item) {
  36. $item->setText(elgg_echo('dashboard'));
  37. $item->setSection('default');
  38. elgg_register_menu_item('site', $item);
  39. }
  40. }
  41. $item = elgg_get_menu_item('topbar', 'usersettings');
  42. if ($item) {
  43. $item->setParentName('account');
  44. $item->setText(elgg_echo('settings'));
  45. $item->setPriority(103);
  46. }
  47. $item = elgg_get_menu_item('topbar', 'logout');
  48. if ($item) {
  49. $item->setParentName('account');
  50. $item->setText(elgg_echo('logout'));
  51. $item->setPriority(104);
  52. }
  53. $item = elgg_get_menu_item('topbar', 'administration');
  54. if ($item) {
  55. $item->setParentName('account');
  56. $item->setText(elgg_echo('admin'));
  57. $item->setPriority(101);
  58. }
  59. if (elgg_is_active_plugin('site_notifications')) {
  60. $item = elgg_get_menu_item('topbar', 'site_notifications');
  61. if ($item) {
  62. $item->setParentName('account');
  63. $item->setText(elgg_echo('site_notifications:topbar'));
  64. $item->setPriority(102);
  65. }
  66. }
  67. if (elgg_is_active_plugin('reportedcontent')) {
  68. $item = elgg_unregister_menu_item('footer', 'report_this');
  69. if ($item) {
  70. $item->setText(elgg_view_icon('report-this'));
  71. $item->setPriority(500);
  72. $item->setSection('default');
  73. elgg_register_menu_item('extras', $item);
  74. }
  75. }
  76. }
  77. }
  78. /**
  79. * Register items for the html head
  80. *
  81. * @param string $hook Hook name ('head')
  82. * @param string $type Hook type ('page')
  83. * @param array $data Array of items for head
  84. * @return array
  85. */
  86. function aalborg_theme_setup_head($hook, $type, $data) {
  87. $data['metas']['viewport'] = array(
  88. 'name' => 'viewport',
  89. 'content' => 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0',
  90. );
  91. $data['links']['apple-touch-icon'] = array(
  92. 'rel' => 'apple-touch-icon',
  93. 'href' => elgg_normalize_url('mod/aalborg_theme/graphics/homescreen.png'),
  94. );
  95. return $data;
  96. }