head.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * The HTML head
  4. *
  5. * JavaScript load sequence (set in views library and this view)
  6. * ------------------------
  7. * 1. Elgg's initialization which is inline because it can change on every page load.
  8. * 2. RequireJS config. Must be loaded before RequireJS is loaded.
  9. * 3. RequireJS
  10. * 4. jQuery
  11. * 5. jQuery migrate
  12. * 6. jQueryUI
  13. * 7. elgg.js
  14. *
  15. * @uses $vars['title'] The page title
  16. * @uses $vars['metas'] Array of meta elements
  17. * @uses $vars['links'] Array of links
  18. */
  19. $metas = elgg_extract('metas', $vars, array());
  20. $links = elgg_extract('links', $vars, array());
  21. echo elgg_format_element('title', array(), $vars['title'], array('encode_text' => true));
  22. foreach ($metas as $attributes) {
  23. echo elgg_format_element('meta', $attributes);
  24. }
  25. foreach ($links as $attributes) {
  26. echo elgg_format_element('link', $attributes);
  27. }
  28. $js = elgg_get_loaded_js('head');
  29. $css = elgg_get_loaded_css();
  30. $elgg_init = elgg_view('js/initialize_elgg');
  31. $html5shiv_url = elgg_normalize_url('vendors/html5shiv.js');
  32. $ie_url = elgg_get_simplecache_url('css', 'ie');
  33. ?>
  34. <!--[if lt IE 9]>
  35. <script src="<?php echo $html5shiv_url; ?>"></script>
  36. <![endif]-->
  37. <?php
  38. foreach ($css as $url) {
  39. echo elgg_format_element('link', array('rel' => 'stylesheet', 'href' => $url));
  40. }
  41. ?>
  42. <!--[if gt IE 8]>
  43. <link rel="stylesheet" href="<?php echo $ie_url; ?>" />
  44. <![endif]-->
  45. <script><?php echo $elgg_init; ?></script>
  46. <?php
  47. foreach ($js as $url) {
  48. echo elgg_format_element('script', array('src' => $url));
  49. }
  50. echo elgg_view_deprecated('page/elements/shortcut_icon', array(), "Use the 'head', 'page' plugin hook.", 1.9);
  51. echo elgg_view_deprecated('metatags', array(), "Use the 'head', 'page' plugin hook.", 1.8);