Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/sender/lib/recipient/ |
Upload File : |
<?php /** * Bitrix Framework * @package bitrix * @subpackage sender * @copyright 2001-2012 Bitrix */ namespace Bitrix\Sender\Recipient; use Bitrix\Main\Localization\Loc; use Bitrix\Sender\Internals\ClassConstant; Loc::loadMessages(__FILE__); /** * Class Type * @package Bitrix\Sender\Recipient */ class Type extends ClassConstant { const EMAIL = 1; const PHONE = 2; const IM = 3; const CRM_COMPANY_ID = 4; const CRM_CONTACT_ID = 5; const CRM_LEAD_ID = 10; const CRM_DEAL_PRODUCT_CONTACT_ID = 6; const CRM_ORDER_PRODUCT_CONTACT_ID = 7; const CRM_DEAL_PRODUCT_COMPANY_ID = 8; const CRM_ORDER_PRODUCT_COMPANY_ID = 9; /** * Detect type by recipient code. * * @param string $recipientCode Recipient code. * @param bool $isNormalized Is code normalized. * @return integer|null */ public static function detect($recipientCode, $isNormalized = false) { $list = self::getNamedList(); unset($list[self::PHONE]); $list = array_keys($list); $list[] = self::PHONE; foreach ($list as $id) { if ($isNormalized) { $normalizedCode = $recipientCode; } else { $normalizedCode = Normalizer::normalize($recipientCode, $id); } if (!Validator::validate($normalizedCode, $id)) { continue; } return $id; } return null; } /** * Get caption. * * @param integer $id ID. * @return integer|null */ public static function getName($id) { $code = self::getCode($id); $name = Loc::getMessage('SENDER_TYPE_CAPTION_' . $code) ?: $code; return $name; } }