1C-Bitrix
25.700.0
Toggle main menu visibility
Титульная страница
Пространства имен
Пространства имен
Члены пространств имен
Указатель
$
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Функции
_
a
c
d
e
f
g
h
i
k
l
m
o
p
r
s
t
u
v
w
Переменные
$
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
v
w
Перечисления
a
b
c
d
e
f
g
l
m
n
o
p
r
s
t
u
v
w
Элементы перечислений
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Структуры данных
Структуры данных
Алфавитный указатель структур данных
Иерархия классов
Поля структур
Указатель
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Функции
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Переменные
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Перечисления
Элементы перечислений
Файлы
Файлы
Список членов всех файлов
Указатель
$
(
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
б
в
к
л
о
п
с
т
ю
Функции
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Переменные
$
(
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
y
б
в
к
л
о
п
с
т
ю
Блог
Хостинг
•
Указатель
Структуры данных
Пространства имен
Файлы
Функции
Переменные
Перечисления
Элементы перечислений
Страницы
Загрузка...
Поиск...
Не найдено
text.php
См. документацию.
1
<?php
8
namespace
Bitrix\Main\UserConsent;
9
10
use Bitrix\Main\Localization\Loc;
11
12
Loc::loadLanguageFile(__FILE__);
13
18
class
Text
19
{
28
public
static
function
replace
(
$template
,
array
$data
, $isCut =
false
)
29
{
30
$from =
array
();
31
$to =
array
();
32
33
$dataTmp =
array
();
34
foreach
(
$data
as
$key
=> $value)
35
{
36
$key
= mb_strtolower(
$key
);
37
if
(is_array($value))
38
{
39
$value = self::formatArrayToText($value);
40
}
41
else
42
{
43
$value = (string) $value;
44
}
45
46
$dataTmp[
$key
] = $value;
47
}
48
$data
= $dataTmp;
49
50
foreach
(
$data
as
$key
=> $value)
51
{
52
$from[] =
'%'
.
$key
.
'%'
;
53
$to[] = $value;
54
}
55
56
$template
= str_replace($from, $to,
$template
);
57
58
if
($isCut)
59
{
60
$template
= self::cut(
$template
,
$data
);
61
}
62
63
return
$template
;
64
}
28
public
static
function
replace
(
$template
,
array
$data
, $isCut =
false
) {
…
}
65
66
protected
static
function
cut
(
$template
,
array
$data
)
67
{
68
$from =
array
();
69
$to =
array
();
70
71
$matchResult = preg_match_all(
'/\%cut\.([A-Za-z0-9_\.]*)\.(start|end)\%/'
,
$template
,
$matches
, PREG_OFFSET_CAPTURE);
72
if
(!$matchResult)
73
{
74
return
$template
;
75
}
76
77
$cut =
array
();
78
foreach
(
$matches
[0] as
$key
=> $match)
79
{
80
$tag = $match[0];
81
$pos = $match[1];
82
$var
=
$matches
[1][
$key
][0];
83
$mod
=
$matches
[2][
$key
][0];
84
85
$from[] = $tag;
86
$to[] =
''
;
87
88
if
(!isset($cut[
$var
]))
89
{
90
$cut[
$var
] =
array
(
'start'
=>
array
(),
'end'
=>
array
());
91
}
92
93
if
(!isset($cut[
$var
][
$mod
]))
94
{
95
continue
;
96
}
97
98
if
(
$mod
==
'end'
)
99
{
100
$pos += strlen($tag);
101
}
102
103
$cut[
$var
][
$mod
][] = $pos;
104
}
105
106
$items
=
array
();
107
foreach
($cut as
$key
=> $item)
108
{
109
110
foreach
($item[
'start'
] as $index => $position)
111
{
112
if
(!isset($item[
'end'
][$index]))
113
{
114
continue
;
115
}
116
117
$sortBy = $item[
'end'
][$index];
118
$items
[$sortBy] =
array
(
119
'key'
=>
$key
,
120
'start'
=> $item[
'start'
][$index],
121
'end'
=> $item[
'end'
][$index]
122
);
123
}
124
}
125
126
krsort(
$items
);
127
foreach
(
$items
as $item)
128
{
129
if
(!empty(
$data
[$item[
'key'
]]))
130
{
131
continue
;
132
}
133
134
$start
= $item[
'start'
];
135
$end = $item[
'end'
];
136
if
(
$start
<= 0 || $end <= 0)
137
{
138
continue
;
139
}
140
141
$template
= substr(
$template
, 0,
$start
) . substr(
$template
, $end);
142
}
143
144
return
str_replace($from, $to,
$template
);
145
}
66
protected
static
function
cut
(
$template
,
array
$data
) {
…
}
146
153
public
static
function
formatArrayToText
(
array
$list)
154
{
155
$result
=
array
();
156
$num = 0;
157
$count
=
count
($list);
158
159
foreach
($list as $item)
160
{
161
$num++;
162
$isLast = $num >=
$count
;
163
$result
[] =
'- '
. $item . ($isLast ?
'.'
:
';'
);
164
}
165
166
return
implode(
"\n"
,
$result
);
167
}
153
public
static
function
formatArrayToText
(
array
$list) {
…
}
168
}
18
class
Text
{
…
};
$count
$count
Определения
admin_tab.php:4
Bitrix\Main\UserConsent\Text\cut
static cut($template, array $data)
Определения
text.php:66
Bitrix\Main\UserConsent\Text\formatArrayToText
static formatArrayToText(array $list)
Определения
text.php:153
Bitrix\Main\UserConsent\Text\replace
static replace($template, array $data, $isCut=false)
Определения
text.php:28
$mod
if($childrenCount<=0) $mod
Определения
sync.php:11
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
$template
$template
Определения
file_edit.php:49
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
$start
$start
Определения
get_search.php:9
Bitrix\Main\Text
Определения
base32.php:2
$var
$var
Определения
payment.php:63
$key
if(empty($signedUserToken)) $key
Определения
quickway.php:257
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
$items
$items
Определения
template.php:224
$matches
$matches
Определения
index.php:22
bitrix
modules
main
lib
userconsent
text.php
Создано системой
1.14.0