html.php 583 B

123456789101112131415161718192021
  1. <?php
  2. class HTML {
  3. public static function script($path) {
  4. if(!file_exists($path)) return;
  5. $modified_time = filemtime($path);
  6. $src = preg_replace("/^public\//", "/", $path);
  7. ?>
  8. <script type="text/javascript" src="<?=htmlspecialchars($src)?>?<?=$modified_time?>"></script>
  9. <?php
  10. }
  11. public static function stylesheet($path) {
  12. if(!file_exists($path)) return;
  13. $modified_time = filemtime($path);
  14. $src = preg_replace("/^public\//", "/", $path);
  15. ?>
  16. <link rel="stylesheet" type="text/css" href="<?=htmlspecialchars($src)?>?<?=$modified_time?>" />
  17. <?php
  18. }
  19. }