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; }
public function getTotalPostsCountDrafts() { $counter = 0; $data = MetaDataWriter::getFileData($this->metaFile); foreach ($data as $post) { if ($post['status'] === self::STATUS_DRAFT) { $counter++; } } return $counter; }
public function getTotalTagsCount() { $data = MetaDataWriter::getFileData($this->metaFile); return count($data); }
public function getBlogURL() { $data = MetaDataWriter::getFileData($this->metaFile); return $data['url']; }