protected function _formatNews($item) { if ($this->name == 'SYSTEM.rss') { $stitle = htmlspecialchars($item->title, ENT_QUOTES); $sdescription = htmlspecialchars($item->description, ENT_QUOTES); $ssummary = htmlspecialchars($item->summary, ENT_QUOTES); } else { $stitle = $item->title; $sdescription = $item->description; $ssummary = $item->summary; } $slink = $item->link; $this->_buffer = str_replace('{itemid}', $item->id, $this->_buffer); $this->_buffer = str_replace('{link}', $slink, $this->_buffer); $this->_buffer = str_replace('{link_encoded}', rawurlencode(str_replace('&', '&', $slink)), $this->_buffer); if ($item->pubdate != -1) { if ($this->name == 'SYSTEM.rss') { $pubdate = date('r', $item->pubdate); } else { $pubdate = zf_transcode(strftime(ZF_PUBDATEFORMAT, date($item->pubdate))); } } else { $pubdate = $item->pubdate; } $this->_buffer = str_replace('{pubdate}', $pubdate, $this->_buffer); $this->_buffer = str_replace('{relativedate}', getRelativeTime($item->pubdate), $this->_buffer); $this->_buffer = str_replace('{title}', $stitle, $this->_buffer); $newvalue = $item->isNew ? ZF_ISNEW_STRING : ''; $this->_buffer = str_replace('{isnew}', $newvalue, $this->_buffer); /* description */ $this->_buffer = str_replace('{description}', $sdescription, $this->_buffer); $this->_formatEnclosures($item); $hasSummary = strpos($this->_buffer, '{summary}'); $this->_buffer = str_replace('{summary}', $ssummary, $this->_buffer); $zfarticleurl = '?q=item&zftemplate=' . $this->name . '&itemid=' . $item->id; $this->_buffer = str_replace('{articleurl}', htmlentities($zfarticleurl), $this->_buffer); $zfdownloadcontent = '?q=download-item&zftemplate=' . $this->name . '&itemid=' . $item->id; $this->_buffer = str_replace('{download}', htmlentities($zfdownloadcontent), $this->_buffer); // for RSS feeds only $this->_buffer = str_replace('{guid}', md5($slink), $this->_buffer); }
protected function renderNewsItems($feed, $params) { zf_debug('Rendering Newsitems of ' . (isset($feed->subscriptionId) ? $feed->subscriptionId : 'aggregated feed') . ' in TemplateView', DBG_RENDER); $currentDay = ''; //$today = date('m.d.Y'); //$yesterday = date('m.d.Y',strtotime("-1 day")); //foreach item $itemsList =& $feed->items; zf_debug(sizeof($itemsList) . ' items to render', DBG_RENDER); $groupbyday = $params['groupbyday']; if ($groupbyday) { zf_debug("group by day is set", DBG_RENDER); } foreach ($itemsList as $item) { /* two ways of rendering: - group by day, we use a special template part, and separate each day - normal, use the regular news template */ if ($groupbyday) { $day = zf_transcode(strftime(ZF_DATEFORMAT, date($item->pubdate))); /* * non locale-friendly way... $day_std = date('m.d.Y', $item['date_timestamp']); if ($day_std == $today) { $day = "Today"; } if ($day_std == $yesterday) { $day = "Yesterday"; }*/ if ($currentDay != $day && ZF_GROUP_BY_DAY == 'yes') { // if not the first time that we enter here if ($currentDay != "") { // terminate properly our day and start a new one $this->template->printDayFooter($currentDay); } $currentDay = $day; //echo zf_formatTemplate(array(), $day, array(), $template->newsDay, false); $this->template->printDay($currentDay); } zf_debug("print news by date", DBG_RENDER); $this->template->printNewsByDate($item); } else { zf_debug("print news", DBG_RENDER); $this->template->printNews($item); } } // end foreach if ($params['groupbyday'] && ZF_GROUP_BY_DAY == 'yes') { // terminate the last day we used $this->template->printDayFooter($currentDay); } }