summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/Contents.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/libs/Contents.php b/libs/Contents.php
index 055d4ce..b424add 100644
--- a/libs/Contents.php
+++ b/libs/Contents.php
@@ -314,4 +314,27 @@ class Contents
), '', ' - ');
Helper::options()->title();
}
-}
+
+ /**
+ * 内容归档
+ */
+ public static function archives($widget) {
+ $db = Typecho_Db::get();
+ $rows = $db->fetchAll($db->select()
+ ->from('table.contents')
+ ->order('table.contents.created', Typecho_Db::SORT_DESC)
+ ->where('table.contents.type = ?', 'post')
+ ->where('table.contents.status = ?', 'publish'));
+
+ $stat = array();
+ foreach ($rows as $row) {
+ $row = $widget->filter($row);
+ $arr = array(
+ 'title' => $row['title'],
+ 'permalink' => $row['permalink']);
+
+ $stat[date('Y', $row['created'])][$row['created']] = $arr;
+ }
+ return $stat;
+ }
+} \ No newline at end of file