Esempio n. 1
0
 /**
  * Get approved Posts from the Aggregated Feed
  *
  * @return  mixed
  */
 public function getPosts()
 {
     // Get the approved posts
     $model = new Posts();
     $posts = $model->getPostsByStatus(1000, 0, 2);
     return $posts;
 }
Esempio n. 2
0
 /**
  * Generates RSS feed when called by URL
  *
  * @return  void
  */
 public function generateFeedTask()
 {
     // Get the approved posts
     $model = new Models\Posts();
     $posts = $model->getPostsByStatus(1000, 0, 2);
     // Set the mime encoding for the document
     Document::setType('feed');
     // Start a new feed object
     $doc = Document::instance();
     $doc->title = Config::get('sitename') . ' ' . Lang::txt('COM_FEEDAGGREGATOR_AGGREGATED_FEED');
     $doc->description = Lang::txt(Config::get('sitename') . ' ' . Lang::txt('COM_FEEDAGGREGATOR_AGGREGATED_FEED_SELECTED_READING'));
     $doc->copyright = Lang::txt(date("Y"), Config::get('sitename'));
     $doc->category = Lang::txt('COM_FEEDAGGREGATOR_EXTERNAL_CONTENT');
     // Start outputing results if any found
     if (count($posts) > 0) {
         foreach ($posts as $post) {
             // Load individual item creator class
             $item = new \Hubzero\Document\Type\Feed\Item();
             // sanitize ouput
             $item->title = preg_replace('/[\\x00-\\x1F\\x80-\\xFF]/', '', $post->title);
             $item->title = (string) html_entity_decode(strip_tags($item->title));
             // encapsulate link in unparseable
             $item->link = '<![CDATA[' . $post->link . ']]>';
             $item->date = date($post->created);
             // sanitize ouput
             $item->description = preg_replace('/[\\x00-\\x1F\\x80-\\xFF]/', '', $post->description);
             $item->description = (string) html_entity_decode(strip_tags($item->description, '<img>'));
             $doc->addItem($item);
         }
     }
 }