src/File.php
public static function makeSafe($file, array $stripChars = array('#^\.#'))
	{
		$regex = array_merge(array('#(\.){2,}#', '#[^A-Za-z0-9\.\_\- ]#'), $stripChars);

		$file = preg_replace($regex, '', $file);

		// Remove any trailing dots, as those aren't ever valid file names.
		$file = rtrim($file, '.');

		return $file;
	}
public static function makeSafe($file, array $stripChars = array('#^\.#'))
	{
		$regex = array_merge(array('#(\.){2,}#', '#[^A-Za-z0-9\.\_\- ]#'), $stripChars);

		$file = preg_replace($regex, '', $file);

		// Remove any trailing dots, as those aren't ever valid file names.
		$file = rtrim($file, '.');

		return $file;
	}
public static function makeSafe ( $ file , array $ stripChars = array ( '#^\.#' ) ) { $ regex = array_merge ( array ( '#(\.){2,}#' , '#[^A-Za-z0-9\.\_\- ]#' ) , $ stripChars ) ; $ file = preg_replace ( $ regex , '' , $ file ) ; // Remove any trailing dots, as those aren't ever valid file names. $ file = rtrim ( $ file , '.' ) ; return $ file ; }
Makes the file name safe to use

@param   string  $file        The name of the file [not full path]
@param   array   $stripChars  Array of regex (by default will remove any leading periods)

@return  string  The sanitised string

@since   1.0
Makes the file name safe to use