View source
<?php
define('GENERIC_FLV', 'generic_flv');
define('GENERIC_MP3', 'generic_mp3');
function genericplayers_swftools_methods() {
$methods = array();
$mp3_player = array(
'name' => GENERIC_MP3,
'module' => 'genericplayers',
'file' => 'file_url',
'shared_file' => 'generic/generic_mp3.swf',
'title' => t('Generic MP3 Player'),
);
$methods[SWFTOOLS_MP3_DISPLAY][GENERIC_MP3] = $mp3_player;
$flv_player = array(
'name' => GENERIC_FLV,
'module' => 'genericplayers',
'file' => 'file_url',
'shared_file' => 'generic/generic_flv.swf',
'title' => t('Generic FLV Player'),
);
$methods[SWFTOOLS_FLV_DISPLAY][GENERIC_FLV] = $flv_player;
return $methods;
}
function genericplayers_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'admin/media/swf/generic',
'title' => t('Generic Players'),
'description' => t('Basic Flash players that ship with SWF Tools'),
'weight' => -1,
);
}
return $items;
}
function swftools_admin_generic_form() {
$form = array();
$methods = swftools_methods_available(SWFTOOLS_EMBED_METHOD);
$form['generic_mp3_autostart'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('generic_mp3_autostart', FALSE),
'#title' => t('Autostart MP3'),
'#description' => t('Automatically start playing the MP3 file.'),
);
$form['generic_flv_autostart'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('generic_flv_autostart', FALSE),
'#title' => t('Autostart FLV'),
'#enabled' => FALSE,
'#description' => t('Automatically start playing FLV file.'),
);
return system_settings_form($form);
}
function genericplayers_swftools_flashvars($action, &$methods, &$vars) {
if ($vars->othervars['file_url']) {
$vars->flashvars['file_url'] = $vars->othervars['file_url'];
}
switch ($action) {
case SWFTOOLS_MP3_DISPLAY:
$vars->flashvars['autostart'] = isset($vars->flashvars['autostart']) ? $vars->flashvars['autostart'] : variable_get('generic_mp3_autostart', FALSE) ? 'true' : 'false';
break;
case SWFTOOLS_FLV_DISPLAY:
$vars->flashvars['autostart'] = isset($vars->flashvars['autostart']) ? $vars->flashvars['autostart'] : variable_get('generic_flv_autostart', FALSE) ? 'true' : 'false';
break;
}
return $vars->flashvars;
}