コード例 #1
0
 protected function generateArchives($posts)
 {
     $archives = '<ul class="archives list-group">';
     $datesSorted = array();
     foreach ($posts as $post) {
         if (!$post['title']) {
             continue;
         }
         $key = date('yyyy-mm-dd', strtotime($post['dated']));
         $datesSorted[$key] = date('F Y', strtotime($post['dated']));
     }
     $datesSorted = array_unique($datesSorted);
     //krsort($datesSorted);
     usort($datesSorted, function ($a, $b) {
         return strtotime($a) < strtotime($b);
     });
     $settings = MetaDataWriter::getFileData($this->settingsFile);
     $base = $settings['url'];
     $base = rtrim($base, '/');
     foreach ($datesSorted as $date) {
         // show count of posts in each category
         /*
         $postCount = 0;
         foreach ($posts as $postItem) {
             if ($date === date('F Y', strtotime($postItem['dated']))) {
                 $postCount ++;
             }
         }
         */
         $archives .= '<li class="list-group-item archive_link"><a href="' . $base . '/archive/' . getSlugName($date) . '">' . $date . '</a></li>';
     }
     $archives .= '</ul>';
     return $archives;
 }
コード例 #2
0
ファイル: Post.php プロジェクト: sarfraznawaz2005/bloggercms
 public function getTotalPostsCountDrafts()
 {
     $counter = 0;
     $data = MetaDataWriter::getFileData($this->metaFile);
     foreach ($data as $post) {
         if ($post['status'] === self::STATUS_DRAFT) {
             $counter++;
         }
     }
     return $counter;
 }
コード例 #3
0
ファイル: Tag.php プロジェクト: sarfraznawaz2005/bloggercms
 public function getTotalTagsCount()
 {
     $data = MetaDataWriter::getFileData($this->metaFile);
     return count($data);
 }
コード例 #4
0
 public function getBlogURL()
 {
     $data = MetaDataWriter::getFileData($this->metaFile);
     return $data['url'];
 }