main.html.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <?php if (!defined('HTMLY')) die('HTMLy'); ?>
  2. <?php if (isset($is_category)):?>
  3. <div class="row justify-content-center" style="padding-top: 4rem;">
  4. <div class="col-md-12 text-center">
  5. <h1 class="mt-0"><?php echo $category->title;?></h1>
  6. </div>
  7. <div class="col-md-12 text-center">
  8. <div class="lead"><?php echo $category->body;?></div>
  9. </div>
  10. </div>
  11. <?php endif;?>
  12. <?php if (isset($is_tag)):?>
  13. <div class="row justify-content-center" style="padding-top: 4rem;">
  14. <div class="col-md-12 text-center">
  15. <h1 class="mt-0"><?php echo $tag->title;?></h1>
  16. </div>
  17. </div>
  18. <?php endif;?>
  19. <?php if (isset($is_archive)):?>
  20. <div class="row justify-content-center" style="padding-top: 4rem;">
  21. <div class="col-md-12 text-center">
  22. <h1 class="mt-0"><?php echo $archive->title;?></h1>
  23. </div>
  24. </div>
  25. <?php endif;?>
  26. <?php if (isset($is_search)):?>
  27. <!-- main.html.php -->
  28. <div class="row justify-content-center" style="padding-top: 3rem;">
  29. <div class="col-md-12 text-center">
  30. <h1 class="mt-0">Search: <?php echo $search->title;?> (<?php echo $search->count;?>)</h1>
  31. <form><input type="search" name="search" class="form-control is-search" placeholder="<?php echo i18n('Type_to_search');?>"></form>
  32. </div>
  33. </div>
  34. <?php endif;?>
  35. <?php if (isset($is_type)):?>
  36. <div class="row justify-content-center" style="padding-top: 4rem;">
  37. <div class="col-md-12 text-center">
  38. <h1 class="mt-0"><?php echo $type->title;?></h1>
  39. </div>
  40. </div>
  41. <?php endif;?>
  42. <?php if (isset($is_blog)):?>
  43. <div class="row justify-content-center" style="padding-top: 4rem;">
  44. <div class="col-md-12 text-center">
  45. <h1 class="mt-0">Blog</h1>
  46. </div>
  47. </div>
  48. <?php endif;?>
  49. <?php if (isset($is_front)):?>
  50. <div class="row justify-content-center" style="padding-top: 4rem;">
  51. <div class="col-md-12 text-center">
  52. <h1 class="mt-0"><?php echo blog_title();?></h1>
  53. </div>
  54. <div class="col-md-12 text-center">
  55. <div class="lead"><?php echo blog_description();?></div>
  56. </div>
  57. </div>
  58. <?php endif;?>
  59. <?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
  60. <?php foreach ($posts as $post):?>
  61. <?php $img = get_image($post->body);?>
  62. <article>
  63. <div class="card-list">
  64. <div class="card">
  65. <?php if (!empty($post->image)) {?>
  66. <a href="<?php echo $post->url;?>"><img alt="<?php echo $post->title;?>" src="<?php echo $post->image;?>" width="100%"></a>
  67. <?php } elseif (!empty($img) && config('teaser.type') === 'trimmed' && empty($post->quote) && empty($post->video) && empty($post->audio)) {?>
  68. <a href="<?php echo $post->url;?>"><img alt="<?php echo $post->title;?>" src="<?php echo $img;?>" width="100%"></a>
  69. <?php } ?>
  70. <?php if(!empty($post->video)):?>
  71. <iframe width="100%" height="315px" class="embed-responsive-item media-wrapper" src="https://www.youtube.com/embed/<?php echo get_video_id($post->video); ?>" frameborder="0" allowfullscreen></iframe>
  72. <?php endif;?>
  73. <?php if(!empty($post->audio)):?>
  74. <iframe width="100%" height="200px" class="embed-responsive-item media-wrapper" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=<?php echo $post->audio;?>&amp;auto_play=false&amp;visual=true"></iframe>
  75. <?php endif;?>
  76. <?php if(!empty($post->quote)):?>
  77. <div class="quote">
  78. <blockquote class="quote"><?php echo $post->quote ?></blockquote>
  79. </div>
  80. <?php endif;?>
  81. <div class="card-body">
  82. <?php if(!empty($post->link)) { ?>
  83. <h2>
  84. <a class="text-body" href="<?php echo $post->link;?>" target="_blank"><?php echo $post->title;?>
  85. <svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" fill="currentColor" class="bi bi-link-45deg" viewBox="0 0 16 16"><path d="M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1 1 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4 4 0 0 1-.128-1.287z"/><path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243z"/></svg>
  86. </a>
  87. </h2>
  88. <?php } else {?>
  89. <h2><a class="text-body" href="<?php echo $post->url;?>"><?php echo $post->title;?></a></h2>
  90. <?php } ?>
  91. <div class="content-body">
  92. <?php echo get_teaser($post->body, $post->url); ?>
  93. <?php if ($teaserType === 'trimmed'):?>[...] <a class="more-link" href="<?php echo $post->url; ?>"><?php echo $readMore; ?></a><?php endif;?>
  94. </div>
  95. <p>
  96. <small>
  97. <?php echo i18n('posted_on');?> <?php echo format_date($post->date);?>
  98. <?php echo i18n('by');?>
  99. <a class="position-relative" href="<?php echo $post->authorUrl;?>">
  100. <?php echo $post->authorName;?>
  101. </a>
  102. <span class="mx-2">—</span>
  103. <strong>
  104. <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentcolor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 12a9 9 0 1018 0A9 9 0 003 12"></path><path d="M12 7v5l3 3"></path></svg>
  105. <?php echo $post->readTime;?> min
  106. </strong>
  107. <?php if (authorized($post)) { echo ' <span class="mx-2">—</span> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-2"><path d="M17 3a2.828 2.828.0 114 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path></svg> <span class="edit-post"><a href="'. $post->url .'/edit?destination=post">' . i18n('Edit') . '</a></span>'; } ?>
  108. </small>
  109. </p>
  110. </div>
  111. </div>
  112. </div>
  113. </article>
  114. <?php endforeach;?>
  115. <?php if (!empty($pagination['next']) || !empty($pagination['prev'])): ?>
  116. <div class="docs-navigation d-flex justify-content-between">
  117. <?php if (!empty($pagination['prev'])): ?>
  118. <a href="?page=<?php echo $page - 1 ?>">
  119. <div class="card my-1">
  120. <div class="card-body py-2">
  121. ← <?php echo i18n('Newer');?>
  122. </div>
  123. </div>
  124. </a>
  125. <?php endif;?>
  126. <?php if (!empty($pagination['next'])): ?>
  127. <a class="ms-auto" href="?page=<?php echo $page + 1 ?>">
  128. <div class="card my-1">
  129. <div class="card-body py-2">
  130. <?php echo i18n('Older');?> →
  131. </div>
  132. </div>
  133. </a>
  134. <?php endif;?>
  135. </div>
  136. <?php endif;?>