/[drupal]/contributions/modules/audio/contrib/feeds/audio_feeds.module
ViewVC logotype

Diff of /contributions/modules/audio/contrib/feeds/audio_feeds.module

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

revision 1.6, Thu Sep 25 23:18:08 2008 UTC revision 1.7, Mon Sep 14 04:40:57 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: audio_feeds.module,v 1.5 2008/05/25 17:21:27 drewish Exp $  // $Id: audio_feeds.module,v 1.6 2008/09/25 23:18:08 drewish Exp $
3    
4  /**  /**
5   * @file   * @file
6   * This module provides XSPF, M3U, and PLS feeds for a list of audio files.   * This module provides XSPF, M3U, and PLS feeds for attached audio nodes.
7   */   */
8    
9  /**  /**
# Line 11  Line 12 
12  function audio_feeds_help($section, $arg) {  function audio_feeds_help($section, $arg) {
13    switch ($section) {    switch ($section) {
14      case 'admin/help#audio_feeds':      case 'admin/help#audio_feeds':
15        return t('This module creates XSPF, M3U, and PLS audio feeds.');        return t('This module provides XSPF, M3U, and PLS audio feeds.');
16    }    }
17  }  }
18    
# Line 23  function audio_feeds_form_alter(&$form, Line 24  function audio_feeds_form_alter(&$form,
24    
25    switch ($form_id) {    switch ($form_id) {
26      case 'node_type_form':      case 'node_type_form':
27        if (isset($form['identity']['type']) && module_exists('audio_attach')) {        if (isset($form['identity']['type'])) {
28          $type = $form['#node_type']->type;          $type = $form['#node_type']->type;
29          $form['workflow']['audio_feeds_attach'] = array(          $form['workflow']['audio_feeds_attach'] = array(
30            '#type' => 'radios',            '#type' => 'radios',
31            '#title' => t('Audio Feeds'),            '#title' => t('Audio Feeds'),
32            '#default_value' => variable_get('audio_feeds_attach_'. $type, 0),            '#default_value' => variable_get('audio_feeds_attach_'. $type, 0),
33            '#options' => array(t('Disabled'), t('Enabled')),            '#options' => array(t('Disabled'), t('Enabled')),
34            '#description' => t('Should users be allowed to create XSPF, M3U, and PLS feeds of attached audio files?'),            '#description' => t('Provide XSPF, M3U, and PLS feeds for attached audio nodes.'),
35          );          );
36        }        }
37        break;        break;
# Line 45  function audio_feeds_link($type, $node = Line 46  function audio_feeds_link($type, $node =
46    global $user;    global $user;
47    $links = array();    $links = array();
48    
49    if (variable_get('audio_feeds_attach_'. $node->type, 0) && count($node->audio_attach) > 0) {    if (variable_get('audio_feeds_attach_'. $node->type, 0)) {
50      // Add audio playlist feed links      // Add audio playlist feed links.
51      $feed_links = variable_get('audio_feeds_feed_links', array('m3u', 'pls', 'xspf', 'popup'));      $feed_links = variable_get('audio_feeds_feed_links', array('m3u', 'pls', 'xspf', 'popup'));
52      foreach ($feed_links as $key => $type) {      foreach ($feed_links as $key => $type) {
53        switch ((string)$type) {        switch ((string)$type) {
54          case 'm3u':          case 'm3u':
55            $links['audio_feeds_m3u_link'] = array(            $links['audio_feeds_m3u_link'] = array(
56               'title' => t('M3U'),              'title' => t('M3U'),
57               'href' => "node/$node->nid/m3u",              'href' => "node/$node->nid/m3u",
58               'attributes' => array('title' => t('Stream M3U feed')),              'attributes' => array('title' => t('Stream M3U feed')),
59            );            );
60            break;            break;
61          case 'pls':          case 'pls':
62            $links['audio_feeds_pls_link'] = array(            $links['audio_feeds_pls_link'] = array(
63               'title' => t('PLS'),              'title' => t('PLS'),
64               'href' => "node/$node->nid/pls",              'href' => "node/$node->nid/pls",
65               'attributes' => array('title' => t('Stream PLS feed')),              'attributes' => array('title' => t('Stream PLS feed')),
66            );            );
67            break;            break;
68          case 'xspf':          case 'xspf':
69            $links['audio_feeds_xspf_link'] = array(            $links['audio_feeds_xspf_link'] = array(
70               'title' => t('XSPF'),              'title' => t('XSPF'),
71               'href' => "node/$node->nid/xspf",              'href' => "node/$node->nid/xspf",
72               'attributes' => array('title' => t('Shareable XSPF feed')),              'attributes' => array('title' => t('Shareable XSPF feed')),
73            );            );
74            break;            break;
         default:  
           break;  
75        }        }
76      }      }
77    }    }
# Line 84  function audio_feeds_link($type, $node = Line 83  function audio_feeds_link($type, $node =
83   * Implementation of hook_menu().   * Implementation of hook_menu().
84   */   */
85  function audio_feeds_menu() {  function audio_feeds_menu() {
   // FIXME: This snippet isn't preserved by this new menu code:  
   // if (variable_get('audio_feeds_attach_'. $node->type, 0)) {  
86    $items = array();    $items = array();
87    
88    $items['node/%node/xspf'] = array(    $items['node/%node/xspf'] = array(
89      'title' => 'XSPF',      'title' => 'XSPF',
90      'page callback' => 'audio_feeds_xspf',      'page callback' => 'audio_feeds_xspf',
91      'page arguments' => array(1),      'page arguments' => array(1),
92        'access callback' => 'audio_feeds_access',
93        'access arguments' => array(1),
94      'file' => 'audio_feeds.feeds.inc',      'file' => 'audio_feeds.feeds.inc',
95      'type' => MENU_CALLBACK,      'type' => MENU_CALLBACK,
96    );    );
# Line 99  function audio_feeds_menu() { Line 98  function audio_feeds_menu() {
98      'title' => 'M3U',      'title' => 'M3U',
99      'page callback' => 'audio_feeds_m3u',      'page callback' => 'audio_feeds_m3u',
100      'page arguments' => array(1),      'page arguments' => array(1),
101        'access callback' => 'audio_feeds_access',
102        'access arguments' => array(1),
103      'file' => 'audio_feeds.feeds.inc',      'file' => 'audio_feeds.feeds.inc',
104      'type' => MENU_CALLBACK,      'type' => MENU_CALLBACK,
105    );    );
# Line 106  function audio_feeds_menu() { Line 107  function audio_feeds_menu() {
107      'title' => 'PLS',      'title' => 'PLS',
108      'page callback' => 'audio_feeds_pls',      'page callback' => 'audio_feeds_pls',
109      'page arguments' => array(1),      'page arguments' => array(1),
110        'access callback' => 'audio_feeds_access',
111        'access arguments' => array(1),
112      'file' => 'audio_feeds.feeds.inc',      'file' => 'audio_feeds.feeds.inc',
113      'type' => MENU_CALLBACK,      'type' => MENU_CALLBACK,
114    );    );
115    
116    return $items;    return $items;
117  }  }
118    
119    /**
120     * Menu access callback.
121     */
122    function audio_feeds_access($node) {
123      return variable_get('audio_feeds_attach_'. $node->type, 0);
124    }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.2