content_template.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. function base_content_start($ppub, $path) {
  3. $metadata = $ppub->metadata;
  4. ?>
  5. <!DOCTYPE html>
  6. <html lang="<?php echo($metadata["language"] ?? SITE_LANGUAGE);?>">
  7. <head>
  8. <meta charset="utf-8">
  9. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  10. <title><?php echo(htmlentities($metadata["title"]));?> - <?php echo(SITE_NAME);?></title>
  11. <meta name="description" content="<?php echo(htmlentities($metadata["description"]));?>">
  12. <meta name="author" content="<?php echo(htmlentities($metadata["author"]));?>">
  13. <link rel="stylesheet" href="<?php echo(SITE_URL);?>/vanilla.css">
  14. <link rel="alternate" type="application/x-ppub" title="<?php echo(htmlentities($metadata["title"]));?> (as PPUB)" href="?download=true" />
  15. </head>
  16. <body>
  17. <header>
  18. <h1>
  19. <a style="color: var(--text-color); text-decoration: none; display: inline-block;" href="<?php echo(SITE_URL);?>"><?php echo(SITE_NAME);?></a>
  20. <!-- <small style="font-weight: light; margin: 0px 5px 0px 5px;" aria-label="<?php echo(PUBLICATION_NAME);?> title:">/</small> -->
  21. <!-- <small><a style="color: var(--text-color); text-decoration: none; display: inline-block;" href="<?php echo(SITE_URL);?>/<?php echo($path);?>"><?php echo(htmlentities($metadata["title"]));?></a></small> -->
  22. </h1>
  23. </header>
  24. <?php
  25. }
  26. function base_content_html($content) {
  27. echo $content;
  28. }
  29. function base_content_end($ppub) {
  30. ?>
  31. <footer>
  32. <hr>
  33. <p><strong><?php echo(htmlentities($ppub->metadata["title"]));?></strong>
  34. <?php if($ppub->metadata["author"] != null) {
  35. preg_match("/^([^<]*(?= *<|$))<*([^>]*)>*/", $ppub->metadata["author"], $author);
  36. ?>
  37. <br/><?php echo(PUBLICATION_NAME);?> authored by <?php
  38. if(isset($author[2]) && $author[2] != '') {
  39. echo("<a href=\"mailto:".$author[2]."\">");
  40. echo(htmlentities(trim($author[1])));
  41. echo("</a>");
  42. } else {
  43. echo(htmlentities($ppub->metadata["author"]));
  44. }
  45. ?>.
  46. <?php } if ($ppub->metadata["tags"] != null and USE_PPIX) { ?>
  47. <br/>Tagged with:
  48. <?php
  49. foreach(explode(" ", $ppub->metadata["tags"]) as $tag) {
  50. ?>
  51. <a href="<?php echo(SITE_URL);?>/?tag=<?php echo(urlencode($tag));?>"><?php echo(htmlentities($tag));?></a>
  52. <?php
  53. }
  54. ?>
  55. <?php } if ($ppub->metadata["date"] != null) { ?>
  56. <br/>Last updated on <?php echo(htmlentities((new DateTime($ppub->metadata["date"]))->format(DATE_FORMAT)));?>.
  57. <br/><?php } if ($ppub->metadata["copyright"] != null) { ?>
  58. <?php echo($ppub->metadata["copyright"]);?>
  59. <?php } if ($ppub->metadata["licence"] != null) { ?>
  60. <a href="<?php echo($ppub->metadata["licence"]);?>">See Licence</a>
  61. <?php } ?></p>
  62. <p><a href="<?php echo(SITE_URL);?>/">Return to <?php echo(PUBLICATION_NAME);?> Index</a> | <a href="<?php echo(SITE_URL);?>/feed.rss">Subscribe to <?php echo(SITE_NAME);?> RSS</a> | <a href="?download=true">Download <?php echo(PUBLICATION_NAME);?> PPUB</a>
  63. <br/><small>Powered by <a href="https://github.com/Tilo15/php-ppub">php-ppub</a> and <a href="https://parsedown.org">Parsedown</a>, styled with <a href="https://vanillacss.com/">Vanilla CSS</a>.</small></p>
  64. </footer>
  65. </body>
  66. </html>
  67. <?php
  68. }
  69. ?>