• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/mail/mail.php
  • Класс: BitrixMainMailMail
  • Вызов: Mail::replaceImages
public function replaceImages($text)
{
	$replaceImageFunction = 'getReplacedImageSrc';
	if($this->settingAttachImages)
		$replaceImageFunction = 'getReplacedImageCid';

	$this->filesReplacedFromBody = array();
	$textReplaced = preg_replace_callback(
		"/(]*?(?<=\s)src\s*=\s*)(["']?)(.*?)(\2)(\s.+?>|\s*>)/is",
		array($this, $replaceImageFunction),
		$text
	);
	if($textReplaced !== null) $text = $textReplaced;

	$textReplaced = preg_replace_callback(
		"/(background\s*:\s*url\s*\(|background-image\s*:\s*url\s*\()(["']?)(.*?)(\2)(\s*\)(.*?);)/is",
		array($this, $replaceImageFunction),
		$text
	);
	if($textReplaced !== null) $text = $textReplaced;

	$textReplaced = preg_replace_callback(
		"/(]*?(?<=\s)background\s*=\s*)(["']?)(.*?)(\2)(\s.+?>|\s*>)/is",
		array($this, $replaceImageFunction),
		$text
	);
	if($textReplaced !== null) $text = $textReplaced;

	$textReplaced = preg_replace_callback(
		"/(]*?(?<=\s)background\s*=\s*)(["']?)(.*?)(\2)(\s.+?>|\s*>)/is",
		array($this, $replaceImageFunction),
		$text
	);
	if($textReplaced !== null) $text = $textReplaced;

	return $text;
}