mirror of
https://github.com/typecho/typecho.git
synced 2025-04-21 18:21:53 +02:00
fix #212
This commit is contained in:
parent
db5f84114e
commit
58afc7fc0c
@ -1504,32 +1504,24 @@ class Widget_Archive extends Widget_Abstract_Contents
|
||||
* 显示下一个内容的标题链接
|
||||
*
|
||||
* @access public
|
||||
* @param string $wrod 链接文字
|
||||
* @param string $class 类选择器
|
||||
* @param string $format 格式
|
||||
* @param string $default 如果没有下一篇,显示的默认文字
|
||||
* @return void
|
||||
*/
|
||||
public function theNext($word = NULL, $class = NULL, $default = NULL)
|
||||
public function theNext($format = '%s', $default = NULL)
|
||||
{
|
||||
$content = $this->db->fetchRow($this->select()->where('table.contents.created > ? AND table.contents.created < ?',
|
||||
$this->created, $this->options->gmtTime)
|
||||
->where('table.contents.status = ?', 'publish')
|
||||
->where('table.contents.type = ?', $this->type)
|
||||
->where('table.contents.password IS NULL')
|
||||
->order('table.contents.created', Typecho_Db::SORT_ASC)
|
||||
->limit(1));
|
||||
$this->created, $this->options->gmtTime)
|
||||
->where('table.contents.status = ?', 'publish')
|
||||
->where('table.contents.type = ?', $this->type)
|
||||
->where('table.contents.password IS NULL')
|
||||
->order('table.contents.created', Typecho_Db::SORT_ASC)
|
||||
->limit(1));
|
||||
|
||||
if ($content) {
|
||||
$content = $this->filter($content);
|
||||
|
||||
if ($word != NULL) {
|
||||
$class = $class ? ' class="' . $class . '"' : '';
|
||||
$link = '<a' . $class . ' href="' . $content['permalink'] . '" title="' . $content['title'] . '">' . $word . '</a>';
|
||||
echo $link;
|
||||
} else {
|
||||
$link = '<a href="' . $content['permalink'] . '" title="' . $content['title'] . '">' . $content['title'] . '</a>';
|
||||
printf('%s', $link);
|
||||
}
|
||||
$link = '<a href="' . $content['permalink'] . '" title="' . $content['title'] . '">' . $content['title'] . '</a>';
|
||||
printf($format, $link);
|
||||
} else {
|
||||
echo $default;
|
||||
}
|
||||
@ -1539,31 +1531,23 @@ class Widget_Archive extends Widget_Abstract_Contents
|
||||
* 显示上一个内容的标题链接
|
||||
*
|
||||
* @access public
|
||||
* @param string $wrod 链接文字
|
||||
* @param string $class 类选择器
|
||||
* @param string $format 格式
|
||||
* @param string $default 如果没有上一篇,显示的默认文字
|
||||
* @return void
|
||||
*/
|
||||
public function thePrev($word = NULL, $class = NULL, $default = NULL)
|
||||
public function thePrev($format = '%s', $default = NULL)
|
||||
{
|
||||
$content = $this->db->fetchRow($this->select()->where('table.contents.created < ?', $this->created)
|
||||
->where('table.contents.status = ?', 'publish')
|
||||
->where('table.contents.type = ?', $this->type)
|
||||
->where('table.contents.password IS NULL')
|
||||
->order('table.contents.created', Typecho_Db::SORT_DESC)
|
||||
->limit(1));
|
||||
->where('table.contents.status = ?', 'publish')
|
||||
->where('table.contents.type = ?', $this->type)
|
||||
->where('table.contents.password IS NULL')
|
||||
->order('table.contents.created', Typecho_Db::SORT_DESC)
|
||||
->limit(1));
|
||||
|
||||
if ($content) {
|
||||
$content = $this->filter($content);
|
||||
|
||||
if ($word != NULL) {
|
||||
$class = $class ? ' class="' . $class . '"' : '';
|
||||
$link = '<a' . $class . ' href="' . $content['permalink'] . '" title="' . $content['title'] . '">' . $word . '</a>';
|
||||
echo $link;
|
||||
} else {
|
||||
$link = '<a href="' . $content['permalink'] . '" title="' . $content['title'] . '">' . $content['title'] . '</a>';
|
||||
printf('%s', $link);
|
||||
}
|
||||
$link = '<a href="' . $content['permalink'] . '" title="' . $content['title'] . '">' . $content['title'] . '</a>';
|
||||
printf($format, $link);
|
||||
} else {
|
||||
echo $default;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user