From 58afc7fc0cd1a863e2be2ec1e1f98ffac3c1b805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=81=E5=AE=81?= Date: Thu, 20 Mar 2014 17:15:58 +0800 Subject: [PATCH] fix #212 --- var/Widget/Archive.php | 54 +++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/var/Widget/Archive.php b/var/Widget/Archive.php index 8f85be79..c2dbbea8 100644 --- a/var/Widget/Archive.php +++ b/var/Widget/Archive.php @@ -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 = '' . $word . ''; - echo $link; - } else { - $link = '' . $content['title'] . ''; - printf('%s', $link); - } + $link = '' . $content['title'] . ''; + 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 = '' . $word . ''; - echo $link; - } else { - $link = '' . $content['title'] . ''; - printf('%s', $link); - } + $link = '' . $content['title'] . ''; + printf($format, $link); } else { echo $default; }