• Модуль: subscribe
  • Путь к файлу: ~/bitrix/modules/subscribe/classes/general/posting.php
  • Класс: CMailTools
  • Вызов: CMailTools::ReplaceImages
function ReplaceImages($text)
{
	if($this->pcre_backtrack_limit === false)
		$this->pcre_backtrack_limit = intval(ini_get("pcre.backtrack_limit"));
	$text_len = defined("BX_UTF")? mb_strlen($text, 'latin1') : mb_strlen($text);
	$text_len++;
	if($this->pcre_backtrack_limit < $text_len)
	{
		@ini_set("pcre.backtrack_limit", $text_len);
		$this->pcre_backtrack_limit = intval(ini_get("pcre.backtrack_limit"));
	}
	$this->maxFileSize = intval(COption::GetOptionInt("subscribe", "max_file_size"));
	$this->aMatches = array();
	$text = preg_replace_callback(
		"/(]*?(?<=\s)src\s*=\s*)(["']?)(.*?)(\2)(\s.+?>|\s*>)/is",
		array(&$this, "__replace_img"),
		$text
	);
	$text = preg_replace_callback(
		"/(background-image\s*:\s*url\s*\()(["']?)(.*?)(\2)(\s*\);)/is",
		array(&$this, "__replace_img"),
		$text
	);
	$text = preg_replace_callback(
		"/(]*?(?<=\s)background\s*=\s*)(["']?)(.*?)(\2)(\s.+?>|\s*>)/is",
		array(&$this, "__replace_img"),
		$text
	);
	$text = preg_replace_callback(
		"/(]*?(?<=\s)background\s*=\s*)(["']?)(.*?)(\2)(\s.+?>|\s*>)/is",
		array(&$this, "__replace_img"),
		$text
	);
	return $text;
}