You are here

function _filebrowser_pattern_to_filter in Filebrowser 7.4

Converts a pattern to a filter for use with the file upload widget The allowed file types are inserted as a pattern on the node create form. The pattern is a string separated by new lines

Parameters

string $pattern:

Return value

string

1 call to _filebrowser_pattern_to_filter()
filebrowser_form_plupload_upload in ./filebrowser.module
upload form using plupload @inheritdoc

File

./filebrowser.helpers.inc, line 119
Misc helper functions.

Code

function _filebrowser_pattern_to_filter($pattern) {
  $extensions = array();
  $filters = preg_split('/\\R/', $pattern);
  foreach ($filters as $item) {
    $extensions[] = substr(strrchr($item, '.'), 1);
  }
  return implode(' ', $extensions);
}