[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/audio/players/ -> button.inc (source)

   1  <?php
   2  // $Id: button.inc,v 1.7 2008/01/23 04:35:00 drewish Exp $
   3  
   4  function audio_button_audio_player() {
   5    $items['button'] = array(
   6      'module'      => 'audio',
   7      'title'       => t('XSPF Web Music Player - Button'),
   8      'description' => t('Cute button player...'),
   9      'url'         => t('http://musicplayer.sourceforge.net/'),
  10      'preview'     => 'players/button.png',
  11      'formats'     => array('wav', 'mp3'),
  12      'theme_node'  => 'audio_button_node_player',
  13    );
  14    return $items;
  15  }
  16  
  17  /**
  18   * The default mp3 player is the flash XSPF player. If you want to override
  19   * this behavior you can do so at the theme level.
  20   *
  21   * A couple of options that may be of interest:
  22   * - backgroud color. If it's not specified, it'll default to transparent.
  23   *    'b_bgcolor' => "000000"
  24   * - foregroung (border and icon) color.
  25   *    'b_fgcolor' => "ffffff"
  26   * - foreground color by state. The order is: connecting (spinner),
  27   *   ready (arrow), playing (square), and ??? (not sure). The b_fgcolor value
  28   *   will be used for any ommitted values.
  29   *    'b_colors' => "ff0000,,00000ff,000000",
  30   *
  31   * @param $node
  32   *   node object
  33   * @param $options
  34   *   array of options to pass to the player. This allows you to override the
  35   *   any parameter passed to the player including colors, title,
  36   * @return
  37   *   HTML string with a flash player
  38   */
  39  function theme_audio_button_node_player($node, $options = array()) {
  40    // make sure it's compatible with the flash player
  41    if (!audio_is_flash_playable($node)) {
  42      return NULL;
  43    }
  44  
  45    $options['song_url'] = check_url($node->url_play);
  46    $options['song_title'] = check_plain($node->audio_tags['title']);
  47  
  48    $url = base_path() . drupal_get_path('module', 'audio') .'/players/button.swf';
  49    $flashvars = audio_query_string_encode($options);
  50  
  51  $output = <<<EOT
  52  <object type="application/x-shockwave-flash" data="$url" width="17" height="17">
  53    <param name="movie" value="$url" />
  54    <param name="wmode" value="transparent" />
  55    <param name="quality" value="high" />
  56    <param name="FlashVars" value="$flashvars" />
  57    <embed src="$url" flashvars="$flashvars" width="17" height="17" />
  58  </object>
  59  EOT;
  60  
  61    return $output;
  62  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7