fresh start

This commit is contained in:
sagrrecn
2026-02-19 13:13:03 +08:00
commit 9bbf98d0b9
322 changed files with 15696 additions and 0 deletions

3
.gitattributes vendored Normal file
View File

@@ -0,0 +1,3 @@
*.zip filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.iso filter=lfs diff=lfs merge=lfs -text

31
404.php Normal file
View File

@@ -0,0 +1,31 @@
<?php if (!defined("__TYPECHO_ROOT_DIR__")) {exit();} ?>
<!DOCTYPE html>
<html lang="zh">
<?php $this->need("header.php"); ?>
<body class="jasmine-body">
<div class="jasmine-container grid grid-cols-12">
<div class="flex col-span-12 lg:col-span-8 flex-col lg:border-x-2 border-stone-100 dark:border-neutral-600 lg:pt-0 lg:px-6 pb-10 px-3">
<?php $this->need("component/menu.php"); ?>
<div class="flex flex-col gap-y-12">
<div></div>
<div class="mx-1 flex flex-col">
<div></div>
<div class="flex flex-row" itemscope="" itemtype="https://schema.org/NewsArticle">
<div class="mr-3 flex flex-1 flex-col justify-center gap-y-5">
<h1 class="text-2xl font-semibold jasmine-primary-color jasmine-letter-spacing" itemprop="headline">未找到页面 </h1>
</div>
</div>
</div>
<!--404页面文章提示 2023.8.6-->
<div class="404J markdown-body dark:!bg-[#161829] dark:!bg-[#0d1117] !text-neutral-900 dark:!text-gray-400" itemprop="articleBody">
<p>不好意思,没有找不到您想要的页面,请检查链接是否正确。</p>
<p>若网页有问题麻烦联系反馈邮件sagrre_cn@126.com夕格会第一时间修复。</p>
<p class="p404">您可以选择:<a href="<?php $this->options->siteUrl(); ?>" title="返回首页">返回首页</a></p>
</div>
<!--2023.8.6 404页面文章调用-->
</div>
</div>
</div>
<?php $this->need("footer.php"); ?>
</body>
</html>

0
README.md Normal file
View File

BIN
assets/dist/font/HarmonyOS-Sans.woff2 vendored Normal file

Binary file not shown.

379
assets/dist/iconfont.css vendored Normal file

File diff suppressed because it is too large Load Diff

450
assets/dist/jasmine.iife.js vendored Normal file

File diff suppressed because it is too large Load Diff

4169
assets/dist/style.css vendored Normal file

File diff suppressed because it is too large Load Diff

346
assets/dist/tianli_gpt.css vendored Normal file

File diff suppressed because it is too large Load Diff

362
assets/dist/tianli_gpt.js vendored Normal file

File diff suppressed because it is too large Load Diff

1
assets/dist/tianli_gpt.min.css vendored Normal file

File diff suppressed because one or more lines are too long

5
assets/dist/tianli_gpt.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1499
assets/lantern.html Normal file

File diff suppressed because it is too large Load Diff

1170
assets/lantern1.html Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

82
assets/wish-api.php Normal file
View File

