From 89b05effb2eb45382762fcfcfae2373b7754caa7 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Mon, 12 Nov 2018 11:11:58 +0100 Subject: url-cleaning-redirect-correct-id --- app/fn/fn.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/fn') diff --git a/app/fn/fn.php b/app/fn/fn.php index 029e9d3..03bb2d0 100644 --- a/app/fn/fn.php +++ b/app/fn/fn.php @@ -70,6 +70,16 @@ function arrayclean($input) return $output; } +function idclean(string $input) +{ + $input = urldecode($input); + $search = ['é', 'à', 'è', 'ç', ' ']; + $replace = ['e', 'a', 'e', 'c', '-']; + $input = str_replace($search, $replace, $input); + + return preg_replace('%[^a-z0-9-_+]%', '', strtolower(trim($input))); +} + -- cgit v1.2.3