Exemple #1
0
     $values = array();
     $values['channel'] = array();
     // set channel information
     $values['channel']['title'] = $item['full_name'] ? $item['full_name'] : $item['nick_name'];
     $values['channel']['link'] = Users::get_permalink($item);
     $values['channel']['description'] = $item['introduction'];
     // the image for this channel
     if (isset($context['powered_by_image']) && $context['powered_by_image']) {
         $values['channel']['image'] = $context['url_to_home'] . $context['url_to_root'] . $context['powered_by_image'];
     }
     // the list of newest pages
     $values['items'] = (array) Articles::list_for_author_by('publication', $item['id'], 0, 50, 'feed');
     // make a text
     include_once '../services/codec.php';
     include_once '../services/rss_codec.php';
     $result = rss_Codec::encode($values);
     $status = @$result[0];
     $text = @$result[1];
     // save in cache for the next request
     Cache::put($cache_id, $text, 'articles');
 }
 //
 // transfer to the user agent
 //
 // handle the output correctly
 render_raw('text/xml; charset=' . $context['charset']);
 // suggest a name on download
 if (!headers_sent()) {
     $file_name = utf8::to_ascii($context['site_name'] . '.section.' . $item['id'] . '.rss.xml');
     Safe::header('Content-Disposition: inline; filename="' . str_replace('"', '', $file_name) . '"');
 }
Exemple #2
0
 /**
  * build a response according to the RSS 2.0 specification
  *
  * @param mixed transmitted values, if any
  * @param string name of the remote service, if any
  * @return an array of which the first value indicates call success or failure
  * @see services/codec.php
  */
 function export_response($values = NULL, $service = NULL)
 {
     // do the job
     return rss_Codec::encode($values);
 }