You are here

function alt_stream_wrappers_stream_wrappers in Alternative Stream Wrappers 7

Implements hook_stream_wrappers().

File

./alt_stream_wrappers.module, line 22
Provides one or more configurable alternative stream wrappers for file storage.

Code

function alt_stream_wrappers_stream_wrappers() {
  $default = array(
    'alt-temp' => array(
      'name' => t('Alternative temporary files'),
      'class' => 'DrupalAltStreamWrapper',
      'description' => t('Alternative temporary local files.'),
      'type' => STREAM_WRAPPERS_LOCAL_HIDDEN,
    ),
  );
  $all_wrappers = variable_get('alt_stream_wrappers_wrappers', $default);
  $configured_wrappers = array();
  foreach ($all_wrappers as $scheme => $wrapper) {

    // Only register the stream wrapper if a file path has been set.
    if (variable_get('alt_stream_wrappers_' . $scheme . '_path', FALSE)) {
      $configured_wrappers[$scheme] = $wrapper;
    }
  }
  return $configured_wrappers;
}