You are here

function views_rss_get in Views RSS 7.2

Same name and namespace in other branches
  1. 8.3 views_rss.module \views_rss_get()
  2. 8.2 views_rss.module \views_rss_get()
  3. 6.2 views_rss.module \views_rss_get()

Returns an array of item elements defined by other modules with hook_views_rss_item_elements() and optionally altered with hook_views_rss_item_elements_alter() implementations.

7 calls to views_rss_get()
template_preprocess_views_view_views_rss in theme/theme.inc
Template preprocessor for views-view-views-rss.tpl.php.
views_rss_core_views_query_alter in modules/views_rss_core/views_rss_core.module
Implements hook_views_query_alter().
views_rss_plugin_style_fields::map_rows in views/views_rss_plugin_style_fields.inc
Map views row result to an RSS item.
views_rss_plugin_style_fields::options_form in views/views_rss_plugin_style_fields.inc
Provide a form for setting options.
views_rss_plugin_style_fields::option_definition in views/views_rss_plugin_style_fields.inc
Information about options for all kinds of purposes will be held here.

... See full list

File

./views_rss.module, line 43
Module providing fields-based views style plugin for RSS feed generation.

Code

function views_rss_get($key, $rebuild = FALSE) {
  static $data = array();
  if (!isset($data[$key]) || empty($data[$key]) || $rebuild === TRUE) {
    $cid = 'views_rss:' . $key;
    $cached = cache_get($cid, 'cache_views');
    if (is_object($cached) && isset($cached->data) && $rebuild === FALSE) {
      $data[$key] = $cached->data;
    }
    else {

      // Fetch item elements provided by other modules. We need to manually call
      // each module so that we can know which module a given item came from.
      $data[$key] = array();
      $hook_name = 'views_rss_' . $key;
      foreach (module_implements($hook_name) as $module) {
        $module_data = call_user_func($module . '_' . $hook_name);
        if (isset($module_data) && is_array($module_data)) {
          $data[$key][$module] = $module_data;
        }
      }

      // Add namespaces not defined by any hook_views_rss_namespaces(),
      // but used in any of defined <channel> or <item> elements.
      // Let's also add "xmlns" prefix by default to such namespaces.
      $function = '_views_rss_process_' . $key;
      if (function_exists($function)) {
        $data[$key] = $function($data[$key]);
      }

      // Allow other modules to alter obtained item elements.
      drupal_alter($hook_name, $data[$key]);

      // Store it infinitely in cache (rebuild only on cache clear).
      cache_set($cid, $data[$key], 'cache_views');
    }
  }
  return $data[$key];
}