/[drupal]/contributions/modules/ffpc/ffpc.module
ViewVC logotype

Contents of /contributions/modules/ffpc/ffpc.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (show annotations) (download) (as text)
Mon Oct 6 22:20:20 2008 UTC (13 months, 3 weeks ago) by mfer
Branch: MAIN
CVS Tags: DRUPAL-6--0-7, HEAD
Changes since 1.4: +61 -0 lines
File MIME type: text/x-php
Moved template function fromobject.inc to .module file.
1 <?php
2
3 /**
4 * Implementation of hook_views_api().
5 */
6 function ffpc_views_api() {
7 return array('api' => 2);
8 }
9
10 function template_preprocess_ffpc_view_podcast_feed(&$vars) {
11 global $base_url;
12 global $language;
13
14 $view = &$vars['view'];
15 $options = &$vars['options'];
16 $items = &$vars['rows'];
17 $style = &$view->style_plugin;
18
19 if (!empty($options['mission_description'])) {
20 $description = variable_get('site_mission', '');
21 }
22 else {
23 $description = $options['description'];
24 }
25
26 if ($view->display_handler->get_option('sitename_title')) {
27 $title = variable_get('site_name', 'Drupal');
28 if ($slogan = variable_get('site_slogan', '')) {
29 $title .= ' - ' . $slogan;
30 }
31 }
32 else {
33 $title = $view->get_title();
34 }
35
36 // Figure out which display which has a path we're using for this feed. If there isn't
37 // one, use the global $base_url
38 $link_display_id = $view->display_handler->get_link_display();
39 if ($link_display_id && !empty($view->display[$link_display_id])) {
40 $path = $view->display[$link_display_id]->handler->get_path();
41 }
42
43 if ($path) {
44 $path = $view->get_url(NULL, $path);
45 $url_options = array('absolute' => TRUE);
46 if (!empty($view->exposed_raw_input)) {
47 $url_options['query'] = $view->exposed_raw_input;
48 }
49
50 // Compare the link to the default home page; if it's the default home page, just use $base_url.
51 if ($path == variable_get('site_frontpage', 'node')) {
52 $path = '';
53 }
54
55 $vars['link'] = check_url(url($path, $url_options));
56 }
57
58 // This is where we add additional elements to the podcast.
59 $args = array(
60 'itunes:owner' => array(
61 'itunes:email' => variable_get('site_mail', ini_get('sendmail_from')),
62 ),
63 );
64
65 $vars['namespaces'] = drupal_attributes($style->namespaces);
66 $vars['channel'] = format_rss_channel($title, $vars['link'], $description, $items, $language->language, $args);
67
68 drupal_set_header('Content-Type: application/rss+xml; charset=utf-8');
69 }

  ViewVC Help
Powered by ViewVC 1.1.2