1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
yacounter.php
См. документацию.
1
<?php
2
namespace
Bitrix\Landing\Hook\Page;
3
4
use \Bitrix\Landing\Field;
5
use \Bitrix\Main\Localization\Loc;
6
use \Bitrix\Landing\Manager;
7
8
Loc::loadMessages(__FILE__);
9
10
class
YaCounter
extends
\Bitrix\Landing\Hook\Page
11
{
16
protected
function
getMap
()
17
{
18
$helpUrl =
\Bitrix\Landing\Help::getHelpUrl
(
'YACOUNTER'
);
19
return
array
(
20
'USE'
=>
new
Field
\
Checkbox
(
'USE'
,
array
(
21
'title'
=> Loc::getMessage(
'LANDING_HOOK_YACOUNTER_USE'
)
22
)),
23
'COUNTER'
=>
new
Field
\
Text
(
'COUNTER'
,
array
(
24
'title'
=> Loc::getMessage(
'LANDING_HOOK_YACOUNTER_COUNTER'
),
25
'placeholder'
=> Loc::getMessage(
'LANDING_HOOK_YACOUNTER_PLACEHOLDER'
),
26
'help'
=> $helpUrl
27
?
'<a href="'
. $helpUrl .
'" target="_blank">'
.
28
Loc::getMessage(
'LANDING_HOOK_DETAIL_HELP'
) .
29
'</a>'
30
:
''
31
))
32
);
33
}
34
39
public
function
isFree
()
40
{
41
return
false
;
42
}
43
48
public
function
isLocked
()
49
{
50
return
!
\Bitrix\Landing\Restriction\Manager::isAllowed
(
51
'limit_sites_google_analytics'
52
);
53
}
54
59
public
function
enabled
()
60
{
61
if
($this->
isLocked
())
62
{
63
return
false
;
64
}
65
66
if
($this->
issetCustomExec
())
67
{
68
return
true
;
69
}
70
71
return
$this->fields[
'USE'
]->getValue() ==
'Y'
;
72
}
73
78
public
function
enabledInEditMode
()
79
{
80
return
false
;
81
}
82
87
public
function
exec
()
88
{
89
if
($this->
execCustom
())
90
{
91
return
;
92
}
93
94
if
($this->fields[
'USE'
]->getValue() !=
'Y'
)
95
{
96
return
;
97
}
98
99
$this->
setCounter
($this->fields[
'COUNTER'
]);
100
}
101
107
public
static
function
setCounter
(
string
$counter
): void
108
{
109
$counter
=
\htmlspecialcharsbx
(trim(
$counter
));
110
$counter
= \CUtil::jsEscape(
$counter
);
111
if
(!
$counter
)
112
{
113
return
;
114
}
115
116
Cookies::addCookieScript
(
117
'ym'
,
118
'(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
119
m[i].l=1*new Date();
120
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
121
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
122
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
123
ym(\''
.
$counter
.
'\'
,
"init"
, {
124
clickmap:
true
,
125
trackLinks:
true
,
126
accurateTrackBounce:
true
,
127
webvisor:
true
,
128
trackHash:
true
,
129
ecommerce:
"dataLayer"
130
});
'
131
);
132
Manager::setPageView(
133
'
Noscript
',
134
'
<noscript>
135
<div><img src=
"https://mc.yandex.ru/watch/' . $counter . '"
style
=
"position:absolute; left:-9999px;"
alt=
""
/></div>
136
</noscript>
'
137
);
138
}
139
}
Bitrix\Landing\Field\Checkbox
Определения
checkbox.php:5
Bitrix\Landing\Help\getHelpUrl
static getHelpUrl(string $code)
Определения
help.php:174
Bitrix\Landing\Hook\Page\Cookies\addCookieScript
static addCookieScript(string $cookieCode, string $functionBody)
Определения
cookies.php:167
Bitrix\Landing\Hook\Page\YaCounter
Определения
yacounter.php:11
Bitrix\Landing\Hook\Page\YaCounter\isLocked
isLocked()
Определения
yacounter.php:48
Bitrix\Landing\Hook\Page\YaCounter\setCounter
static setCounter(string $counter)
Определения
yacounter.php:107
Bitrix\Landing\Hook\Page\YaCounter\getMap
getMap()
Определения
yacounter.php:16
Bitrix\Landing\Hook\Page\YaCounter\enabledInEditMode
enabledInEditMode()
Определения
yacounter.php:78
Bitrix\Landing\Hook\Page\YaCounter\enabled
enabled()
Определения
yacounter.php:59
Bitrix\Landing\Hook\Page\YaCounter\exec
exec()
Определения
yacounter.php:87
Bitrix\Landing\Hook\Page\YaCounter\isFree
isFree()
Определения
yacounter.php:39
Bitrix\Landing\Hook\Page\issetCustomExec
issetCustomExec()
Определения
page.php:253
Bitrix\Landing\Hook\Page\execCustom
execCustom()
Определения
page.php:262
Bitrix\Landing\Restriction\Manager\isAllowed
static isAllowed(string $code, array $params=[], string $cacheSalt='')
Определения
manager.php:214
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
htmlspecialcharsbx
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения
tools.php:2701
Bitrix\Landing\Field
Определения
checkbox.php:2
Bitrix\Landing\Hook\Page
Определения
b24button.php:2
Bitrix\Main\Text
Определения
base32.php:2
$counter
$counter
Определения
options.php:5
style
font style
Определения
invoice.php:442
bitrix
modules
landing
lib
hook
page
yacounter.php
Создано системой
1.14.0