public function addEntry($photo, $path, $enclosure, $content = "") { $entry = new Zend_Feed_Builder_Entry($photo->title, $this->_link . $path, $photo->description); $entry->setId($photo->id); $entry->setContent($content); $date = new Zend_Date($photo->created_on); $entry->setLastUpdate($date->get(Zend_Date::TIMESTAMP)); $entry->addEnclosure($this->_link . $enclosure, 'image/jpeg'); // TODO: Fix types $this->_entries[] = $entry; return $this; }
/** * Create the array of article entries * * @param array $data * @throws Zend_Feed_Builder_Exception * @return void */ protected function _createEntries(array $data) { foreach ($data as $row) { $mandatories = array('title', 'link', 'description'); foreach ($mandatories as $mandatory) { if (!isset($row[$mandatory])) { /** * @see Zend_Feed_Builder_Exception */ require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("{$mandatory} key is missing"); } } $entry = new Zend_Feed_Builder_Entry($row['title'], $row['link'], $row['description']); if (isset($row['author'])) { $entry->setAuthor($row['author']); } if (isset($row['guid'])) { $entry->setId($row['guid']); } if (isset($row['content'])) { $entry->setContent($row['content']); } if (isset($row['lastUpdate'])) { $entry->setLastUpdate($row['lastUpdate']); } if (isset($row['comments'])) { $entry->setCommentsUrl($row['comments']); } if (isset($row['commentRss'])) { $entry->setCommentsRssUrl($row['commentRss']); } if (isset($row['source'])) { $mandatories = array('title', 'url'); foreach ($mandatories as $mandatory) { if (!isset($row['source'][$mandatory])) { /** * @see Zend_Feed_Builder_Exception */ require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("{$mandatory} key of source property is missing"); } } $entry->setSource($row['source']['title'], $row['source']['url']); } if (isset($row['category'])) { $entry->setCategories($row['category']); } if (isset($row['enclosure'])) { $entry->setEnclosures($row['enclosure']); } $this->_entries[] = $entry; } }