protected function _make_feed_from_news($title, $link, $news, $context = null) { // setlocale(LC_TIME, 'it_IT'); sfLoader::loadHelpers(array('Tag', 'Url', 'DeppNews')); $feed = new sfRss2ExtendedFeed(); $feed->initialize(array('title' => $title, 'link' => url_for($link, true), 'feedUrl' => $this->getRequest()->getURI(), 'siteUrl' => 'http://' . sfConfig::get('sf_site_url'), 'image' => 'http://' . sfConfig::get('sf_site_url') . '/images/logo-openparlamento.png', 'language' => 'it', 'authorEmail' => '*****@*****.**', 'authorName' => 'Openparlamento', 'description' => "Openparlamento.it - il progetto Openpolis per la trasparenza del Parlamento", 'sy_updatePeriod' => 'daily', 'sy_updateFrequency' => '1', 'sy_updateBase' => '2000-01-01T12:00+00:00')); foreach ($news as $n) { list($title, $description) = news_title_descr($n, null, $context); $date_ts = $n->getDate(null); if ($title == '' && $description == '') { continue; } $item = new sfRss2ExtendedItem(); $item->initialize(array('title' => $title, 'link' => url_for($link, true), 'permalink' => url_for($link, true) . '#' . strftime('%Y%m%d%H', $date_ts), 'pubDate' => date("U", $date_ts), 'uniqueId' => $date_ts, 'description' => $description, 'authorEmail' => '*****@*****.**', 'authorName' => 'Openparlamento')); $feed->addItem($item); } return $feed; }
public function executeCommentsFeed() { sfLoader::loadHelpers(array('I18N', 'Tag', 'Url')); $comments = sfSimpleBlogCommentPeer::getRecent($this->getRequestParameter('nb', sfConfig::get('app_sfSimpleBlog_feed_count', 5))); $feed = new sfRss2ExtendedFeed(); $feed->initialize(array('title' => __('Comments from %1%', array('%1%' => sfConfig::get('app_sfSimpleBlog_title', ''))), 'link' => $this->getController()->genUrl('sfSimpleBlog/index'), 'siteUrl' => 'http://' . sfConfig::get('sf_site_url'), 'image' => 'http://' . sfConfig::get('sf_site_url') . '/images/logo-openparlamento.png', 'feedUrl' => $this->getRequest()->getURI(), 'language' => 'it', 'copyright' => "Licenza Creative Commons 'Attribuzione-Non commerciale-Non opere derivate 2.5 Generico'", 'authorEmail' => '*****@*****.**', 'authorName' => 'Openparlamento', 'description' => "Openparlamento.it - il progetto Openpolis per la trasparenza del Parlamento", 'ttl' => 1440, 'sy_updatePeriod' => 'daily', 'sy_updateFrequency' => '4', 'sy_updateBase' => '2000-01-01T12:00+00:00')); foreach ($comments as $comment) { $post = $comment->getsfSimpleBlogPost(); $item = new sfRss2ExtendedItem(); $item->initialize(array('title' => "Commento sul post: " . $post->getTitle(), 'link' => sfSimpleBlogTools::generatePostUri($post, null), 'authorEmail' => '*****@*****.**', 'authorName' => 'Openparlamento', 'pubDate' => $comment->getCreatedAt('U'), 'permalink' => url_for('@blog_article?stripped_title=' . $post->getStrippedTitle(), true) . "#" . $comment->getId(), 'description' => $comment->getContent())); $feed->addItem($item); } $this->setLayout(false); $this->response->setContentType('text/xml'); $this->response->setContent($feed->asXml()); return sfView::NONE; }