1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
mailblockbase.php
См. документацию.
1
<?php
8
namespace
Bitrix\Sender\Preset;
9
10
use Bitrix\Main\Entity;
11
use Bitrix\Main\EventResult;
12
use Bitrix\Main\Event;
13
use Bitrix\Main\IO\File;
14
use Bitrix\Main\Localization\Loc;
15
16
Loc::loadMessages(__FILE__);
17
24
class
MailBlockBase
25
{
29
const
LOCAL_DIR_BLOCK
=
'/modules/sender/preset/mailblock/'
;
30
34
public
static
function
onPresetMailBlockList
()
35
{
36
return
static::getList();
37
}
38
42
public
static
function
getList
()
43
{
44
$resultList =
array
();
45
46
$arBlockByType = static::getBlockListByType();
47
48
foreach
($arBlockByType as
$type
=> $arBlock)
49
{
50
foreach
($arBlock as $blockName)
51
{
52
$result
= static::getById($blockName);
53
if
(!empty(
$result
))
54
{
55
$resultList[] =
$result
;
56
}
57
}
58
}
59
60
$resultListPersonal =
array
();
61
foreach
(\
Bitrix
\
Sender
\
PostingRecipientTable::getPersonalizeList
() as $arPersonalizeBlock)
62
{
63
$resultListPersonal[] =
array
(
64
'TYPE'
=> Loc::getMessage(
'TYPE_PRESET_MAILBLOCK_PERSONALISE'
),
65
'CODE'
=> $arPersonalizeBlock[
'CODE'
],
66
'NAME'
=> $arPersonalizeBlock[
'NAME'
],
67
'DESC'
=> $arPersonalizeBlock[
'DESC'
],
68
'ICON'
=>
''
,
69
'HTML'
=>
'#'
. $arPersonalizeBlock[
'CODE'
] .
'#'
70
);
71
}
72
73
$resultList = array_merge($resultListPersonal, $resultList);
74
75
return
$resultList;
76
}
77
81
public
static
function
getBlockListByType
()
82
{
83
$arBlockByType =
array
(
84
'BASE'
=>
array
(
85
'unsub'
,
86
'image'
,
87
'text'
,
88
'line'
,
89
'image_text'
,
90
'text_image'
,
91
'image2'
,
92
'image3'
,
93
'text2'
,
94
'text3'
,
95
)
96
);
97
98
return
$arBlockByType;
99
}
100
105
public
static
function
getById
($blockName)
106
{
107
$result
=
null
;
108
$type
=
null
;
109
110
$arBlockByType = static::getBlockListByType();
111
foreach
($arBlockByType as $searchType => $arBlock)
112
{
113
foreach
($arBlock as $searchBlockName)
114
{
115
if
($blockName == $searchBlockName)
116
{
117
$type
= $searchType;
118
break
;
119
}
120
}
121
}
122
123
$fullPathOfFile =
\Bitrix\Main\Loader::getLocal
(static::LOCAL_DIR_BLOCK .
bx_basename
($blockName) .
'.html'
);
124
if
($fullPathOfFile)
125
{
126
$fileContent
= File::getFileContents($fullPathOfFile);
127
128
if
($blockName ==
'unsub'
)
129
{
130
$fileContent
= str_replace(
131
array
(
'%TEXT_UNSUB_TEXT%'
,
'%TEXT_UNSUB_LINK%'
),
132
array
(
133
Loc::getMessage(
'PRESET_MAILBLOCK_'
. $blockName.
'_TEXT_UNSUB_TEXT'
),
134
Loc::getMessage(
'PRESET_MAILBLOCK_'
. $blockName.
'_TEXT_UNSUB_LINK'
)
135
),
136
$fileContent
137
);
138
}
139
140
$result
=
array
(
141
'TYPE'
=> Loc::getMessage(
'TYPE_PRESET_MAILBLOCK_'
.
$type
),
142
'CODE'
=> $blockName,
143
'NAME'
=> Loc::getMessage(
'PRESET_MAILBLOCK_'
. $blockName),
144
'ICON'
=>
''
,
145
'HTML'
=>
$fileContent
146
);
147
}
148
149
150
return
$result
;
151
}
152
158
public
static
function
update
($blockName, $html)
159
{
160
$result
=
false
;
161
$fullPathOfFile =
\Bitrix\Main\Loader::getLocal
(static::LOCAL_DIR_BLOCK .
bx_basename
($blockName) .
'.html'
);
162
if
($fullPathOfFile)
163
$result
= File::putFileContents($fullPathOfFile, $html);
164
165
return
$result
;
166
}
167
}
$type
$type
Определения
options.php:106
Bitrix\Main\Loader\getLocal
static getLocal($path, $root=null)
Определения
loader.php:572
Bitrix\Sender\PostingRecipientTable\getPersonalizeList
static getPersonalizeList()
Определения
posting.php:773
Bitrix\Sender\Preset\MailBlockBase
Определения
mailblockbase.php:25
Bitrix\Sender\Preset\MailBlockBase\update
static update($blockName, $html)
Определения
mailblockbase.php:158
Bitrix\Sender\Preset\MailBlockBase\getById
static getById($blockName)
Определения
mailblockbase.php:105
Bitrix\Sender\Preset\MailBlockBase\onPresetMailBlockList
static onPresetMailBlockList()
Определения
mailblockbase.php:34
Bitrix\Sender\Preset\MailBlockBase\LOCAL_DIR_BLOCK
const LOCAL_DIR_BLOCK
Определения
mailblockbase.php:29
Bitrix\Sender\Preset\MailBlockBase\getBlockListByType
static getBlockListByType()
Определения
mailblockbase.php:81
Bitrix\Sender\Preset\MailBlockBase\getList
static getList()
Определения
mailblockbase.php:42
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$fileContent
$fileContent
Определения
file_property.php:47
$result
$result
Определения
get_property_values.php:14
bx_basename
bx_basename($path, $ext="")
Определения
tools.php:3269
Bitrix\Sender
Bitrix
bitrix
modules
sender
lib
preset
mailblockbase.php
Создано системой
1.14.0