@@ -0,0 +1,82 @@
<?php
/**
* 都市繁星 · 祝福墙API (Typecho适配版)
* 存储路径: /usr/themes/sagrre/assets/wishes.json
*/
// 允许跨域调用
header('Content-Type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header('Access-Control-Allow-Headers: Content-Type');
// JSON文件存储路径和本PHP文件在同一目录
$jsonFile = __DIR__ . '/wishes.json';
// ===== 读取祝福列表 =====
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (file_exists($jsonFile)) {
$data = file_get_contents($jsonFile);
echo $data;
} else {
// 首次运行,返回默认祝福语
$defaultWishes = [
['nickname' => '星语者', 'recipient' => '博主', 'content' => '代码无BUG发量永浓密', 'time' => time()],
['nickname' => '城市旅人', 'recipient' => '自己', 'content' => '房贷压力小,升职加薪早', 'time' => time()],
['nickname' => '宝妈', 'recipient' => '家人', 'content' => '宝宝健康,老公体贴', 'time' => time()]
];
echo json_encode($defaultWishes, JSON_UNESCAPED_UNICODE);
}
exit;
}
// ===== 提交新祝福 =====
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// 获取POST数据
$input = json_decode(file_get_contents('php://input'), true);
$nickname = trim($input['nickname'] ?? '匿名');
$recipient = trim($input['recipient'] ?? '大家');
$content = trim($input['content'] ?? '');
if (empty($content)) {
http_response_code(400);
echo json_encode(['error' => '祝福内容不能为空']);
exit;
}
// 限制长度
$nickname = mb_substr($nickname, 0, 20);
$recipient = mb_substr($recipient, 0, 20);
$content = mb_substr($content, 0, 50);
// 读取现有数据
$wishes = [];
if (file_exists($jsonFile)) {
$wishes = json_decode(file_get_contents($jsonFile), true);
if (!is_array($wishes)) $wishes = [];
}
// 添加新祝福(插到最前面)
array_unshift($wishes, [
'nickname' => $nickname,
'recipient' => $recipient,
'content' => $content,
'time' => time()
]);
// 只保留最新的50条
$wishes = array_slice($wishes, 0, 50);
// 写入JSON文件
file_put_contents($jsonFile, json_encode($wishes, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
echo json_encode(['success' => true, 'wishes' => $wishes]);
exit;
}
// ===== 其他请求 =====
http_response_code(405);
echo json_encode(['error' => 'Method Not Allowed']);
exit;
?>

26
assets/wishes.json Normal file
View File

@@ -0,0 +1,26 @@
[
{
"nickname": "XIGE",
"recipient": "博主",
"content": "新年快乐!",
"time": 1770881037
},
{
"nickname": "XIGE",
"recipient": "父母",
"content": "身体健康",
"time": 1770875165
},
{
"nickname": "XIGE",
"recipient": "自己",
"content": "发大财",
"time": 1770874717
},
{
"nickname": "XIGE",
"recipient": "大家",
"content": "新年快乐",
"time": 1770874271
}
]

641
comments.php Normal file

File diff suppressed because it is too large Load Diff

25
component/logo.php Normal file
View File

@@ -0,0 +1,25 @@
<?php if (!defined("__TYPECHO_ROOT_DIR__")) {
exit();
} ?>
<?php if ($this->options->logoUrl): ?>
<div class="flex justify-center relative nav-li">
<a itemprop="url" href="<?php $this->options->siteUrl(); ?>">
<img itemprop="logo"
src="<?php echo $this->options->logoUrl; ?>"
alt="<?php $this->options->title(); ?>" width="50" height="50"
loading="lazy"
class="rounded object-cover"/>
</a>
<span class="jasmine-primary-bg text-white px-2 py-1 absolute w-full rounded top-[5px] left-[90px] w-max"
style="display: none">
<?php echo getOptionValueOrDefault("logoText", $this->options->title); ?>
</span>
</div>
<?php endif; ?>
<?php if ($this->is("index")): ?>
<div class="hidden">
<h1><?php $this->options->title(); ?></h1>
<p><?php $this->options->description(); ?></p>
</div>
<?php endif; ?>

151
component/menu.php Normal file
View File

@@ -0,0 +1,151 @@
<?php if (!defined("__TYPECHO_ROOT_DIR__")) {
exit();
} ?>
<div id="header-menu" class="jasmine-primary-color hidden lg:block sticky top-0 border-b bt lg:py-5 bg-[#ffffffe6] dark:bg-[rgba(22,24,41,0.9)] dark:border-neutral-600 backdrop-blur">
<div id="header-menu-wrap" class="flex justify-between hidden lg:flex z-50">
<ul class="nav flex items-center gap-x-3">
<li>
<a title="首页" href="<?php $this->options->siteUrl(); ?>"
class="rounded-full px-4 py-2 jasmine-primary-bg-hover cat-hover hover:text-white hover:shadow-lg">首页</a>
</li>
<?php $this->widget("Jasmine_Meta_Row")->to($categorys); ?>
<?php if ($categorys->have()): ?>
<?php while ($categorys->next()): ?>
<li>
<a href="<?php $categorys->permalink(); ?>"
title="<?php $categorys->name(); ?>"
class="rounded-full px-4 py-2 jasmine-primary-bg-hover cat-hover hover:text-white hover:shadow-lg">
<?php $categorys->name(); ?>
</a>
</li>
<?php endwhile; ?>
<?php endif; ?>
<!--<li><a href="https://www.shitoucuo.com/memos" class="rounded-full px-4 py-2 cat-hover jasmine-primary-bg-hover hover:text-white hover:shadow-lg">灵感</a></li> <meta itemprop="url" content="<?php $this->options->siteUrl(); ?>">-->
<!--<li><a href="https://www.shitoucuo.com/category-tushuo.html" class="rounded-full px-4 py-2 jasmine-primary-bg-hover hover:text-white hover:shadow-lg">图说</a></li>-->
<!--<li><a href="https://www.shitoucuo.com/movies.html" class="rounded-full px-4 py-2 jasmine-primary-bg-hover hover:text-white hover:shadow-lg">观影</a></li>
<li><a href="https://www.shitoucuo.com/books.html" class="rounded-full px-4 py-2 jasmine-primary-bg-hover hover:text-white hover:shadow-lg">阅读</a></li>-->
<!--<li><a href="https://www.shitoucuo.com/mailbox.html" class="rounded-full px-4 py-2 jasmine-primary-bg-hover hover:text-white hover:shadow-lg">友筒</a></li>-->
<!-- <li><a href="links.html" class="rounded-full px-4 py-2 cat-hover jasmine-primary-bg-hover hover:text-white hover:shadow-lg">友圈</a></li>-->
<?php if (Typecho_Widget::widget('Widget_User')->hasLogin()){?>
<li><a href="https://www.shitoucuo.com/sl.html" class="rounded-full px-4 py-2 cat-hover jasmine-primary-bg-hover hover:text-white hover:shadow-lg">速览</a></li>
<!--<li><a href="https://www.shitoucuo.com/rp.html" class="rounded-full px-4 py-2 cat-hover jasmine-primary-bg-hover hover:text-white hover:shadow-lg">锐评</a></li>-->
<!--<li><a href="https://www.shitoucuo.com/dw.html" class="rounded-full px-4 py-2 cat-hover jasmine-primary-bg-hover hover:text-white hover:shadow-lg">短文</a></li>-->
<li><a href="https://www.shitoucuo.com/gd.html" class="rounded-full px-4 py-2 cat-hover jasmine-primary-bg-hover hover:text-white hover:shadow-lg">归档</a></li><?php } ?>
<form method="post" action="" id="search" itemprop="potentialAction" itemscope="" itemtype="https://schema.org/SearchAction">
<meta itemprop="target" content="<?php $this->options->siteUrl(); ?>search/{s}/">
<label for="search" class="flex flex-row">
<button class="my-2 cat-hover cat-search pt-2" onclick="jasmine.clickSearch()">
<iconify-icon icon="tabler:search"
class="rounded px-1 text-lg jasmine-link-color"></iconify-icon>
</button>
<input class=" duration-300 my-2 w-0 focus:w-32 bg-transparent" itemprop="query-input" id="search-input" type="text" name="s" required="true" autocomplete="off" placeholder=" 请输入关键词">
</label>
</form>
<!--<li><a href="https://www.shitoucuo.com/aboutme.html" class="rounded-full px-4 py-2 cat-hover
jasmine-primary-bg-hover hover:text-white hover:shadow-lg">关于</a></li>-->
<!-- <li><a href="archive.html" class="rounded-full px-4 py-2 jasmine-primary-bg-hover hover:text-white hover:shadow-lg">归档</a></li>-->
<!--<li><a href="https://www.shitoucuo.com/aboutme.html" class="rounded-full px-4 py-2 cat-hover
jasmine-primary-bg-hover hover:text-white hover:shadow-lg">关于</a></li>
<li itemscope="" itemtype="https://schema.org/WebSite">-->
</ul>
<!--<ul class="nav flex items-center gap-x-3">
<li itemscope="" itemtype="https://schema.org/WebSite">
<meta itemprop="url" content="<?php $this->options->siteUrl(); ?>">
<form method="post" action="" id="search" itemprop="potentialAction" itemscope="" itemtype="https://schema.org/SearchAction">
<meta itemprop="target" content="<?php $this->options->siteUrl(); ?>search/{s}/">
<label for="search" class="flex flex-row">
<button class="my-2 pt-2" onclick="jasmine.clickSearch()">
<iconify-icon icon="tabler:search"
class="rounded px-1 text-lg jasmine-link-color"></iconify-icon>
</button>
<input class=" duration-300 my-2 w-0 focus:w-32 bg-transparent" itemprop="query-input" id="search-input" type="text" name="s" required="true" autocomplete="off" placeholder="Search">
</label>
</form>
</li>
</ul>-->
</div>
</div>
<div class="divline"></div>
<div id="header-menu-mobile" class="mbh jasmine-primary-color lg:hidden flex justify-between sticky top-0 border-b border-stone-100 py-3 z-50 bg-[#ffffffe6] dark:bg-[rgba(22,24,41,0.9)] dark:text-neutral-300 dark:border-neutral-600 backdrop-blur">
<ul class="nav flex items-center gap-x-3">
<li>
<?php $this->need("component/logo.php"); ?>
</li>
</ul>
<ul class="nav flex items-center gap-x-3">
<li>
<button onclick="jasmine.switchDark()">
<iconify-icon icon="<?php echo getOptionValueOrDefault("switchDarkIconPhone", "tabler:sun-moon"); ?>"
class="rounded px-3 py-2 text-lg"></iconify-icon>
</button>
</li>
<li>
<form method="post" action="" id="search" itemprop="potentialAction" itemscope="" itemtype="https://schema.org/SearchAction">
<meta itemprop="target" content="<?php $this->options->siteUrl(); ?>search/{s}/">
<label for="search" class="flex flex-row">
<button class="" onclick="jasmine.clickSearch()">
<iconify-icon icon="tabler:search"
class="rounded px-3 py-2 text-lg"></iconify-icon>
</button>
<input class=" duration-300 my-2 w-0 focus:w-32 bg-transparent" itemprop="query-input" id="search-input" type="text" name="s" required="true" autocomplete="off" placeholder="Search">
</label>
</form>
</li>
<li>
<button onclick="jasmine.toggleMobileMenu()">
<iconify-icon icon="tabler:menu-2"
class="rounded px-3 py-2 text-lg"></iconify-icon>
</button>
</li>
</ul>
</div>
<div id="mobile-menus-bg" class="lg:hidden hidden fixed top-0 left-0 z-[999] bg-gray-500/50 dark:bg-[#0a0c19]/50 w-full min-h-screen"></div>
<div id="mobile-menus" class="lg:hidden fixed top-0 left-0 z-[1000] translate-x-[-1000px] w-4/5 duration-300">
<div class="jasmine-primary-color bg-stone-100 min-h-screen flex flex-col gap-y-14 px-5 pt-14 dark:bg-[#161829]">
<ul class="flex flex-col items-center gap-y-3">
<li class="bg-white rounded w-full dark:bg-gray-700 ">
<a title="首页" href="<?php $this->options->siteUrl(); ?>"
class="w-full block px-4 py-2">首页</a>
</li>
<?php $this->widget("Jasmine_Meta_Row")->to($categorys); ?>
<?php if ($categorys->have()): ?>
<?php while ($categorys->next()): ?>
<li class="bg-white rounded w-full dark:bg-gray-700 ">
<a href="<?php $categorys->permalink(); ?>"
title="<?php $categorys->name(); ?>"
class="w-full block px-4 py-2">
<?php $categorys->name(); ?>
</a>
</li>
<?php endwhile; ?>
<?php endif; ?>
</ul>
<ul class="flex flex-col items-center gap-y-3 w-full">
<?php $menus = getLeftSidebarMenu(); ?>
<?php if (!empty($menus)): ?>
<?php foreach ($menus as $menu): ?>
<li class="bg-white rounded w-full dark:bg-gray-700 ">
<a class="w-full block px-4 py-2" href="<?php echo $menu["url"]; ?>" target="<?php echo $menu[
"newTab"
]
? "_blank"
: "_self"; ?>" title="<?php echo $menu["name"]; ?>">
<?php echo $menu["name"]; ?>
</a>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</div>
</div>

