html.php 813 B

1234567891011121314151617181920212223242526272829303132
  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. public static function renderStat(string $name, string $stat): void {
  20. ?>
  21. <div class="card card-body mb-3">
  22. <?=htmlspecialchars($name)?>
  23. <div class="stat">
  24. <?=htmlspecialchars($stat)?>
  25. </div>
  26. </div>
  27. <?php
  28. }
  29. }