ONEPIXELOUT, 'module' => 'onepixelout', 'file' => 'soundFile', // Define which flashvar to assign a 'file to play' variable. 'version' => '7', 'shared_file' => '1pixelout/player.swf', 'title' => t('1 Pixel Out MP3 Player'), ); // Onepixelout support various actions with the same player and info. $methods[SWFTOOLS_MP3_DISPLAY][ONEPIXELOUT] = $media_player; return $methods; } /** * Implementation of hook_menu(). */ function onepixelout_menu($may_cache) { $items = array(); if ($may_cache) { $items[] = array('path' => 'admin/media/swf/onepixelout', 'title' => t('1 Pixel Out'), 'callback' => 'drupal_get_form', 'callback arguments' => 'onepixelout_admin_form', 'description' => 'Settings for '. l('1 Pixel Out MP3 Player', 'http://www.1pixelout.net/code/audio-player-wordpress-plugin/') .'.', ); } return $items; } function onepixelout_admin_form() { include_once(drupal_get_path('module', 'onepixelout') .'/onepixelout.admin.inc'); return _onepixelout_admin_form(); } function onepixelout_admin_form_submit($form_id, &$form_values) { include_once(drupal_get_path('module', 'onepixelout') .'/onepixelout.admin.inc'); return _onepixelout_admin_form_submit($form_id, $form_values); } function theme_onepixelout_admin_form($form_values) { $output = drupal_render($form_values['onepixelout_mediaplayer']['autostart']); $output .= drupal_render($form_values['onepixelout_mediaplayer']['loop']); $output .= 'Player Map'; $output .= drupal_render($form_values); return $output; } /** * These are the default settings as they are stored in the database and displayed * on the settings page. */ function _onepixelout_settings() { $saved = variable_get('swftools_'. ONEPIXELOUT, array()); $defaults = array( 'autostart' => 'no', 'loop' => 'no', 'bg' => '', 'leftbg' => '', 'rightbg' => '', 'rightbghover' => '', 'lefticon' => '', 'righticon' => '', 'righticonhover' => '', 'text' => '', 'slider' => '', 'loader' => '', 'track' => '', 'border' => '', ); return array_merge($defaults, $saved); } /** * Implementation of swftools_flashvars hook. * Return an array of flashvars. */ function onepixelout_swftools_flashvars($action, &$methods, &$vars) { $saved = _onepixelout_flashvars(); // Combine user and admin defaults, overwriting defaults. $saved = array_merge($saved, $vars->flashvars); return $saved; } /** * This function takes the module settings and massages them * as required for flashvar output. * */ function _onepixelout_flashvars() { // Cache this. static $flashvars = array(); if (!count($flashvars)) { // Get saved settings for this method. $saved = _onepixelout_settings(); foreach ($saved AS $key => $setting) { if (!$setting || $setting == 'default') { // Don't pass out any undefined values. unset($saved[$key]); } } } return $saved; } /** * Call swf(), enforcing the one pixel out player, for a single file * Parameters are identical to swf() */ function onepixelout_swf($filepath, $params = SWFDEFAULT, $flashvars = SWFDEFAULT, $othervars = SWFDEFAULT, $methods = SWFDEFAULT, $debug = FALSE) { $methods['player'] = ONEPIXELOUT; return swf($filepath, $params, $flashvars, $othervars, $methods); } /* * Implementation of hook_swftools_variable_mapping. * */ function onepixelout_swftools_variable_mapping() { return array( ONEPIXELOUT => array( 'loop' => 'flashvars', 'autostart' => 'flashvars', 'leftbg' => 'flashvars', 'lefticon' => 'flashvars', 'rightbg' => 'flashvars', 'righticon' => 'flashvars', 'rightbghover' => 'flashvars', 'righticonhover' => 'flashvars', ), ); }