From 810a2102e64dc9046a8db6f1f2397ded2bd70779 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Wed, 19 Apr 2023 22:27:50 +0200 Subject: [PATCH] Adapting OutputFilter::stringUrlSafe() to CMS class --- src/OutputFilter.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/OutputFilter.php b/src/OutputFilter.php index 51a82976..08b6c1af 100644 --- a/src/OutputFilter.php +++ b/src/OutputFilter.php @@ -122,6 +122,9 @@ public static function stringUrlSafe($string, $language = '') // Trim white spaces at beginning and end of alias and make lowercase $str = trim(StringHelper::strtolower($str)); + // Remove any apostrophe. We do it here to ensure it is not replaced by a '-' + $str = str_replace("'", '', $str); + // Remove any duplicate whitespace, and ensure all characters are alphanumeric $str = preg_replace('/(\s|[^A-Za-z0-9\-])+/', '-', $str);