• Модуль: seo
  • Путь к файлу: ~/bitrix/modules/seo/lib/retargeting/services/audienceyandex.php
  • Класс: BitrixSeoRetargetingServicesAudienceYandex
  • Вызов: AudienceYandex::prepareContacts
protected function prepareContacts(array $contacts = array(), $hashed = false, $type = '')
{
	// filter by type
	if ($type)
	{
		$contacts = [
			$type => isset($contacts[$type]) ? $contacts[$type] : []
		];
	}

	// prepare data
	$eol = "rn";
	$separator = ",";
	$types = array_keys($contacts);
	$typeCount = count($types);
	$result = implode($separator, $types);
	foreach ($types as $index => $contactType)
	{
		foreach ($contacts[$contactType] as $contact)
		{
			$contact = $hashed ? md5($contact) : $contact;
			$data = array_fill(0, $typeCount, "");
			$data[$index] = $contact;
			$result .= $eol . implode($separator, $data);
		}
	}

	return $result;
}