- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/lib/mail/mail.php
- Класс: BitrixMainMailMail
- Вызов: Mail::trackClick
public function trackClick($matches)
{
$href = $matches[3];
if ($href == "")
{
return $matches[0];
}
if(mb_substr($href, 0, 2) == '//')
{
$href = $this->trackLinkProtocol . ':' . $href;
}
if(mb_substr($href, 0, 1) == '/')
{
$href = $this->trackLinkProtocol . '://' . $this->settingServerName . $href;
}
if($this->trackClickLink)
{
if($this->trackClickUrlParams)
{
$hrefAddParam = '';
foreach($this->trackClickUrlParams as $k => $v)
$hrefAddParam .= '&'.htmlspecialcharsbx($k).'='.htmlspecialcharsbx($v);
$parsedHref = explode("#", $href);
$parsedHref[0] .= (strpos($parsedHref[0], '?') === false? '?' : '&').mb_substr($hrefAddParam, 1);
$href = implode("#", $parsedHref);
}
$href = $this->trackClickLink . '&url=' . urlencode($href) . '&sign=' . urlencode(Tracking::getSign($href));
if (!preg_match('/^http://|https:///', $this->trackClickLink))
{
$href = $this->trackLinkProtocol . '://' . $this->settingServerName . $href;
}
}
return $matches[1].$matches[2].$href.$matches[4].$matches[5];
}