Skip to content

Commit

Permalink
Sticky:修正注释与文档
Browse files Browse the repository at this point in the history
  • Loading branch information
jzwalk committed Aug 1, 2018
1 parent c8a04a8 commit ddd9748
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
14 changes: 6 additions & 8 deletions Sticky/Plugin.php
Expand Up @@ -82,13 +82,12 @@ public static function sticky($archive, $select)

$db = Typecho_Db::get();
$paded = $archive->request->get('page', 1);
$sticky_html = $config->sticky_html ? $config->sticky_html : "<span style='color:red'>[置顶]</span>";

foreach($sticky_cids as $cid) {
if ($cid && $sticky_post = $db->fetchRow($archive->select()->where('cid = ?', $cid))) {
if ($paded == 1) { // 首? page.1 才?有置?文章
$sticky_post['title'] = $sticky_post['title'] . $sticky_html; // 置?的文章加入置???
$archive->push($sticky_post); // ?取置?的文章先?入
if ($paded == 1) { // 首頁 page.1 才會有置頂文章
$sticky_post['title'] = $sticky_post['title'] . $config->sticky_html;
$archive->push($sticky_post); // 選取置頂的文章先壓入
}
$select->where('table.contents.cid != ?', $cid); // 使文章不重覆
}
Expand All @@ -104,13 +103,12 @@ public static function stickyC($archive, $select)

$db = Typecho_Db::get();
$paded = $archive->request->get('page', 1);
$sticky_html = $config->sticky_html ? $config->sticky_html : "<span style='color:red'>[置顶]</span>";

foreach($sticky_cids as $cid) {
if ($cid && $sticky_post = $db->fetchRow($archive->select()->where('cid = ?', $cid))) {
if ($paded == 1) { // 首? page.1 才?有置?文章
$sticky_post['title'] = $sticky_post['title'] . $sticky_html; // 置?的文章加入置???
$archive->push($sticky_post); // ?取置?的文章先?入
if ($paded == 1) { // 首頁 page.1 才會有置頂文章
$sticky_post['title'] = $sticky_post['title'] . $config->sticky_html;
$archive->push($sticky_post); // 選取置頂的文章先壓入
}
$select->where('table.contents.cid != ?', $cid); // 使文章不重覆
}
Expand Down
14 changes: 12 additions & 2 deletions Sticky/README.md
@@ -1,3 +1,13 @@
### Sticky 1.0.1 for Typecho 0.9+
### Typecho文章置顶插件Sticky v1.0.1

文章置顶修改版 by Ryan
可在插件设置里将指定id文章在首页或分类列表页中置顶显示。

> 修正原版注释,补充文档。
- v1.0.1(17-7-32):([@逗妇乳](https://blog.iplayloli.com)

增加分类页面置顶支持,自动附加前缀。

- v1.0.0(11-6-7):(Willin Kan)

实现首页置顶功能,支持多id分隔,自定义前缀输出。

0 comments on commit ddd9748

Please sign in to comment.