From 299c3346552b24607aaa968fb4259cd7f85cab57 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Tue, 3 May 2022 20:27:30 +0200 Subject: [PATCH] Remove HTML entities when generate the URL base on title, fix for #1428 --- bl-kernel/helpers/text.class.php | 10 ++++++++++ bl-languages/installer/en.php | 12 ++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/bl-kernel/helpers/text.class.php b/bl-kernel/helpers/text.class.php index 8524dd55..78ee80c5 100644 --- a/bl-kernel/helpers/text.class.php +++ b/bl-kernel/helpers/text.class.php @@ -126,6 +126,13 @@ class Text { return str_replace(array_keys($replace), array_values($replace), $text); } + // Remove HTML entities from the string + // HTML entities: & " ' < > + public static function removeHTMLEntities($string) + { + return preg_replace("/&#?[a-z0-9]+;/i", "", $string); + } + public static function removeSpecialCharacters($string, $replace='') { return preg_replace("/[\/_|+:!@#$%^&*()'\"<>\\\`}{;=,?\[\]~. -]+/", $replace, $string); @@ -156,6 +163,8 @@ class Text { { global $L; + $string = self::removeHTMLEntities($string); + if (EXTREME_FRIENDLY_URL && $allowExtremeFriendlyURL) { $string = self::lowercase($string); $string = trim($string, $separator); @@ -176,6 +185,7 @@ class Text { } } + // Clean $string = preg_replace("/[^a-zA-Z0-9\/_|+. -]/", '', $string); $string = self::lowercase($string); $string = preg_replace("/[\/_|+ -]+/", $separator, $string); diff --git a/bl-languages/installer/en.php b/bl-languages/installer/en.php index e48b69ff..d07ce21c 100644 --- a/bl-languages/installer/en.php +++ b/bl-languages/installer/en.php @@ -9,18 +9,18 @@ $examples = array( 'description' => 'A warm welcome to your new website.', 'tags' => array('Welcome', 'Plugins', 'Themes', 'Bludit'), 'content' => -'

Thanks for chose Bludit and welcome to our community, we are growing up everyday and is awesome.

-

Follow Bludit in different social networks:

+'

Thank you for choosing Bludit and welcome to our community, we are growing every day and it\'s amazing.

+

Follow Bludit on different social networks:

-

Take a look to the plugins and themes:

+

Take a look at the plugins and themes:

-

Do you need support or you want to read about Bludit, check our official documentation or participate in our forum.

+

Do you need support? or want to read about Bludit, consult our official documentation or participate in our forum