1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
blacklist.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Main\Mail\Internal
;
4
5
use
Bitrix\Main\Application
;
6
use
Bitrix\Main\Type\DateTime
;
7
use
Bitrix\Main\ORM\Data\DataManager
;
8
27
class
BlacklistTable
extends
DataManager
28
{
29
const
CategoryAuto
= 0;
30
const
CategoryManual
= 1;
31
37
public
static
function
getTableName
()
38
{
39
return
'b_main_mail_blacklist'
;
40
}
41
47
public
static
function
getMap
()
48
{
49
return
array
(
50
'ID'
=>
array
(
51
'data_type'
=>
'integer'
,
52
'primary'
=>
true
,
53
'autocomplete'
=>
true
,
54
),
55
'CATEGORY_ID'
=>
array
(
56
'data_type'
=>
'integer'
,
57
'required'
=>
true
,
58
'default_value'
=> self::CategoryAuto,
59
),
60
'CODE'
=>
array
(
61
'data_type'
=>
'string'
,
62
'required'
=>
true
,
63
),
64
'DATE_INSERT'
=>
array
(
65
'data_type'
=>
'datetime'
,
66
'required'
=>
new
DateTime
(),
67
),
68
);
69
}
70
76
public
static
function
hasBlacklistedEmails
()
77
{
78
static
$hasEmails =
null
;
79
if
($hasEmails ===
null
)
80
{
81
$row = static::getRow([
82
'select'
=> [
'ID'
],
83
'limit'
=> 1,
84
'order'
=> [
'ID'
=>
'ASC'
],
85
'cache'
=> [
'ttl'
=> 36000]
86
]);
87
88
$hasEmails = $row !==
null
;
89
}
90
91
return
$hasEmails;
92
}
93
100
public
static
function
insertBatch
(
array
$list)
101
{
102
$connection
=
Application::getConnection
();
103
$helper =
$connection
->getSqlHelper();
104
$tableName = static::getTableName();
105
$dateNow = $helper->convertToDbDateTime(
new
DateTime
());
106
107
foreach
(self::divideList($list) as $batchList)
108
{
109
$values = [];
110
foreach
($batchList as
$code
)
111
{
112
$code
= trim(
$code
);
113
if
(!
$code
)
114
{
115
continue
;
116
}
117
118
$code
= $helper->forSql(
$code
);
119
$values[] =
"$dateNow, \"$code\""
;
120
}
121
122
if
(empty($values))
123
{
124
return
;
125
}
126
127
$values =
'('
. implode(
'), ('
, $values) .
')'
;
128
129
$sql = $helper->getInsertIgnore($tableName,
'(DATE_INSERT, CODE)'
,
'VALUES '
. $values);
130
$connection
->query($sql);
131
132
static::getEntity()->cleanCache();
133
}
134
}
135
136
protected
static
function
divideList
(
array
$list, $limit = 300)
137
{
138
$length =
count
($list);
139
if
($length < $limit)
140
{
141
return
array
($list);
142
}
143
144
$result
=
array
();
145
$partsCount = ceil($length / $limit);
146
for
($index = 0; $index < $partsCount; $index++)
147
{
148
$result
[$index] = array_slice($list, $limit * $index, $limit);
149
}
150
151
return
$result
;
152
}
153
}
$connection
$connection
Определения
actionsdefinitions.php:38
Bitrix\Main\Application
Определения
application.php:30
Bitrix\Main\Application\getConnection
static getConnection($name="")
Определения
application.php:638
Bitrix\Main\Mail\Internal\BlacklistTable
Определения
blacklist.php:28
Bitrix\Main\Mail\Internal\BlacklistTable\CategoryAuto
const CategoryAuto
Определения
blacklist.php:29
Bitrix\Main\Mail\Internal\BlacklistTable\getMap
static getMap()
Определения
blacklist.php:47
Bitrix\Main\Mail\Internal\BlacklistTable\CategoryManual
const CategoryManual
Определения
blacklist.php:30
Bitrix\Main\Mail\Internal\BlacklistTable\divideList
static divideList(array $list, $limit=300)
Определения
blacklist.php:136
Bitrix\Main\Mail\Internal\BlacklistTable\getTableName
static getTableName()
Определения
blacklist.php:37
Bitrix\Main\Mail\Internal\BlacklistTable\insertBatch
static insertBatch(array $list)
Определения
blacklist.php:100
Bitrix\Main\Mail\Internal\BlacklistTable\hasBlacklistedEmails
static hasBlacklistedEmails()
Определения
blacklist.php:76
Bitrix\Main\ORM\Data\DataManager
Определения
datamanager.php:35
Bitrix\Main\Type\DateTime
Определения
datetime.php:9
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$code
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения
options.php:195
Bitrix\Main\Mail\Internal
Определения
blacklist.php:3
count
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения
waybill.php:936
bitrix
modules
main
lib
mail
internal
blacklist.php
Создано системой
1.14.0