*/ class Fishpig_Wordpress_Block_Archive_View extends Fishpig_Wordpress_Block_Post_List_Wrapper_Abstract { /** * Caches and returns the archive model * * @return Fishpig_Wordpress_Model_Archive */ public function getArchive() { if (!$this->hasArchive()) { $this->setArchive(Mage::registry('wordpress_archive')); } return $this->getData('archive'); } public function getArchiveId() { if ($archive = $this->getArchive()) { return $archive->getId(); } } /** * Generates and returns the collection of posts * * @return Fishpig_Wordpress_Model_Mysql4_Post_Collection */ protected function _getPostCollection() { if (is_null($this->_postCollection)) { $this->_postCollection = parent::_getPostCollection() ->addArchiveDateFilter($this->getArchiveId(), $this->getArchive()->getIsDaily()); } return $this->_postCollection; } /** * Split a date by spaces and translate * * @param string $date * @param string $splitter = ' ' * @return string */ public function translateDate($date, $splitter = ' ') { $dates = explode($splitter, $date); foreach($dates as $it => $part) { $dates[$it] = $this->__($part); } return implode($splitter, $dates); } }