Cleanup some PHP code

This commit is contained in:
djmaze 2021-04-28 14:17:28 +02:00
parent ce63ba506a
commit 8e5d56e15f
3 changed files with 13 additions and 30 deletions

View file

@ -161,13 +161,11 @@ class Utils
public static function ClearHtmlOutput(string $sHtml) : string
{
// return $sHtml;
return \trim(\str_replace('> <', '><',
\str_replace('" />', '"/>',
\preg_replace('/[\s]+&nbsp;/i', '&nbsp;',
\preg_replace('/&nbsp;[\s]+/i', '&nbsp;',
\preg_replace('/[\r\n\t]+/', ' ',
$sHtml
))))));
return \preg_replace(
['@"\\s*/>@', '/\\s*&nbsp;/i', '/&nbsp;\\s*/i', '/[\\r\\n\\t]+/', '/>\\s+</'],
['">', '&nbsp;', '&nbsp;', ' ', '><'],
\trim($sHtml)
);
}
public static function CompileTemplates(array &$aList, string $sDirName, string $sNameSuffix = '')