mirror of
https://github.com/jkjoy/Typecho-Theme-Puock.git
synced 2026-06-13 16:14:10 +00:00
074af5187a
Replaced the local ip2region database and related PHP classes with an external API (ip.asbid.cn) for IP region lookup in functions.php. Removed the entire ip2region directory and its dependencies, simplifying maintenance and reducing local storage requirements. Updated caching logic to store API results for one month. Also updated the theme version in index.php to 1.1.
100 lines
3.3 KiB
PHP
100 lines
3.3 KiB
PHP
<?php
|
|
/**
|
|
* Pouck theme for Typecho
|
|
*
|
|
* @package Typecho Pouck Theme
|
|
* @author 老孙博客
|
|
* @version 1.1
|
|
* @link http://www.imsun.org
|
|
*/
|
|
|
|
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
|
$this->need('header.php');
|
|
$this->need('sticky.php');
|
|
?>
|
|
<div class="row row-cols-1">
|
|
<div class="col-lg-8 col-md-12 animated fadeInLeft ">
|
|
<div class="animated fadeInLeft ">
|
|
<div> <!--文章列表-->
|
|
<div id="posts">
|
|
<?php if ($this->options->listmodel): ?>
|
|
<div class=" mr-0 ml-0">
|
|
<?php while ($this->next()): ?>
|
|
<?php
|
|
$coverImage = getPostCover($this->content, $this->cid);
|
|
$colors = ['bg-primary', 'bg-secondary', 'bg-success', 'bg-danger', 'bg-warning', 'bg-info'];
|
|
?>
|
|
<article class="block card-plain post-item p-block post-item-list">
|
|
<div class="thumbnail">
|
|
<a class="t-sm ww" href="<?php $this->permalink() ?>">
|
|
<img title="<?php $this->title() ?>" alt="<?php $this->title() ?>" src='<?php $this->options->themeUrl('assets/img/load.svg'); ?>' class='lazy' data-src='<?php echo $coverImage; ?>' />
|
|
</a>
|
|
</div>
|
|
<div class="post-info">
|
|
<div class="info-top">
|
|
<h2 class="info-title">
|
|
<?php if (isset($this->isSticky) && $this->isSticky): ?><?php echo $this->stickyHtml; ?><?php endif; ?>
|
|
<?php foreach($this->categories as $category): ?>
|
|
<a class="badge d-none d-md-inline-block <?php echo $colors[array_rand($colors)]; ?> ahfff" href="<?php echo $category['permalink']; ?>">
|
|
<i class="fa-regular fa-folder-open"></i> <?php echo $category['name']; ?>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
<a class="a-link" title="<?php $this->title() ?>" href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
|
|
</h2>
|
|
<div class="info-meta c-sub text-2line d-none d-md-block"><?php $this->excerpt(200, '...'); ?></div>
|
|
</div>
|
|
<div class="info-footer w-100">
|
|
<div>
|
|
<span class="t-sm c-sub">
|
|
<span class="mr-2">
|
|
<i class="fa-regular fa-eye mr-1"></i>
|
|
<span class="view">浏览:<?php get_post_view($this) ?></span>
|
|
<span class="t-sm d-none d-sm-inline-block">次阅读</span>
|
|
</span>
|
|
<a class="c-sub-a" href="<?php $this->permalink() ?>#comments">
|
|
<i class="fa-regular fa-comment mr-1"></i><?php $this->commentsNum('0', '1', '%d'); ?>
|
|
<span class="t-sm d-none d-sm-inline-block">个评论</span>
|
|
</a>
|
|
</span>
|
|
</div>
|
|
<div>
|
|
<?php foreach($this->categories as $category): ?>
|
|
<a class="c-sub-a t-sm ml-md-2 line-h-20 d-inline-block d-md-none" href="<?php echo $category['permalink']; ?>">
|
|
<i class="fa-regular fa-folder-open"></i> <?php echo $category['name']; ?>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
<span class="t-sm ml-md-2 c-sub line-h-20 d-none d-md-inline-block">
|
|
<i class="fa-regular fa-clock"></i> <?php $this->date(); ?>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<span class="title-l-c bg-primary"></span>
|
|
</article>
|
|
<?php endwhile; ?>
|
|
<?php
|
|
$pageprev = $this->options->pageprev ?? '0';
|
|
if ($pageprev == '1' && $this->have()):
|
|
?>
|
|
<div class="mt20 p-flex-s-right" data-no-instant>
|
|
<?php $this->pageNav('«', '»', 1, '...', array(
|
|
'wrapTag' => 'ul',
|
|
'wrapClass' => 'pagination comment-ajax-load',
|
|
'itemTag' => 'li',
|
|
'textTag' => 'span',
|
|
'currentClass' => 'active',
|
|
'prevClass' => 'prev',
|
|
'nextClass' => 'next'
|
|
)); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php else: ?>
|
|
<?php $this->need('card.php'); ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php $this->need('sidebar.php'); ?>
|
|
<?php $this->need('footer.php'); ?>
|