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'), 'download' => 'http://www.1pixelout.net/code/audio-player-wordpress-plugin/', ); // 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() { $items = array(); //$items['admin/media/swf/onepixelout'] = array( $items['admin/settings/swftools/onepixelout'] = array( 'title' => '1 Pixel Out', 'description' => 'Settings for '. l('1 Pixel Out MP3 Player', 'http://www.1pixelout.net/code/audio-player-wordpress-plugin/') .'.', 'access arguments' => array('administer flash'), 'page callback' => 'drupal_get_form', 'page arguments' => array('onepixelout_admin_form'), 'file' => 'onepixelout.admin.inc', 'file path' => drupal_get_path('module', 'onepixelout'), ); return $items; } /** * 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; } /* * 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', ), ); }