| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 | 
							- <?php
 
- /**
 
-  *
 
-  * Cube Framework $Id$ UdE+MOk0fNVzuT+ELYHRzTd/YUtDMbEhFzp7goBrq+M=
 
-  *
 
-  * @link        http://codecu.be/framework
 
-  * @copyright   Copyright (c) 2015 CodeCube SRL
 
-  * @license     http://codecu.be/framework/license Commercial License
 
-  *
 
-  * @version     1.6
 
-  */
 
- /**
 
-  * abstract feed class
 
-  */
 
- namespace Cube\Feed;
 
- abstract class AbstractFeed
 
- {
 
-     /**
 
-      *
 
-      * feed entries
 
-      *
 
-      * @var array
 
-      */
 
-     protected $_entries = array();
 
-     /**
 
-      *
 
-      * channels
 
-      *
 
-      * @var array
 
-      */
 
-     protected $_channels = array();
 
-     /**
 
-      * @param array $entries
 
-      *
 
-      * @return $this
 
-      */
 
-     public function setEntries($entries)
 
-     {
 
-         foreach ((array)$entries as $entry) {
 
-             $this->addEntry($entry);
 
-         }
 
-         return $this;
 
-     }
 
-     /**
 
-      *
 
-      * add entry to entries array
 
-      *
 
-      * @param \Cube\Feed\Entry $entry
 
-      *
 
-      * @return $this
 
-      */
 
-     public function addEntry(Entry $entry)
 
-     {
 
-         $this->_entries[] = $entry;
 
-         return $this;
 
-     }
 
-     /**
 
-      * @return array
 
-      */
 
-     public function getEntries()
 
-     {
 
-         return $this->_entries;
 
-     }
 
-     /**
 
-      *
 
-      * clear entries array
 
-      *
 
-      * @return $this
 
-      */
 
-     public function clearEntries()
 
-     {
 
-         $this->_entries = array();
 
-         return $this;
 
-     }
 
-     /**
 
-      *
 
-      * set channels
 
-      *
 
-      * @param array $channels
 
-      *
 
-      * @return $this
 
-      */
 
-     public function setChannels($channels)
 
-     {
 
-         foreach ((array)$channels as $key => $value) {
 
-             $this->addChannel($key, $value);
 
-         }
 
-         return $this;
 
-     }
 
-     /**
 
-      *
 
-      * add channel
 
-      *
 
-      * @param string $key
 
-      * @param string $value
 
-      *
 
-      * @return $this
 
-      */
 
-     public function addChannel($key, $value)
 
-     {
 
-         $this->_channels[$key] = $this->_formatString($value);
 
-         return $this;
 
-     }
 
-     /**
 
-      *
 
-      * get channels
 
-      *
 
-      * @return array
 
-      */
 
-     public function getChannels()
 
-     {
 
-         return $this->_channels;
 
-     }
 
-     /**
 
-      *
 
-      * render one channel/element
 
-      *
 
-      * @param array $array
 
-      *
 
-      * @return null|string
 
-      */
 
-     protected function _renderArray($array)
 
-     {
 
-         $output = '';
 
-         foreach ($array as $key => $value) {
 
-             if (is_array($value)) {
 
-                 $output .= PHP_EOL . "<$key>" . $this->_renderArray($value) . "</$key>" . PHP_EOL;
 
-             }
 
-             else {
 
-                 $output .= PHP_EOL . "<$key>" . $this->_formatString($value) . "</$key>" . PHP_EOL;
 
-             }
 
-         }
 
-         return $output;
 
-     }
 
-     /**
 
-      *
 
-      * format string
 
-      *
 
-      * @param mixed $input
 
-      *
 
-      * @return string
 
-      */
 
-     protected function _formatString($input)
 
-     {
 
-         if (is_array($input)) {
 
-             return $input;
 
-         }
 
-         return strip_tags(
 
-             str_ireplace(
 
-                 array('&'), array(' '), $input));
 
- //        return strip_tags(
 
- //            str_ireplace(
 
- //                array('&', ''', '"', '<', '>', ' '), array('&', "'", '"', '<', '>', ' '), $string));
 
-     }
 
-     /**
 
-      *
 
-      * generate feed
 
-      *
 
-      * @return mixed
 
-      */
 
-     abstract function generateFeed();
 
- } 
 
 
  |