diff --git a/functions.php b/functions.php index 7e4006f1..cc8f8675 100644 --- a/functions.php +++ b/functions.php @@ -405,6 +405,18 @@ function getDomainExpirationDate($name){ return '0000-00-00'; } +function clean_file_name($string){ + $string = strtolower($string); + + // Gets rid of spaces + $clean_file_name = preg_replace('/\s/', '', $string); + + // Gets rid of non-alphanumerics + $clean_file_name = preg_replace( '/[^A-Za-z0-9_]/', '', $string ); + + return $clean_file_name; +} + // Cross-Site Request Forgery check for sensitive functions // Validates the CSRF token provided matches the one in the users session function validateCSRFToken($token){