You are here

function _commerce_file_get_private_stream_wrappers in Commerce File 7

Return available private file stream wrappers with optional filter

2 calls to _commerce_file_get_private_stream_wrappers()
_commerce_file_default_system_scheme in ./commerce_file.module
Returns system default file scheme
_commerce_file_get_private_stream_wrappers_options in ./commerce_file.module
Return scheme options for a form element with optional filter

File

./commerce_file.module, line 1235
Provides integration of file licenses with Commerce

Code

function _commerce_file_get_private_stream_wrappers(array $filter = array()) {
  $schemes = array();
  if ($schemes = file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE)) {

    // remove public schemes

    /** @todo if stream wrappers get a private/public flag, then can remove all public schemes **************/
    unset($schemes['public']);
    if (!empty($schemes) && !empty($filter)) {
      foreach ($schemes as $scheme => $stream_wrapper) {
        if (!in_array($scheme, $filter)) {
          unset($schemes[$scheme]);
        }
      }
    }
  }
  return $schemes;
}