Removed unused CopyDir() and InlineRebuildStringToJsString()

Bugfix StrMailDomainToLower()
This commit is contained in:
djmaze
2021-11-23 15:09:21 +01:00
parent b0463f3bff
commit 1da2bb045f
2 changed files with 7 additions and 51 deletions

View File

@@ -55,12 +55,12 @@ abstract class HtmlUtils
$sText = static::ClearBodyAndHtmlTag($sText, $sHtmlAttrs, $sBodyAttrs);
$oDom = self::createDOMDocument();
@$oDom->loadHTML('<'.'?xml version="1.0" encoding="utf-8"?'.'>'.
$oDom->loadHTML('<?xml version="1.0" encoding="utf-8"?>'.
'<html '.$sHtmlAttrs.'><head>'.
'<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>'.
'<body '.$sBodyAttrs.'>'.\MailSo\Base\Utils::Utf8Clear($sText).'</body></html>');
@$oDom->normalizeDocument();
$oDom->normalizeDocument();
if (\MailSo\Base\Utils::FunctionExistsAndEnabled('libxml_clear_errors'))
{

View File

@@ -212,10 +212,10 @@ abstract class Utils
public static function StrMailDomainToLower(string $sValue) : string
{
$aParts = \explode('@', $sValue, 2);
if (!empty($aParts[1]))
{
$aParts[1] = \mb_strtolower($aParts[1]);
$aParts = \explode('@', $sValue);
$iLast = \count($aParts) - 1;
if ($iLast) {
$aParts[$iLast] = \mb_strtolower($aParts[$iLast]);
}
return \implode('@', $aParts);
@@ -633,6 +633,7 @@ abstract class Utils
'bz' => 'application/x-bzip',
'bz2' => 'application/x-bzip2',
'deb' => 'application/x-debian-package',
'tar' => 'application/x-tar',
// fonts
'psf' => 'application/x-font-linux-psf',
@@ -811,17 +812,6 @@ abstract class Utils
return false;
}
public static function InlineRebuildStringToJsString(string $sText) : string
{
static $aJsonReplaces = array(
array('\\', "\n", "\t", "\r", '\b', "\f", '"'),
array('\\\\', '\\n', '\\t', '\\r', '\\b', '\\f', '\"')
);
return \str_replace('</script>', '<\/script>',
\str_replace($aJsonReplaces[0], $aJsonReplaces[1], $sText));
}
public static function ClearArrayUtf8Values(array &$aInput)
{
foreach ($aInput as $mKey => $mItem)
@@ -921,40 +911,6 @@ abstract class Utils
return false;
}
public static function CopyDir(string $sSource, string $sDestination)
{
if (\is_dir($sSource))
{
if (!\is_dir($sDestination))
{
\mkdir($sDestination);
}
$oDirectory = \dir($sSource);
if ($oDirectory)
{
while (false !== ($sRead = $oDirectory->read()))
{
if ('.' === $sRead || '..' === $sRead)
{
continue;
}
$sPathDir = $sSource.'/'.$sRead;
if (\is_dir($sPathDir))
{
static::CopyDir($sPathDir, $sDestination.'/'.$sRead);
continue;
}
\copy($sPathDir, $sDestination.'/'.$sRead);
}
$oDirectory->close();
}
}
}
public static function RecTimeDirRemove(string $sTempPath, int $iTime2Kill, int $iNow = 0) : bool
{
$iNow = $iNow ?: \time();