15
component/paging.php Normal file
View File

@@ -0,0 +1,15 @@
<?php if (!defined("__TYPECHO_ROOT_DIR__")) {
exit();
} ?>
<div class="flex justify-center">
<div class="bg-block"></div>
<nav aria-label="Page navigation" id="page-nav">
<?php $this->pageNav("", "", 1, "...", [
"wrapTag" => "ul",
"wrapClass" => "flex gap-x-5",
"itemTag" => "li",
"currentClass" => "active",
]); ?>
</nav>
</div>

View File

@@ -0,0 +1,80 @@
<?php if (!defined("__TYPECHO_ROOT_DIR__")) {
exit();
} ?>
<div class="flex flex-row wz" itemscope itemtype="https://schema.org/NewsArticle" style="border-radius:1rem;">
<div class=" flex flex-1 flex-col justify-between gap-y-3">
<?php
$thumbnail = getThumbnail($this->cid, "");
$autoThumbnailCategories = array('探店', '爸爸厨房', '户外'); // 需要自动获取封面的分类
// 获取当前文章的分类
$categories = $this->categories;
$currentCategory = '';
if (!empty($categories)) {
$currentCategory = $categories[0]['name'];
}
// 封面显示逻辑
$showThumbnail = false;
if ($thumbnail) {
// 如果有手动设置的封面,始终显示
$showThumbnail = true;
} elseif (in_array($currentCategory, $autoThumbnailCategories)) {
// 如果是指定分类且没有设置封面,从文章内容中提取第一张图片
preg_match_all('/<img.*?src=["\'](.*?)["\']/i', $this->content, $matches);
if (!empty($matches[1])) {
$thumbnail = $matches[1][0];
$showThumbnail = true;
}
}
if ($showThumbnail && $thumbnail): ?>
<a href="<?php $this->permalink(); ?>" title="<?php $this->title(); ?>" class="">
<img src="<?php echo $thumbnail; ?>" alt="<?php $this->title(); ?>" width="100%"
height="90"
class="h-[260px] rounded object-cover" loading="lazy"/>
</a>
<?php endif; ?>
<h2 class="jasmine-link-color-hover text-black line-clamp-1 text-xl jasmine-letter-spacing dark:text-neutral-200" itemprop="headline">
<?php echo getTimeLabel($this->date->timeStamp); ?>
<?php
// 从文章内容中统计图片标签
preg_match_all('/<img[^>]+>/i', $this->content, $matches);
$imageCount = count($matches[0]);
// 调试信息
if ($imageCount > 0) {
if ($imageCount < 20) {
echo '<span class="nwe">有图</span>';
} else {
echo '<span class="nwe">多图</span>';
}
}
?><a href="<?php $this->permalink(); ?>" class="ptitle" title="<?php $this->title(); ?>"><?php $this->title(); ?></a>
</h2>
<div class="dark:text-gray-400 tm-ca">
<span><i class="iconfont icon-zuozhe"></i> <a href="<?php $this->author->permalink(); ?> "><?php $this->author() ?></a></span>
<!--<span class="jasmine-link-color">--><span><i class="iconfont icon-fenlei"></i> <?php $this->category("·", true, "无"); ?></span>
<span> <i class="iconfont icon-shijian_o"></i> <?php echo date('Y-m-d H:i:s' , $this->created);?></span>
</div>
<p class="line-clamp-2 jasmine-letter-spacing dark:dark:text-gray-400 break-all" itemprop="abstract">
<a href="<?php $this->permalink(); ?>"
title="<?php $this->title(); ?>">
<!--摘要处理有自定义description字段显示自定义内容没有则按现有方式截取-->
<?php
// 检查是否有自定义description字段
$customDescription = $this->fields->description;
if (!empty($customDescription)) {
// 如果有自定义描述,直接显示
echo Typecho_Common::subStr(strip_tags($customDescription), 0, 100, '...');
} else {
// 如果没有自定义描述使用原有的excerpt方法
$this->excerpt(100, "");
}
?>
</a>
</p>
</div>
</div>

View File

@@ -0,0 +1,29 @@
<?php if (!defined("__TYPECHO_ROOT_DIR__")) {
exit();
} ?>
<style>
.post-TianliGPT{display:none;}
</style>
<div class="flex flex-col gap-y-3" itemscope itemtype="https://schema.org/NewsArticle">
<!-- 2023.7.28 干掉说说头像日期等 <div class="flex flex-row gap-x-3 item-center">
<img class="rounded object-cover w-[42px] h-[42px]" width="42" height="42"
src="<?php echo getAvatarByMail($this->author->mail, true); ?>"
loading="lazy"
alt="<?php $this->author->screenName(); ?>">
<div class="flex flex-col justify-center">
<span class=""><?php $this->author->screenName(); ?></span>
<span class=" text-sm"><?php echo getHumanizedDate($this->created); ?></span>
</div>
</div>-->
<div class="markdown-body markdown-body-list !bg-stone-100 rounded p-5 relative dark:!bg-[#0d1117] !text-neutral-900 dark:!text-neutral-200" id="moment" style="margin-top:0px;">
<div class="dark:text-gray-400 tm-ca" style="padding-bottom:10px;">
<span><i class="iconfont icon-shijian_o"></i> <?php echo date('Y/m/d H:i:s' , $this->created);?></span>
</br><span><i class="iconfont icon-zuozhe"></i> <?php $this->author() ?></span>
</div>
<?php echo handleContent($this->content);?>
<div class="btt"> <a href="<?php $this->permalink(); ?>" title="<?php $this->title(); ?>"><?php $this->title(); ?></a></div>
</div>
</div>

