• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/functions.php
  • Класс: CSocNetTextParser
  • Вызов: CSocNetTextParser::convert_image_tag
function convert_image_tag($url = "", $type = "html")
{
	static $bShowedScript = false;
	if ($url == '') return;
	$url = trim($url);
	$type = (mb_strtolower($type) == "rss" ? "rss" : "html");
	$extension = preg_replace("/^.*.(S+)$/".BX_UTF_PCRE_MODIFIER, "\1", $url);
	$extension = mb_strtolower($extension);
	$extension = preg_quote($extension, "/");

	$bErrorIMG = False;
	if (preg_match("/[?&;]/".BX_UTF_PCRE_MODIFIER, $url)) $bErrorIMG = True;
	if (!$bErrorIMG && !preg_match("/$extension(||$)/".BX_UTF_PCRE_MODIFIER, $this->allow_img_ext)) $bErrorIMG = True;
	if (!$bErrorIMG && !preg_match("/^(http|https|ftp|/)/i".BX_UTF_PCRE_MODIFIER, $url)) $bErrorIMG = True;

	if ($bErrorIMG)
	{
		return "[img]".$url."[/img]";
	}

	return ''.GetMessage(';
}