/** * Filename cleanup * * Removes unwanted characters in a filename. * * @param string $n Filename * @return string */ public static function tidyFileName($n) { $n = text::deaccent($n); $n = preg_replace('/^[.]/u', '', $n); return preg_replace('/[^A-Za-z0-9._-]/u', '_', $n); }