Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
consent.php
1
<?php
8
namespace
Bitrix\Sender\Preset\Templates
;
9
10
use
Bitrix\Main\IO\File
;
11
use
Bitrix\Main\Loader
;
12
use
Bitrix\Main\Localization\Loc
;
13
use
Bitrix\UI
;
14
15
Loc::loadMessages
(__FILE__);
16
21
class
Consent
22
{
23
const
LOCAL_DIR
=
'/modules/sender/preset/consent/'
;
24
25
private
static
function
getFileContent($fileName)
26
{
27
$path = Loader::getLocal(self::LOCAL_DIR . bx_basename($fileName) .
'.php'
);
28
if
($path &&
File::isFileExists
($path))
29
{
30
return
File::getFileContents
($path);
31
}
32
33
return
''
;
34
}
35
42
public
static
function
replaceTemplateHtml
($content, $replace = [])
43
{
44
$content = str_replace(
45
array(
46
'%SUBJECT%'
,
47
'%CONSENT_BODY%'
,
48
'%APPROVE%'
,
49
'%REJECT%'
,
50
'%CONSENT_FOOTER%'
,
51
'%FONTS_PROXY_DOMAIN%'
,
52
'#SENDER_CONSENT_APPLY#'
,
53
'#SENDER_CONSENT_REJECT#'
,
54
),
55
array(
56
Loc::getMessage
(
'SENDER_PRESET_TEMPLATE_CONSENT_SUBJECT'
),
57
$replace[
'CONSENT_BODY'
],
58
Loc::getMessage
(
'SENDER_PRESET_TEMPLATE_CONSENT_APPROVE'
),
59
Loc::getMessage
(
'SENDER_PRESET_TEMPLATE_CONSENT_REJECT'
),
60
$replace[
'CONSENT_FOOTER'
],
61
UI\Fonts\Proxy::resolveDomain(),
62
$replace[
'APPLY_URL'
],
63
$replace[
'REJECT_URL'
],
64
),
65
$content
66
);
67
68
return
Texts::replace($content);
69
}
70
71
public
static
function
getApproveBtnText
($agreement)
72
{
73
return
$agreement && $agreement->getLabelText()
74
? $agreement->getLabelText() :
Loc::getMessage
(
'SENDER_PRESET_TEMPLATE_CONSENT_APPROVE'
);
75
}
76
77
public
static
function
getRejectnBtnText
()
78
{
79
return
Loc::getMessage
(
'SENDER_PRESET_TEMPLATE_CONSENT_REJECT'
);
80
}
81
87
public
static
function
getTemplateHtml
()
88
{
89
$fileContent = self::getFileContent(
'template'
);
90
91
if
(!$fileContent)
92
{
93
return
null
;
94
}
95
96
return
$fileContent;
97
}
98
}
Bitrix\Main\IO\File
Definition
file.php:7
Bitrix\Main\IO\File\isFileExists
static isFileExists($path)
Definition
file.php:256
Bitrix\Main\IO\File\getFileContents
static getFileContents($path)
Definition
file.php:262
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Sender\Consent\Consent
Definition
consent.php:16
Bitrix\Sender\Preset\Templates\Consent\replaceTemplateHtml
static replaceTemplateHtml($content, $replace=[])
Definition
consent.php:42
Bitrix\Sender\Preset\Templates\Consent\getTemplateHtml
static getTemplateHtml()
Definition
consent.php:87
Bitrix\Sender\Preset\Templates\Consent\LOCAL_DIR
const LOCAL_DIR
Definition
consent.php:23
Bitrix\Sender\Preset\Templates\Consent\getRejectnBtnText
static getRejectnBtnText()
Definition
consent.php:77
Bitrix\Sender\Preset\Templates\Consent\getApproveBtnText
static getApproveBtnText($agreement)
Definition
consent.php:71
Bitrix\Sender\Preset\Templates
Definition
audiocall.php:9
Bitrix\UI
modules
sender
lib
preset
templates
consent.php
Создано системой
1.10.0