mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-10 06:58:27 +03:00
Optimize HTML parsing (#1075)
This commit is contained in:
parent
f6c78ee1fa
commit
9a1d5dd1d3
1 changed files with 12 additions and 1 deletions
|
|
@ -236,7 +236,18 @@ class HtmlUtils
|
|||
$sBodyAttrs = $aMatch[1];
|
||||
}
|
||||
|
||||
$sHtml = \preg_replace('/^.*<body([^>]*)>/si', '', $sHtml);
|
||||
$iPos = \stripos($sHtml, '<body>');
|
||||
if (0 < $iPos)
|
||||
{
|
||||
$sHtml = \substr($sHtml, $iPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
$iPos = \stripos($sHtml, '<body ');
|
||||
$sHtml = 0 < $iPos ? \substr($sHtml, $iPos) : $sHtml;
|
||||
}
|
||||
|
||||
$sHtml = \preg_replace('/<body([^>]*)>/si', '', $sHtml);
|
||||
$sHtml = \preg_replace('/<\/body>/i', '', $sHtml);
|
||||
$sHtml = \preg_replace('/<html([^>]*)>/i', '', $sHtml);
|
||||
$sHtml = \preg_replace('/<\/html>/i', '', $sHtml);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue