mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 18:19:22 +03:00
Small fixes
This commit is contained in:
parent
67f666fa7d
commit
9b59ad32dc
16 changed files with 433 additions and 233 deletions
|
|
@ -152,7 +152,8 @@ class HtmlUtils
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function ClearStyle($sStyle, $oElement, &$bHasExternals, &$aFoundCIDs, $aContentLocationUrls, &$aFoundedContentLocationUrls, $bDoNotReplaceExternalUrl = false)
|
||||
public static function ClearStyle($sStyle, $oElement, &$bHasExternals, &$aFoundCIDs,
|
||||
$aContentLocationUrls, &$aFoundedContentLocationUrls, $bDoNotReplaceExternalUrl = false)
|
||||
{
|
||||
$sStyle = \trim($sStyle);
|
||||
$aOutStyles = array();
|
||||
|
|
@ -618,8 +619,6 @@ class HtmlUtils
|
|||
*/
|
||||
public static function BuildHtml($sHtml, &$aFoundCids = array(), &$mFoundDataURL = null, &$aFoundedContentLocationUrls = array())
|
||||
{
|
||||
$bRtl = \MailSo\Base\Utils::IsRTL($sHtml);
|
||||
|
||||
$oDom = \MailSo\Base\HtmlUtils::GetDomFromText($sHtml);
|
||||
unset($sHtml);
|
||||
|
||||
|
|
@ -749,7 +748,7 @@ class HtmlUtils
|
|||
$sResult = \MailSo\Base\HtmlUtils::ClearTags($sResult);
|
||||
$sResult = \MailSo\Base\HtmlUtils::ClearBodyAndHtmlTag($sResult);
|
||||
|
||||
return '<!DOCTYPE html><html'.($bRtl ? ' dir="rtl"' : '').'><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>'.
|
||||
return '<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>'.
|
||||
'<body>'.\trim($sResult).'</body></html>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class Utils
|
|||
'iso-8859-7', 'iso-8859-8', 'iso-8859-9', 'iso-8859-10', 'iso-8859-11', 'iso-8859-12',
|
||||
'iso-8859-13', 'iso-8859-14', 'iso-8859-15', 'iso-8859-16',
|
||||
'koi8-r', 'koi8-u', 'koi8-ru',
|
||||
'cp1250', 'cp1251', 'cp1252', 'cp1253', 'cp1254', 'cp1257', 'cp949', 'cp1133',
|
||||
'cp1125', 'cp1250', 'cp1251', 'cp1252', 'cp1253', 'cp1254', 'cp1257', 'cp949', 'cp1133',
|
||||
'cp850', 'cp866', 'cp1255', 'cp1256', 'cp862', 'cp874', 'cp932', 'cp950', 'cp1258',
|
||||
'windows-1250', 'windows-1251', 'windows-1252', 'windows-1253', 'windows-1254', 'windows-1255',
|
||||
'windows-1256', 'windows-1257', 'windows-1258', 'windows-874',
|
||||
|
|
@ -33,6 +33,62 @@ class Utils
|
|||
'c99', 'java', 'ucs-2-internal', 'ucs-4-internal'
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public static $aLocaleMapping = array(
|
||||
'.65001' => 'utf-8',
|
||||
'.20127' => 'iso-8859-1',
|
||||
|
||||
'.1250' => 'windows-1250',
|
||||
'.cp1250' => 'windows-1250',
|
||||
'.cp-1250' => 'windows-1250',
|
||||
'.1251' => 'windows-1251',
|
||||
'.cp1251' => 'windows-1251',
|
||||
'.cp-1251' => 'windows-1251',
|
||||
'.1252' => 'windows-1252',
|
||||
'.cp1252' => 'windows-1252',
|
||||
'.cp-1252' => 'windows-1252',
|
||||
'.1253' => 'windows-1253',
|
||||
'.cp1253' => 'windows-1253',
|
||||
'.cp-1253' => 'windows-1253',
|
||||
'.1254' => 'windows-1254',
|
||||
'.cp1254' => 'windows-1254',
|
||||
'.cp-1254' => 'windows-1254',
|
||||
'.1255' => 'windows-1255',
|
||||
'.cp1255' => 'windows-1255',
|
||||
'.cp-1255' => 'windows-1255',
|
||||
'.1256' => 'windows-1256',
|
||||
'.cp1256' => 'windows-1256',
|
||||
'.cp-1256' => 'windows-1256',
|
||||
'.1257' => 'windows-1257',
|
||||
'.cp1257' => 'windows-1257',
|
||||
'.cp-1257' => 'windows-1257',
|
||||
'.1258' => 'windows-1258',
|
||||
'.cp1258' => 'windows-1258',
|
||||
'.cp-1258' => 'windows-1258',
|
||||
|
||||
'.28591' => 'iso-8859-1',
|
||||
'.28592' => 'iso-8859-2',
|
||||
'.28593' => 'iso-8859-3',
|
||||
'.28594' => 'iso-8859-4',
|
||||
'.28595' => 'iso-8859-5',
|
||||
'.28596' => 'iso-8859-6',
|
||||
'.28597' => 'iso-8859-7',
|
||||
'.28598' => 'iso-8859-8',
|
||||
'.28599' => 'iso-8859-9',
|
||||
'.28603' => 'iso-8859-13',
|
||||
'.28605' => 'iso-8859-15',
|
||||
|
||||
'.1125' => 'cp1125',
|
||||
'.20866' => 'koi8-r',
|
||||
'.21866' => 'koi8-u',
|
||||
'.950' => 'big5',
|
||||
'.936' => 'euc-cn',
|
||||
'.20932' => 'euc-js',
|
||||
'.949' => 'euc-kr',
|
||||
);
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*/
|
||||
|
|
@ -40,6 +96,28 @@ class Utils
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function DetectSystemCharset()
|
||||
{
|
||||
$sResult = '';
|
||||
$sLocale = @\setlocale(LC_ALL, '');
|
||||
$sLocaleLower = \strtolower(\trim($sLocale));
|
||||
|
||||
foreach (\MailSo\Base\Utils::$aLocaleMapping as $sKey => $sValue)
|
||||
{
|
||||
if (false !== \strpos($sLocaleLower, $sKey) ||
|
||||
false !== \strpos($sLocaleLower, '.'.$sValue))
|
||||
{
|
||||
$sResult = $sValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $sResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sEncoding
|
||||
* @param bool $bAsciAsUtf8 = false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue