Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
validator.php
1
<?php
8
namespace
Bitrix\Sender\Recipient
;
9
10
use
Bitrix\Main\Localization\Loc
;
11
12
Loc::loadMessages
(__FILE__);
13
18
class
Validator
19
{
27
public
static
function
validate
($code, $typeId = Type::EMAIL)
28
{
29
switch
($typeId)
30
{
31
case
Type::IM:
32
return
self::validateIm
($code);
33
34
case
Type::PHONE:
35
return
self::validatePhone
($code);
36
37
case
Type::CRM_CONTACT_ID:
38
case
Type::CRM_COMPANY_ID:
39
return
self::validateCrmEntityId
($code);
40
41
case
Type::EMAIL:
42
default
:
43
return
self::validateEmail
($code);
44
}
45
}
46
53
public
static
function
validateEmail
($email)
54
{
55
return
check_email($email);
56
}
57
64
public
static
function
validatePhone
($phone)
65
{
66
return
(
bool
) preg_match(
'/^[\+]?[\d]{4,25}$/'
, $phone);
67
}
68
75
public
static
function
validateIm
($code)
76
{
77
return
(
bool
) preg_match(
'/^[\d]+\|[\d]+$/'
, $code);
78
}
79
86
public
static
function
validateCrmEntityId
($code)
87
{
88
return
(
bool
) preg_match(
'/^[\d]$/'
, $code);
89
}
90
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Sender\Recipient\Validator
Definition
validator.php:19
Bitrix\Sender\Recipient\Validator\validatePhone
static validatePhone($phone)
Definition
validator.php:64
Bitrix\Sender\Recipient\Validator\validate
static validate($code, $typeId=Type::EMAIL)
Definition
validator.php:27
Bitrix\Sender\Recipient\Validator\validateCrmEntityId
static validateCrmEntityId($code)
Definition
validator.php:86
Bitrix\Sender\Recipient\Validator\validateEmail
static validateEmail($email)
Definition
validator.php:53
Bitrix\Sender\Recipient\Validator\validateIm
static validateIm($code)
Definition
validator.php:75
Bitrix\Sender\Recipient
Definition
agent.php:8
modules
sender
lib
recipient
validator.php
Создано системой
1.10.0