16
component/post-item.php Normal file
View File

@@ -0,0 +1,16 @@
<?php if (!defined("__TYPECHO_ROOT_DIR__")) {
exit();
} ?>
<div class="mx-1 flex flex-col gap-y-12 pb-12 border-stone-100 dark:border-neutral-600">
<div></div>
<?php while ($this->next()): ?>
<?php if (isShuoShuoType($this->cid)): ?>
<?php $this->need("component/post-item-moment.php"); ?>
<?php elseif ($this->fields->Postype==1): ?>
<?php $this->need("component/post-item-tu.php"); ?>
<?php else: ?>
<?php $this->need("component/post-item-default.php"); ?>
<?php endif; ?>
<?php endwhile; ?>
</div>

49
component/post-title.php Normal file
View File

@@ -0,0 +1,49 @@
<?php if (!defined("__TYPECHO_ROOT_DIR__")) {
exit();
} ?>
<style>
.mr-3 {
margin-right:0rem!important;
}
.dark .markdown-body{margin-top:0px!important;}
</style>
<div class="mx-1 flex flex-col">
<?php SimpleBreadcrumb_Plugin::show(); ?>
<div></div>
<div class="flex flex-row" itemscope itemtype="https://schema.org/NewsArticle">
<div class="mr-3 flex flex-1 flex-col justify-center gap-y-5" style="text-align:center;">
<h1 class="text-2xl ntitle font-semibold jasmine-primary-color jasmine-letter-spacing" itemprop="headline">
<?php $this->title(); ?>
</h1>
<div class="dark:text-gray-400" style="text-align:center;">
<div class="ICON">
<!--<span><i class="iconfont icon-xiugai"></i> <?php echo date('Y-m-d H:i' , $this->created); ?></span>-->
<span><i class="iconfont icon-xiugai"></i> <?php $weekday = date('w', $this->created); // 获取数字0(周日)到6(周六)
$weekday_cn = ['日', '一', '二', '三', '四', '五', '六'];
echo date('Y-m-d H:i', $this->created) . ' 星期' . $weekday_cn[$weekday];
;?></span>
<span><i class="iconfont icon-iddenglu"></i> <?php $this->cid(); ?></span><br>
<?php if ($this->is('post')) : ?>
<span><<?php $this->category(','); ?>></span>
<?php endif; ?>
<?php
// 自动显示(已内置)
// 或手动调用
echo ArticleWeather_Plugin::show($this->cid);
?>
<?php if (class_exists('EditHistory_Plugin')): ?>
<?php echo EditHistory_Plugin::output(); ?>
<?php endif; ?>
</div>
</div>
<span class="hidden" itemprop="author" itemscope itemtype="https://schema.org/Person">
<meta itemprop="url" content="<?php $this->author->permalink(); ?>"/>
<a itemprop="url" href="<?php $this->author->permalink(); ?>">
<span itemprop="name"><?php $this->author->screenName(); ?></span>
</a>
</span>
</div>
</div>
</div>

