rss.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class Rss extends oxUBase
00007 {
00012     protected $_oRss = null;
00013 
00018     protected $_oChannel = null;
00019 
00024     protected $_aXmlDef = null;
00025 
00030     protected $_sThisTemplate = 'rss.tpl';
00031 
00038     public function init()
00039     {
00040         if (null !== ($iCur = oxConfig::getParameter('cur'))) {
00041             oxSession::setVar('currency', (int) $iCur);
00042         }
00043         parent::init();
00044         $this->_oRss = oxNew('oxRssFeed');
00045     }
00046 
00055     public function render()
00056     {
00057         parent::render();
00058 
00059         $oSmarty = oxUtilsView::getInstance()->getSmarty();
00060 
00061         foreach ( array_keys( $this->_aViewData ) as $sViewName ) {
00062             $oSmarty->assign_by_ref( $sViewName, $this->_aViewData[$sViewName] );
00063         }
00064 
00065         $oSmarty->assign('channel', $this->getChannel());
00066         $oSmarty->assign('xmldef', $this->getXmlDef());
00067 
00068         header( "Content-Type: text/xml; charset=".oxLang::getInstance()->translateString( "charset" ) );
00069         echo $this->_processOutput( $oSmarty->fetch('rss.tpl', $this->getViewId()) );
00070 
00071         // returned rss xml: no further processing
00072         exit (0);
00073     }
00074 
00082     protected function _processOutput( $sInput )
00083     {
00084         return getStr()->recodeEntities( $sInput );
00085     }
00086 
00093     public function topshop()
00094     {
00095         if (in_array('oxrss_topshop', $this->getConfig()->getConfigParam( 'aRssSelected' ))) {
00096             $this->_oRss->loadTopInShop();
00097         } else {
00098             error_404_handler();
00099         }
00100     }
00101 
00108     public function newarts()
00109     {
00110         if (in_array('oxrss_newest', $this->getConfig()->getConfigParam( 'aRssSelected' ))) {
00111             $this->_oRss->loadNewestArticles();
00112         } else {
00113             error_404_handler();
00114         }
00115     }
00116 
00123     public function catarts()
00124     {
00125         if (in_array('oxrss_categories', $this->getConfig()->getConfigParam( 'aRssSelected' ))) {
00126             $oCat = oxNew('oxCategory');
00127             if ($oCat->load(oxConfig::getParameter('cat'))) {
00128                 $this->_oRss->loadCategoryArticles($oCat);
00129             }
00130         } else {
00131             error_404_handler();
00132         }
00133     }
00134 
00141     public function searcharts()
00142     {
00143         if (in_array('oxrss_search', $this->getConfig()->getConfigParam( 'aRssSelected' ))) {
00144             $this->_oRss->loadSearchArticles( oxConfig::getParameter('searchparam', true), oxConfig::getParameter('searchcnid'), oxConfig::getParameter('searchvendor'), oxConfig::getParameter('searchmanufacturer'));
00145         } else {
00146             error_404_handler();
00147         }
00148     }
00149 
00156     public function recommlists()
00157     {
00158         if (in_array('oxrss_recommlists', $this->getConfig()->getConfigParam( 'aRssSelected' ))) {
00159             $oArticle = oxNew('oxarticle');
00160             if ($oArticle->load(oxConfig::getParameter('anid'))) {
00161                 $this->_oRss->loadRecommLists($oArticle);
00162                 return;
00163             }
00164         }
00165         error_404_handler();
00166     }
00167 
00174     public function recommlistarts()
00175     {
00176         if (in_array('oxrss_recommlistarts', $this->getConfig()->getConfigParam( 'aRssSelected' ))) {
00177             $oRecommList = oxNew('oxrecommlist');
00178             if ($oRecommList->load(oxConfig::getParameter('recommid'))) {
00179                 $this->_oRss->loadRecommListArticles($oRecommList);
00180                 return;
00181             }
00182         }
00183         error_404_handler();
00184     }
00185 
00192     public function bargain()
00193     {
00194         if (in_array('oxrss_bargain', $this->getConfig()->getConfigParam( 'aRssSelected' ))) {
00195             $this->_oRss->loadBargain();
00196         } else {
00197             error_404_handler();
00198         }
00199     }
00200 
00206     public function getChannel()
00207     {
00208         if ( $this->_oChannel === null ) {
00209             $this->_oChannel = false;
00210             if ( $this->_oRss ) {
00211                 $this->_oChannel = $this->_oRss->getChannel();
00212             }
00213         }
00214         return $this->_oChannel;
00215     }
00216 
00222     public function getXmlDef()
00223     {
00224         if ( $this->_aXmlDef === null ) {
00225             $this->_aXmlDef = false;
00226             $this->_aXmlDef = array('start'=>'<?xml', 'end'=>'?>');
00227         }
00228         return $this->_aXmlDef;
00229     }
00230 
00231 }

Generated on Mon Oct 26 20:07:20 2009 for OXID eShop CE by  doxygen 1.5.5