mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-29 15:22:15 +09:00
Move image URL cleaning function to HTMLFilter #1787
This commit is contained in:
parent
a02d5cb554
commit
1c28254902
3 changed files with 46 additions and 12 deletions
|
|
@ -406,7 +406,7 @@ class Mail
|
|||
|
||||
if (strpos($this->content_type, 'html') !== false)
|
||||
{
|
||||
$content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'convertImageURLs'), $content);
|
||||
$content = Filters\HTMLFilter::fixRelativeUrls($content);
|
||||
}
|
||||
|
||||
$this->message->setBody($content, $this->content_type);
|
||||
|
|
@ -635,17 +635,7 @@ class Mail
|
|||
*/
|
||||
protected function convertImageURLs(array $matches)
|
||||
{
|
||||
$patterns = [
|
||||
'!\b(?i:src)=(["\']?)(?:\./|' . preg_quote(\RX_BASEURL, '!') . '|)files/!',
|
||||
'!\b(?:data-file-srl|editor_component|widget|id)="[^"]*"\s?!',
|
||||
'!\b(?:class="zbxe_widget_output")\s?!',
|
||||
];
|
||||
$replacements = [
|
||||
'src=$1' . URL::getCurrentDomainURL(\RX_BASEURL) . 'files/',
|
||||
'',
|
||||
'',
|
||||
];
|
||||
return preg_replace($patterns, $replacements, $matches[0]);
|
||||
return Filters\HTMLFilter::fixRelativeUrls($matches[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue