/[drupal]/contributions/modules/media_player/media_player.theme.inc
ViewVC logotype

Contents of /contributions/modules/media_player/media_player.theme.inc

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


Revision 1.7 - (show annotations) (download) (as text)
Mon Aug 18 02:13:03 2008 UTC (15 months, 1 week ago) by aaron
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +5 -4 lines
File MIME type: text/x-php
* Remove hard-coded splash image (aaron).
1 <?php
2 // $Id: media_player.theme.inc,v 1.6 2008/08/18 01:37:01 aaron Exp $
3
4 /**
5 * @file
6 * Theme functions for the Media Player module.
7 */
8
9 /**
10 * Display a file embedded in a media player.
11 * @param $file
12 * The path to the media to play.
13 * @param $options
14 * An array of options to pass to the player:
15 * 'absolute' => TRUE or FALSE. If TRUE, this is used when building URL's (useful for embedding externally).
16 * 'autoplay' => TRUE or FALSE
17 * 'width' => The width of the player
18 * 'height' => The height of the player
19 * 'color_bg' => The background color of the player, such as 'red', 'black', or a Hex value.
20 * 'display_logo' => TRUE or FALSE
21 * 'logo' => The path to an icon to display
22 * 'logo_x' => The x coordinate to display the logo
23 * 'logo_y' => The y coordinate to display the logo
24 * 'display_image' => TRUE or FALSE
25 * 'image' => The path to an image to display before playing the media
26 * 'image_x' => The x coordinate to display the image
27 * 'image_y' => The y coordinate to display the image
28 * @param $params
29 * An array of parameters to pass to the flash
30 * 'quality' => The quality of the flash, such as 'high'
31 * 'scale' => Whether to allow the flash to scale, such as 'noscale' or 'scale'
32 * @param $player
33 * If NULL, then this will route to the default player.
34 * Otherwise, it will route to the specified player, from one of the following:
35 * 'media_player' => The included flash media player, created specifically for Drupal using OpenLaszlo.
36 * 'jw_player' => JW Media Player.
37 * 'wimpy' => Wimpy Media Player.
38 */
39 function theme_media_player_player($file, $options = array(), $params = array(), $player = NULL) {
40 $player = isset($player) ? $player : variable_get('media_player_default_player', 'media_player');
41 switch ($player) {
42 case 'media_player':
43 default:
44 return theme('media_player_media_player', $file, $options);
45 }
46 }
47
48 function theme_media_player_media_player($file, $options = array(), $params = array(), $id = NULL) {
49 static $count = 0;
50 _media_player_default_options($options, $params);
51 $logo = $options['display_logo'] ? "&display_logo={$options['display_logo']}&logo={$options['logo']}" : '';
52 $image = $options['image'] ? "&image={$options['image']}" : '';
53 $color_bg = "&color_bg={$options['color_bg']}";
54 $url_options = array(
55 'absolute' => $options['absolute'],
56 'query' => "lzproxied=false&file=$file$logo$color_bg$image",
57 );
58 $url = variable_get('media_player_path_media_player', drupal_get_path('module', 'media_player') .'/media_player.lzx.lzr=swf8.swf');
59 $url = url($url, $url_options);
60 $params['movie'] = $url;
61 $id = isset($id) ? $id : 'media-player-'. ($count++);
62 foreach ($params as $key => $param) {
63 $parameters .= "<param name='$key' value='$param'>";
64 }
65 drupal_add_js(drupal_get_path('module', 'media_player') .'/lps/includes/embed-compressed.js');
66 $output .= <<<LWZ
67 <script type="text/javascript">
68 lz.embed.swf({url: '$url', bgcolor: '{$options['color_bg']}', width: '{$options['width']}', height: '{$options['height']}', id: '$id', accessible: 'false'});
69 </script><noscript>
70 Please enable JavaScript in order to use this application.
71 </noscript>
72 LWZ;
73 // $output .= "<object type='application/x-shockwave-flash' data='$url' width='{$options['width']}' height='{$options['height']}'>$parameters</object>";
74 return $output;
75 }
76
77 function _media_player_default_options(&$options, &$params) {
78 // $options
79 $options['absolute'] = isset($options['absolute']) ? $options['absolute'] : variable_get('media_player_default_absolute', FALSE);
80 $options['autoplay'] = isset($options['autoplay']) ? $options['autoplay'] : variable_get('media_player_default_autoplay', FALSE);
81 $options['width'] = isset($options['width']) ? $options['width'] : variable_get('media_player_default_width', 500);
82 $options['height'] = isset($options['height']) ? $options['height'] : variable_get('media_player_default_height', 400);
83 $options['color_bg'] = isset($options['color_bg']) ? $options['color_bg'] : variable_get('media_player_default_color_bg', 'black');
84 $options['display_logo'] = isset($options['display_logo']) ? $options['display_logo'] : variable_get('media_player_default_display_logo', TRUE);
85 $options['logo'] = isset($options['logo']) ? $options['logo'] : variable_get('media_player_default_logo', drupal_get_path('module', 'media_player') .'/resources/druplicon.png');
86 $options['logo'] = url($options['logo'], array('absolute' => $options['absolute']));
87 $options['logo_x'] = isset($options['logo_x']) ? $options['logo_x'] : variable_get('media_player_default_logo_x', 400);
88 $options['logo_y'] = isset($options['logo_y']) ? $options['logo_y'] : variable_get('media_player_default_logo_y', 10);
89 $options['display_image'] = isset($options['display_image']) ? $options['display_image'] : variable_get('media_player_default_display_image', TRUE);
90 $options['image'] = isset($options['image']) ? $options['image'] : variable_get('media_player_default_image', drupal_get_path('module', 'media_player') .'/resources/druplicon.png');
91 $options['image'] = url($options['image'], array('absolute' => $options['absolute']));
92 $options['image_x'] = isset($options['image_x']) ? $options['image_x'] : variable_get('media_player_default_image_x', 0);
93 $options['image_y'] = isset($options['image_y']) ? $options['image_y'] : variable_get('media_player_default_image_y', 0);
94
95 // $params
96 $params['quality'] = isset($params['quality']) ? $params['quality'] : variable_get('media_player_default_quality', 'high');
97 $params['scale'] = isset($params['scale']) ? $params['scale'] : variable_get('media_player_default_scale', 'noscale');
98 $params['salign'] = isset($params['salign']) ? $params['salign'] : variable_get('media_player_default_salign', 'LT');
99 $params['menu'] = isset($params['menu']) ? $params['menu'] : variable_get('media_player_default_menu', 'false');
100 }

  ViewVC Help
Powered by ViewVC 1.1.2