28
component/post-top.php Normal file
View File

@@ -0,0 +1,28 @@
<?php if (!defined("__TYPECHO_ROOT_DIR__")) {
exit();
} ?>
<?php
$cids = getStickyPost();
if (null != $cids): ?>
<div class="flex zd flex-wrap flex-col lg:flex-row gap-y-12 border-stone-100 dark:border-neutral-600">
<?php foreach ($cids as $cid): ?>
<?php $this->widget("Widget_Archive@jasmine" . $cid, "pageSize=1&type=post", "cid=" . $cid)->to($item); ?>
<div class="zdwz" style="width:100%;">
<?php if ($thumbnail = getThumbnail($item->cid, "")): ?>
<a href="<?php $item->permalink(); ?>" title="<?php $item->title(); ?>" class=""
title="<?php $item->title(); ?>">
<img
src="<?php echo $thumbnail; ?>"
alt="" width="100%"
height="260"
alt="<?php $item->title(); ?>"
loading="lazy"
class="h-[260px] rounded object-cover"/ style="margin-bottom:0px;">
</a>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php endif;?>

121
core/backup.php Normal file
View File

@@ -0,0 +1,121 @@
<?php use Utils\Helper;
$name = "jasmine";
$db = Typecho_Db::get();
if (isset($_POST["type"])) {
if ($_POST["type"] == "备份设置") {
$value = $db->fetchRow(
$db
->select()
->from("table.options")
->where("name = ?", "theme:" . $name)
)["value"];
if (
$db->fetchRow(
$db
->select()
->from("table.options")
->where("name = ?", "theme:" . $name . "_backup")
)
) {
$db->query(
$db
->update("table.options")
->rows(["value" => $value])
->where("name = ?", "theme:" . $name . "_backup")
); ?>
<script>
alert("备份更新成功!");
window.location.href = '<?php Helper::options()->adminUrl("options-theme.php"); ?>'
</script>
<?php
} else {
?>
<?php if ($value) {
$db->query(
$db
->insert("table.options")
->rows(["name" => "theme:" . $name . "_backup", "user" => "0", "value" => $value])
); ?>
<script>
alert("备份成功!");
window.location.href = '<?php Helper::options()->adminUrl("options-theme.php"); ?>'
</script>
<?php
}
}
}
if ($_POST["type"] == "还原备份") {
if (
$db->fetchRow(
$db
->select()
->from("table.options")
->where("name = ?", "theme:" . $name . "_backup")
)
) {
$_value = $db->fetchRow(
$db
->select()
->from("table.options")
->where("name = ?", "theme:" . $name . "_backup")
)["value"];
$db->query(
$db
->update("table.options")
->rows(["value" => $_value])
->where("name = ?", "theme:" . $name)
);
?>
<script>
alert("还原成功!");
window.location.href = '<?php Helper::options()->adminUrl("options-theme.php"); ?>'
</script>
<?php
} else {
?>
<script>
alert("未备份过数据,无法恢复!");
window.location.href = '<?php Helper::options()->adminUrl("options-theme.php"); ?>'
</script>
<?php
} ?>
<?php
}
?>
<?php if ($_POST["type"] == "删除备份") {
if (
$db->fetchRow(
$db
->select()
->from("table.options")
->where("name = ?", "theme:" . $name . "_backup")
)
) {
$db->query($db->delete("table.options")->where("name = ?", "theme:" . $name . "_backup")); ?>
<script>
alert("删除成功");
window.location.href = '<?php Helper::options()->adminUrl("options-theme.php"); ?>'
</script>
<?php
} else {
?>
<script>
alert("没有备份内容,无法删除!");
window.location.href = '<?php Helper::options()->adminUrl("options-theme.php"); ?>'
</script>
<?php
} ?>
<?php
} ?>
<?php
}
?>
<?php echo '
<form class="backup" action="?Joe_backup" method="post">
<input type="submit" name="type" value="备份设置" />
<input type="submit" name="type" value="还原备份" />
<input type="submit" name="type" value="删除备份" />
</form>';

