You are here

function uc_csv_clean_filename in Ubercart CSV 6.2

Same name and namespace in other branches
  1. 7.2 uc_csv.module \uc_csv_clean_filename()
1 call to uc_csv_clean_filename()
uc_csv_select_report_to_export_submit in ./uc_csv.module

File

./uc_csv.module, line 575

Code

function uc_csv_clean_filename($str, $replace = array(), $delimiter = '-') {
  setlocale(LC_ALL, 'en_US.UTF8');
  if (!empty($replace)) {
    $str = str_replace((array) $replace, ' ', $str);
  }
  $clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
  $clean = preg_replace("/[^a-zA-Z0-9\\/_|+ -]/", '', $clean);
  $clean = strtolower(trim($clean, '-'));
  $clean = preg_replace("/[\\/_|+ -]+/", $delimiter, $clean);
  return $clean;
}