Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
blacklistemail.php
1<?php
2
4
7
8class BlacklistEmail extends \Bitrix\Mail\EO_Blacklist
9{
10 public static function getDataClass()
11 {
12 return BlacklistTable::class;
13 }
14
15 public function convertDomainToPunycode()
16 {
17 $email = $this->getItemValue();
18 if (!$email)
19 {
20 return '';
21 }
22 $convertingPart = $email;
23 $firstPart = '';
24 if (count(explode('@', $email)) === 2)
25 {
26 $list = explode('@', $email);
27 $convertingPart = array_pop($list);
28 $firstPart = array_shift($list) . '@';
29 }
30
31 $encoder = new \CBXPunycode();
32 $encodedPart = $encoder->encode($convertingPart);
33 if ($encodedPart !== false)
34 {
35 return $firstPart . $encodedPart;
36 }
37 return '';
38 }
39
40 public function isDomainType()
41 {
42 return ItemType::DOMAIN === $this->getItemType();
43 }
44
45 public function isEmailType()
46 {
47 return ItemType::EMAIL === $this->getItemType();
48 }
49
50}