84
core/common.php Normal file
View File

@@ -0,0 +1,84 @@
<?php
if (!defined("__TYPECHO_ROOT_DIR__")) {
exit();
}
class Widget_Comments_Recent extends Widget_Abstract_Comments
{
public function __construct($request, $response, $params = null)
{
parent::__construct($request, $response, $params);
$this->parameter->setDefault(["pageSize" => 8, "parentId" => 0]);
}
public function execute()
{
$select = $this->select()
->limit($this->parameter->pageSize)
->where("table.comments.status = ?", "approved")
->order("table.comments.coid", Typecho_Db::SORT_DESC);
if ($this->parameter->parentId) {
$select->where("cid = ?", $this->parameter->parentId);
}
if ($this->options->commentsShowCommentOnly) {
$select->where("type = ?", "comment");
}
$select->where("ownerId <> authorId");
$this->db->fetchAll($select, [$this, "push"]);
}
}
/**
* 评论添加 @
* @param $coid
* @return void
*/
function getCommentAt($coid)
{
$db = Typecho_Db::get();
$prow = $db->fetchRow(
$db
->select("parent")
->from("table.comments")
->where("coid = ? AND status = ?", $coid, "approved")
);
$parent = $prow["parent"];
if ($prow && $parent != "0") {
$arow = $db->fetchRow(
$db
->select("author")
->from("table.comments")
->where("coid = ? AND status = ?", $parent, "approved")
);
echo '<span class="comment-at float-left mr-1 px-1 text-white jasmine-primary-bg rounded">@' .
$arow["author"] .
"</span>";
}
}
/**
* 评论作者
* @param $obj
* @param $autoLink
* @param $noFollow
* @return void
*/
function getCommentAuthor($obj, $autoLink = null, $noFollow = null)
{
$options = Helper::options();
$autoLink = $autoLink ? $autoLink : $options->commentsShowUrl;
$noFollow = $noFollow ? $noFollow : $options->commentsUrlNofollow;
if ($obj->url && $autoLink) {
echo '<a href="' .
$obj->url .
'"' .
($noFollow ? ' rel="external nofollow"' : null) .
(strstr($obj->url, $options->index) == $obj->url ? null : ' target="_blank"') .
">" .
$obj->author .
"</a>";
} else {
echo $obj->author;
}
}

14
core/index.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
if (!defined("__TYPECHO_ROOT_DIR__")) {
exit();
}
require_once "utils.php";
require_once "options.php";
require_once "meta.php";
require_once "post.php";
require_once "common.php";

40
core/meta.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
use Widget\Metas\Category\Rows;
if (!defined("__TYPECHO_ROOT_DIR__")) {
exit();
}
class Jasmine_Meta_Row extends Rows
{
public function __construct($request, $response, $params = null)
{
parent::__construct($request, $response, $params);
}
/**
* 执行函数
*
* @throws Db\Exception
*/
public function execute()
{
$this->stack = $this->getCategories(getMiddleTopCategoryIds());
}
}
/**
* 判断当前是菜单否激活
* @param $self
* @return string
*/
function isActiveMenu($self, $slug): string
{
if ($self->is("category") || $self->is("post")) {
if ($self->category === $slug) {
return "jasmine-primary-bg shadow-lg !text-white";
}
}
return "";
}

201
core/options.php Normal file
View File

