aboutsummaryrefslogtreecommitdiff
path: root/app/fn/fn.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-11-12 11:11:58 +0100
committervincent-peugnet <v.peugnet@free.fr>2018-11-12 11:11:58 +0100
commit89b05effb2eb45382762fcfcfae2373b7754caa7 (patch)
treede7a5298f1ef7a095c4b99e684c80b9152c686b1 /app/fn/fn.php
parenta64af357ff41a61f5248e2052274315b390e979c (diff)
downloadwcms-89b05effb2eb45382762fcfcfae2373b7754caa7.tar.gz
wcms-89b05effb2eb45382762fcfcfae2373b7754caa7.zip
url-cleaning-redirect-correct-id
Diffstat (limited to 'app/fn/fn.php')
-rw-r--r--app/fn/fn.php10
1 files changed, 10 insertions, 0 deletions
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)));
+}
+