Guest User

Untitled

a guest
May 27th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. <?php defined('SYSPATH') or die('No direct script access.');
  2. /**
  3. * Html head helper methods
  4. *
  5. * @package Layout Module
  6. * @author John Himmelman (john2496@gmail.com)
  7. */
  8. class Head
  9. {
  10. protected static $stylesheets = array();
  11. protected static $scripts = array();
  12.  
  13. public static function get_scripts()
  14. {
  15. $ret = '';
  16.  
  17. foreach (self::$scripts as $file)
  18. {
  19. $ret .= html::script($file) . "\n";
  20. }
  21.  
  22. return $ret;
  23. }
  24.  
  25. public static function get_stylesheets()
  26. {
  27. $ret = '';
  28.  
  29. foreach (self::$stylesheets as $file)
  30. {
  31. $ret .= html::style($file) . "\n";
  32. }
  33.  
  34. return $ret;
  35. }
  36.  
  37. public static function include_scripts()
  38. {
  39. echo self::get_scripts();
  40. }
  41.  
  42. public static function include_stylesheets()
  43. {
  44. echo self::get_stylesheets();
  45. }
  46.  
  47. public static function add_javascript($file)
  48. {
  49. self::$scripts[] = $file;
  50. }
  51.  
  52. public static function add_stylesheet($file)
  53. {
  54. self::$stylesheets[] = $file;
  55. }
  56.  
  57. public static function javascript($file)
  58. {
  59. return self::add_javascript($file);
  60. }
  61.  
  62. public static function stylesheet($file)
  63. {
  64. return self::add_stylesheet($file);
  65. }
  66.  
  67. }
Add Comment
Please, Sign In to add comment