You are here

function swftools_admin_handling_form in SWF Tools 6

Same name and namespace in other branches
  1. 5 swftools.module \swftools_admin_handling_form()
  2. 6.3 includes/swftools.admin.inc \swftools_admin_handling_form()
  3. 6.2 swftools.admin.inc \swftools_admin_handling_form()
1 string reference to 'swftools_admin_handling_form'
swftools_menu in ./swftools.module
Implementation of hook_menu().

File

./swftools.admin.inc, line 186

Code

function swftools_admin_handling_form() {

  // Clear all caches
  drupal_flush_all_caches();
  $playlist_path = swftools_get_playlist_path();
  $player_directory = swftools_get_player_path() . '/';
  $form = array();
  $form['swftools_files'] = array(
    '#type' => 'fieldset',
    '#title' => t('File locations'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['swftools_files']['swftools_player_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Default flash player path'),
    '#default_value' => variable_get('swftools_player_path', SWFTOOLS_PLAYER_PATH),
    '#description' => t('Leave this blank to default to the shared player file
                         inside the swftools module (%default). Otherwise your options are:<ul>
                          <li>a path inside your files directory, <em>without</em>
                              a preceding slash (eg. <strong>myplayers</strong>), or</li>
                          <li>a path from the webroot <em>with</em> a preceding slash.
                              (eg <strong>/alternate_filepath</strong>)</li></ul>', array(
      '%default' => t(drupal_get_path('module', 'swftools') . '/shared'),
    )),
  );
  $form['swftools_files']['swftools_playlist_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Directory in files where playlist/xml files can be cached'),
    '#default_value' => variable_get('swftools_playlist_path', SWFTOOLS_PLAYLIST_PATH),
    '#description' => t('A location inside your files directory
                          without preceding or trailing slashes (eg. <strong>playlists</strong>)'),
  );
  $current_path = variable_get('swftools_media_url', $GLOBALS['base_url'] . '/' . file_create_path(''));

  // Misname the variable with '_dummy' so that it is not saved!
  $form['swftools_files']['swftools_media_url_dummy'] = array(
    '#type' => 'textfield',
    '#title' => t('Media directory url'),
    '#default_value' => $current_path,
    '#disabled' => TRUE,
    '#description' => t("This helps swftools identify the server where your media files are located.\n                         You cannot change it here, as changing it has the potential to break existing\n                         content. You can set this on the &#36;conf array in your settings.php file.\n                         For example: <pre>\n  &#36;conf = array(\n    'swftools_media_url' => 'http://anothersite.com/media', // No trailing slashes!\n  );</pre>               Leaving this value unset in your settings.php file will\n                         persuade SWF Tools to check for the existence of your\n                         media files, as they are automatically assumed to be\n                         on the local server."),
  );
  $form['swftools_files']['swftools_check_media'] = array(
    '#type' => 'checkbox',
    '#title' => t('Check if local files exist'),
    '#default_value' => variable_get('swftools_check_media', TRUE),
    '#description' => t('This option will cause SWF Tools to check that requested local
                         media files exist, and issue a warning if they do not.'),
  );
  $form['swftools']['handling'] = array(
    '#type' => 'fieldset',
    '#title' => t('File handling'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => 'Choose how different file types are handled.',
  );
  $form['swftools']['handling'][SWFTOOLS_FLV_DISPLAY] = _swftools_admin_file_handling_option(SWFTOOLS_FLV_DISPLAY, $player_directory, "Default player for single FLV movies");
  $form['swftools']['handling'][SWFTOOLS_MP3_DISPLAY] = _swftools_admin_file_handling_option(SWFTOOLS_MP3_DISPLAY, $player_directory, "Default player for single MP3 files");
  $form['swftools']['handling'][SWFTOOLS_SWF_DISPLAY] = _swftools_admin_file_handling_option(SWFTOOLS_SWF_DISPLAY, $player_directory, "Default player for single SWF files");
  $form['swftools']['handling'][SWFTOOLS_IMAGE_DISPLAY_LIST] = _swftools_admin_file_handling_option(SWFTOOLS_IMAGE_DISPLAY_LIST, $player_directory, "Default player for a list of images");
  $form['swftools']['handling'][SWFTOOLS_FLV_DISPLAY_LIST] = _swftools_admin_file_handling_option(SWFTOOLS_FLV_DISPLAY_LIST, $player_directory, "Default player for a list of FLV movies");
  $form['swftools']['handling'][SWFTOOLS_MP3_DISPLAY_LIST] = _swftools_admin_file_handling_option(SWFTOOLS_MP3_DISPLAY_LIST, $player_directory, "Default player for a list of MP3 music files");
  $form['swftools']['handling'][SWFTOOLS_MEDIA_DISPLAY_LIST] = _swftools_admin_file_handling_option(SWFTOOLS_MEDIA_DISPLAY_LIST, $player_directory, "Default player for a list of mixed media");

  // Playlist settings
  $form['swftools']['playlist'] = array(
    '#type' => 'fieldset',
    '#title' => t('Playlist caching'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => 'Settings for XML files and playlists.',
  );
  $caching = variable_get('swftools_playlist_caching', 'here');
  if ($caching == 'here') {
    file_scan_directory(swftools_get_playlist_path(), '.*', array(
      '.',
      '..',
      'CVS',
    ), 'file_delete', TRUE);
  }
  $form['swftools']['playlist']['swftools_playlist_caching'] = array(
    '#type' => 'select',
    '#title' => t('Clear playlist cache'),
    '#default_value' => $caching,
    '#options' => array(
      'here' => 'Only here',
      'always' => 'Every page view',
    ),
    '#description' => 'Select \'Only here\' to clear the playlist directory just ' . 'by visiting this page. It is useful to select \'Every ' . 'page view\' for site or module development but not ' . 'advisable for live sites.',
  );
  $form['swftools_private'] = array(
    '#type' => 'fieldset',
    '#title' => t('Private file system'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  // Allow SWF Tools to grant access to non-uploaded files
  $form['swftools_private']['swftools_grant_access_to_private_files'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow SWF Tools to grant access to supported private files'),
    '#default_value' => variable_get('swftools_grant_access_to_private_files', SWFTOOLS_GRANT_ACCESS_TO_PRIVATE_FILES),
    '#description' => t('If using a private file system then SWF Tools is unable to
                         access files that are not uploaded via a file module that
                         supports a private file system. For example, SWF Tools will
                         be unable to access files that were manually uploaded via FTP.
                         Enabling this setting will allow SWF Tools to grant access
                         to files with extensions defined by the next setting.
                         Note - if another module <em>denies</em> access then access
                         to the file will not be granted. SWF Tools itself does not
                         deny access to any file. SWF Tools always allows access
                         to files in the playlists directory.
                         '),
  );

  // Default file extensions that SWF Tools will grant access for
  $form['swftools_private']['swftools_grant_access_extensions'] = array(
    '#type' => 'textfield',
    '#title' => t('Extensions that SWF Tools will allow access to'),
    '#default_value' => variable_get('swftools_grant_access_extensions', SWFTOOLS_GRANT_ACCESS_EXTENSIONS),
    '#maxlength' => 255,
    '#description' => t('Under a private file system SWF Tools will grant access to files
                         with extensions in this list. Separate extensions with a space
                         and do not include the leading dot. Although any extension can be
                         added to this list, only <em>swf flv xml mp3 jpg jpeg</em> and
                         <em>png</em> will return the correct headers.'),
  );
  return system_settings_form($form);
}