<?php

/**
 * @file
 * Provides Media RSS namespace, <channel> and <item> elements for Views RSS module.
 */

/**
 * Module installation path.
 */
define('VIEWS_RSS_MEDIA_PATH', drupal_get_path('module', 'views_rss_media'));

/**
 * Include file with field formatters.
 */
include_once VIEWS_RSS_MEDIA_PATH .'/views_rss_media.field.inc';

/**
 * Include file with all preprocess functions.
 */
include_once VIEWS_RSS_MEDIA_PATH .'/views_rss_media.inc';

/**
 * Implements hook_views_rss_namespaces().
 */
function views_rss_media_views_rss_namespaces() {
  $namespaces['media'] = array(
    'prefix' => 'xmlns',
    'uri' => 'http://search.yahoo.com/mrss/',
  );
  return $namespaces;
}

/**
 * Implements hook_views_rss_item_elements().
 */
function views_rss_media_views_rss_item_elements() {
  $elements['media:content'] = array(
    'description' => t('Contains the primary metadata entries needed to index and organize media content.'),
    'preprocess functions' => array('views_rss_media_preprocess_item_content'),
    'help' => 'http://www.rssboard.org/media-rss#media-content',
  );
  $elements['media:title'] = array(
    'description' => t('The title of the particular media object.'),
    'preprocess functions' => array(
      'views_rss_htmlspecialchars',
      'views_rss_media_preprocess_item_text',
    ),
    'help' => 'http://www.rssboard.org/media-rss#media-title',
  );
  $elements['media:description'] = array(
    'description' => t('Short description describing the media object typically a sentence in length.'),
    'preprocess functions' => array(
      'views_rss_htmlspecialchars',
      'views_rss_media_preprocess_item_text',
    ),
    'help' => 'http://www.rssboard.org/media-rss#media-description',
  );
  $elements['media:keywords'] = array(
    'description' => t('Highly relevant keywords describing the media object with typically a maximum of 10 words. The keywords and phrases should be comma-delimited.'),
    'help' => 'http://www.rssboard.org/media-rss#media-keywords',
  );
  $elements['media:thumbnail'] = array(
    'description' => t('Allows particular images to be used as representative images for the media object.'),
    'help' => 'http://www.rssboard.org/media-rss#media-thumbnails',
  );
  $elements['media:category'] = array(
    'description' => t('Allows a taxonomy to be set that gives an indication of the type of media content, and its particular contents.'),
    'preprocess functions' => array('views_rss_media_preprocess_item_category'),
    'help' => 'http://www.rssboard.org/media-rss#media-category',
  );
  return $elements;
}