@@ -0,0 +1,201 @@
<?php
use Typecho\Common;
use Typecho\Widget\Helper\Form\Element\Checkbox;
use Typecho\Widget\Helper\Form\Element\Text;
use Typecho\Widget\Helper\Form\Element\Textarea;
use Typecho\Widget\Helper\Form\Element\Radio;
use Utils\Helper;
use Widget\Notice;
use Widget\Options;
if (!defined("__TYPECHO_ROOT_DIR__")) {
exit();
}
/**
* 主题配置
* @param $form
* @return void
*/
function themeConfig($form)
{
$icon = new Text(
"icon",
null,
null,
_t("Favicon"),
_t("图片地址, 浏览器标签栏显示ICON默认值为站点路径下 /favicon.ico")
);
$form->addInput($icon);
$logoUrl = new Text("logoUrl", null, null, _t("LOGO"), _t("图片地址, 用于显示站点 LOGO ,留空不显示"));
$form->addInput($logoUrl);
$stickyPost = new Text(
"stickyPost",
null,
null,
"置顶文章",
"格式文章的ID || 文章的ID || 文章的ID"
);
$form->addInput($stickyPost);
$avatarWebsite = new Radio(
"avatarWebsite",
[
"gravatar" => _t("Gravatar"),
"qq" => _t("QQ 头像"),
],
"gravatar",
_t("设置显示头像优先级"),
_t("默认通过邮箱,获取 Gravatar 头像")
);
$customStyle = new Textarea("customStyle", null, null, "自定义样式", "不需要添加 &lt;style&gt; 标签");
$form->addInput($customStyle);
$customScript = new Textarea("customScript", null, null, "自定义脚本", "不需要添加 &lt;script&gt; 标签");
$form->addInput($customScript);
backupThemeData();
}
/**
* 备份主题数据
* @return void
*/
function backupThemeData()
{
$name = "sagrre";//注意修改主题名称,这里也要跟着修改;
$db = Typecho_Db::get();
if (isset($_POST["type"])) {
if ($_POST["type"] == "创建备份") {
$value = $db->fetchRow(
$db
->select()
->from("table.options")
->where("name = ?", "theme:" . $name)
)["value"];
if (
$db->fetchRow(
$db
->select()
->from("table.options")
->where("name = ?", "theme:" . $name . "_backup")
)
) {
$db->query(
$db
->update("table.options")
->rows(["value" => $value])
->where("name = ?", "theme:" . $name . "_backup")
);
Notice::alloc()->set("备份更新成功", "success");
Options::alloc()->response->redirect(Common::url("options-theme.php", Options::alloc()->adminUrl));
?>
<?php
} else {
?>
<?php if ($value) {
$db->query(
$db
->insert("table.options")
->rows(["name" => "theme:" . $name . "_backup", "user" => "0", "value" => $value])
);
Notice::alloc()->set("备份成功", "success");
Options::alloc()->response->redirect(Common::url("options-theme.php", Options::alloc()->adminUrl));
?>
<?php
}
}
}
if ($_POST["type"] == "还原备份") {
if (
$db->fetchRow(
$db
->select()
->from("table.options")
->where("name = ?", "theme:" . $name . "_backup")
)
) {
$_value = $db->fetchRow(
$db
->select()
->from("table.options")
->where("name = ?", "theme:" . $name . "_backup")
)["value"];
$db->query(
$db
->update("table.options")
->rows(["value" => $_value])
->where("name = ?", "theme:" . $name)
);
Notice::alloc()->set("备份还原成功", "success");
Options::alloc()->response->redirect(Common::url("options-theme.php", Options::alloc()->adminUrl));
?>
<?php
} else {
Notice::alloc()->set("无备份数据,请先创建备份", "error");
Options::alloc()->response->redirect(Common::url("options-theme.php", Options::alloc()->adminUrl));
?>
<?php
} ?>
<?php
}
?>
<?php if ($_POST["type"] == "删除备份") {
if (
$db->fetchRow(
$db
->select()
->from("table.options")
->where("name = ?", "theme:" . $name . "_backup")
)
) {
$db->query($db->delete("table.options")->where("name = ?", "theme:" . $name . "_backup"));
Notice::alloc()->set("删除备份成功", "success");
Options::alloc()->response->redirect(Common::url("options-theme.php", Options::alloc()->adminUrl));
?>
<?php
} else {
Notice::alloc()->set("无备份数据,无法删除", "success");
Options::alloc()->response->redirect(Common::url("options-theme.php", Options::alloc()->adminUrl));
?>
<?php
} ?>
<?php
} ?>
<?php
}
?>
</form>
<?php echo '<br/><div class="message error">请先点击右下角的保存设置按钮,创建备份!<br/><br/><form class="backup" action="?jasmine_backup" method="post">
<input type="submit" name="type" class="btn primary" value="创建备份" />
<input type="submit" name="type" class="btn primary" value="还原备份" />
<input type="submit" name="type" class="btn primary" value="删除备份" /></form></div>';
}
/**
* 输出所有分类
* @return void
*/
function getCategoryies()
{
$db = Typecho_Db::get();
$prow = $db->fetchAll(
$db
->select()
->from("table.metas")
->where("type = ?", "category")
);
$text = "";
foreach ($prow as $item) {
$text .= $item["name"] . "(" . $item["mid"] . ")" . "&nbsp;&nbsp;&nbsp;&nbsp;";
}
return $text;
}

Some files were not shown because too many files have changed in this diff Show More