| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: audio_feeds.module,v 1.8 2009/11/25 19:35:37 drewish Exp $ 3 4 /** 5 * @file 6 * This module provides XSPF, M3U, and PLS feeds for attached audio nodes. 7 */ 8 9 /** 10 * Implementation of hook_help(). 11 */ 12 function audio_feeds_help($section, $arg) { 13 switch ($section) { 14 case 'admin/help#audio_feeds': 15 return t('This module provides XSPF, M3U, and PLS audio feeds.'); 16 } 17 } 18 19 /** 20 * Implementation of hook_form_alter(). 21 */ 22 function audio_feeds_form_alter(&$form, &$form_state, $form_id) { 23 global $user; 24 25 switch ($form_id) { 26 case 'node_type_form': 27 if (isset($form['identity']['type'])) { 28 $type = $form['#node_type']->type; 29 $form['workflow']['audio_feeds_attach'] = array( 30 '#type' => 'radios', 31 '#title' => t('Audio Feeds'), 32 '#default_value' => variable_get('audio_feeds_attach_'. $type, 0), 33 '#options' => array(t('Disabled'), t('Enabled')), 34 '#description' => t('Provide XSPF, M3U, and PLS feeds for attached audio nodes.'), 35 ); 36 } 37 break; 38 } 39 } 40 41 /** 42 * Implementation of hook_link(). 43 */ 44 function audio_feeds_link($type, $node = NULL, $teaser = FALSE) { 45 global $base_url; 46 global $user; 47 $links = array(); 48 49 if (variable_get('audio_feeds_attach_'. $node->type, 0)) { 50 // Add audio playlist feed links. 51 $feed_links = variable_get('audio_feeds_feed_links', array('m3u', 'pls', 'xspf')); 52 foreach ($feed_links as $key => $type) { 53 switch ((string)$type) { 54 case 'm3u': 55 $links['audio_feeds_m3u_link'] = array( 56 'title' => t('M3U'), 57 'href' => "node/$node->nid/m3u", 58 'attributes' => array('title' => t('Stream M3U feed')), 59 ); 60 break; 61 case 'pls': 62 $links['audio_feeds_pls_link'] = array( 63 'title' => t('PLS'), 64 'href' => "node/$node->nid/pls", 65 'attributes' => array('title' => t('Stream PLS feed')), 66 ); 67 break; 68 case 'xspf': 69 $links['audio_feeds_xspf_link'] = array( 70 'title' => t('XSPF'), 71 'href' => "node/$node->nid/xspf", 72 'attributes' => array('title' => t('Shareable XSPF feed')), 73 ); 74 break; 75 } 76 } 77 } 78 79 return $links; 80 } 81 82 /** 83 * Implementation of hook_menu(). 84 */ 85 function audio_feeds_menu() { 86 $items = array(); 87 88 $items['node/%node/xspf'] = array( 89 'title' => 'XSPF', 90 'page callback' => 'audio_feeds_xspf', 91 'page arguments' => array(1), 92 'access callback' => 'audio_feeds_access', 93 'access arguments' => array(1), 94 'file' => 'audio_feeds.feeds.inc', 95 'type' => MENU_CALLBACK, 96 ); 97 $items['node/%node/m3u'] = array( 98 'title' => 'M3U', 99 'page callback' => 'audio_feeds_m3u', 100 'page arguments' => array(1), 101 'access callback' => 'audio_feeds_access', 102 'access arguments' => array(1), 103 'file' => 'audio_feeds.feeds.inc', 104 'type' => MENU_CALLBACK, 105 ); 106 $items['node/%node/pls'] = array( 107 'title' => 'PLS', 108 'page callback' => 'audio_feeds_pls', 109 'page arguments' => array(1), 110 'access callback' => 'audio_feeds_access', 111 'access arguments' => array(1), 112 'file' => 'audio_feeds.feeds.inc', 113 'type' => MENU_CALLBACK, 114 ); 115 $items['admin/settings/audio/feeds'] = array( 116 'title' => 'Feeds', 117 'page callback' => 'drupal_get_form', 118 'page arguments' => array('audio_feeds_admin'), 119 'access arguments' => array('administer audio'), 120 'file' => 'audio_feeds.admin.inc', 121 'type' => MENU_LOCAL_TASK, 122 ); 123 124 return $items; 125 } 126 127 /** 128 * Menu access callback. 129 */ 130 function audio_feeds_access($node) { 131 return variable_get('audio_feeds_attach_'. $node->type, 0); 132 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |