Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 6th, 2012  |  syntax: PHP  |  size: 1.75 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.         public function feed() {
  2.                 $content = array();
  3.                 foreach ( $this->class_rss->rss_channels as $channel_id => $channel_data ) {
  4.                         if ( is_array( $this->class_rss->rss_items[ $channel_id ] ) and count ($this->class_rss->rss_items[ $channel_id ] ) ) {
  5.                                 foreach( $this->class_rss->rss_items[ $channel_id ] as $item_data ) {
  6.                                         //-----------------------------------------
  7.                                         // Check basic data
  8.                                         //-----------------------------------------
  9.                                        
  10.                                         $item_data['content']   = $item_data['content']   ? $item_data['content']  : $item_data['description'];
  11.                                         $item_data['url']       = $item_data['link'];
  12.                                         $item_data['date']      = intval($item_data['unixdate'])  ? intval($item_data['unixdate']) : time();
  13.                                        
  14.                                         //-----------------------------------------
  15.                                         // Convert charset
  16.                                         //-----------------------------------------
  17.                                        
  18.                                         if ( $this->class_rss->doc_type != $this->class_rss->orig_doc_type )
  19.                                         {
  20.                                                 $item_data['title']   = IPSText::convertCharsets( $item_data['title']  , "UTF-8", IPS_DOC_CHAR_SET );
  21.                                                 $item_data['content'] = IPSText::convertCharsets( $item_data['content'], "UTF-8", IPS_DOC_CHAR_SET );
  22.                                         }
  23.                                        
  24.                                         //-----------------------------------------
  25.                                         // Dates
  26.                                         //-----------------------------------------
  27.                                        
  28.                                         if ( $item_data['date'] < 1 )
  29.                                         {
  30.                                                 $item_data['date'] = time();
  31.                                         }
  32.                                         else if ( $item_data['date'] > time() )
  33.                                         {
  34.                                                 $item_data['date'] = time();
  35.                                         }
  36.                                        
  37.                                         //-----------------------------------------
  38.                                         // Got stuff?
  39.                                         //-----------------------------------------
  40.                                        
  41.                                         if ( ! $item_data['title'] OR ! $item_data['content'] )
  42.                                         {
  43.                                                 continue;
  44.                                         }
  45.                                                
  46.                                         $this->content[]        = $item_data;
  47.                                 }
  48.                         }
  49.                 }
  50.         }