[Fixed] no input error
if activated but no chars are given, it'll cut out the whole category-string -> added char-check
This commit is contained in:
@ -33,10 +33,14 @@ trait articleTreeStructure
|
|||||||
*/
|
*/
|
||||||
public function cleanUpTitle($title) :string
|
public function cleanUpTitle($title) :string
|
||||||
{
|
{
|
||||||
// decode encoded characters
|
|
||||||
$title = html_entity_decode($title, ENT_QUOTES);
|
|
||||||
// remove unwanted characters, e.g. Zoll "
|
// remove unwanted characters, e.g. Zoll "
|
||||||
$charsToReplace = Registry::get(ViewConfig::class)->getCharsToReplaceInCategorTitles();
|
$charsToReplace = Registry::get(ViewConfig::class)->getCharsToReplaceInCategorTitles();
|
||||||
|
if (empty($charsToReplace)){
|
||||||
|
return $title;
|
||||||
|
}
|
||||||
|
|
||||||
|
// decode encoded characters
|
||||||
|
$title = html_entity_decode($title, ENT_QUOTES);
|
||||||
$title = preg_replace('/[' . $charsToReplace . ']/', '', $title);
|
$title = preg_replace('/[' . $charsToReplace . ']/', '', $title);
|
||||||
// trim whitespace from both ends of the string
|
// trim whitespace from both ends of the string
|
||||||
$title = trim($title);
|
$title = trim($title);
|
||||||
|
Reference in New Issue
Block a user