You are here

function views_plugin_style_rss_fields::process_fields in Views RSS 6

1 call to views_plugin_style_rss_fields::process_fields()
views_plugin_style_rss_fields::map_rows in views/views_plugin_style_rss_fields.inc
Map views row result to an RSS item.

File

views/views_plugin_style_rss_fields.inc, line 216

Class

views_plugin_style_rss_fields
Extend the view_plugin_style class to provide an RSS view style.

Code

function process_fields($rows) {
  $items = array();
  foreach ($rows as $id => $row) {
    $item = array();
    foreach (array_merge($this->options['fields'], $this->options['georss']) as $key => $val) {
      if (!isset($this->view->field[$val])) {
        continue;
      }
      switch ($key) {
        case 'description':
          $item[$key] = check_plain(htmlspecialchars_decode($row[$val], ENT_QUOTES));
          break;
        case 'category':
          $item[$key] = array_map('trim', explode(',', strip_tags($row[$val])));
          break;
        case 'lat':
        case 'lon':
          if (isset($row['lat']) && is_numeric($row['lat']) && isset($row['lon']) && is_numeric($row['lon'])) {
            $item['georss:point'] = $row['lat'] . ' ' . $row['lon'];
          }
          break;
        case 'featureName':
          $item['georss:' . $key] = $row[$val];
          break;
        default:
          $item[$key] = $row[$val];
      }
    }
    $item['source'] = theme('views_rss_feed_item_source', $this->view);
    $items[] = $item;
  }
  return $items;
}