From 705060d1df3587a2947460b99e8eb579f83729be Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Sun, 1 May 2022 18:46:45 +0100 Subject: [PATCH] Add clean_file_name function to fix merge conflict --- functions.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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){