summaryrefslogtreecommitdiffstats
path: root/libs/Contents.php
diff options
context:
space:
mode:
authorBigCoke233 <hi@guhub.cn>2020-07-15 00:18:04 +0800
committerBigCoke233 <hi@guhub.cn>2020-07-15 00:18:04 +0800
commit08e6e289626620abd5dea49c0485fa80dc011e79 (patch)
tree1bfb0f7746ca207bded81616f18782d5eb9871c9 /libs/Contents.php
parent0615f62964b26f5d2f54da3c9262a1ea17df41ce (diff)
:poop: Add: 初步实现多语言功能,并使用 hint.css 添加 tooltip
Diffstat (limited to 'libs/Contents.php')
-rw-r--r--libs/Contents.php28
1 files changed, 16 insertions, 12 deletions
diff --git a/libs/Contents.php b/libs/Contents.php
index bad09a9..da7d321 100644
--- a/libs/Contents.php
+++ b/libs/Contents.php
@@ -246,17 +246,8 @@ class Contents
static private $CurrentTocID = 0;
static public function parseHeaderCallback($matchs)
{
- // 增加单独标记,否则冲突
- $id = $matchs[3];
- $id = str_replace(' ','_',$id);
- $id = str_replace('&','_',$id);
- $id = str_replace('?','_',$id);
- $id = str_replace("'",'_',$id);
- $id = str_replace('"','_',$id);
- $id = str_replace('’','_',$id);
- $id = str_replace('“','_',$id);
- $id = str_replace('?','_',$id);
- return '<h'.$matchs[1].$matchs[2].' id="'.$id.'">'.$matchs[3].'<a href="#'.$id.'" title="章节链接" class="post-toc-link no-line"><i class="iconfont icon-paragraph"></i></a></h'.$matchs[1].'>';
+ $id = trim($matchs[3]);
+ return '<h'.$matchs[1].$matchs[2].' id="'.$id.'">'.$matchs[3].'<a href="#'.$id.'" title="'.$GLOBALS['postTexts']['post_anchor'].'" class="post-toc-link no-line"><i class="iconfont icon-paragraph"></i></a></h'.$matchs[1].'>';
}
/* == 其他内容 == */
@@ -377,6 +368,19 @@ class Contents
Typecho_Cookie::set('extend_contents_views', $views); //记录查看cookie
}
}
- echo $row['views'];
+ return $row['views'];
+ }
+
+ /**
+ * 获取最早文章创建时间
+ */
+ public static function getOldestPostDate() {
+ $db = Typecho_Db::get();
+ $content = $db->fetchRow($db->select()->from('table.contents')
+ ->where('table.contents.status = ?', 'publish')
+ ->where('table.contents.password IS NULL')
+ ->order('table.contents.created', Typecho_Db::SORT_ASC)
+ ->limit(1));
+ return date('Y-m-d', $content['created']);
}
} \ No newline at end of file