Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
pixelvk.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
PixelVk
extends
\Bitrix\Landing\Hook\Page
11
{
16
protected
function
getMap
()
17
{
18
$helpUrl = \Bitrix\Landing\Help::getHelpUrl(
'PIXEL'
);
19
return
array(
20
'USE'
=>
new
Field
\
Checkbox
(
'USE'
, array(
21
'title'
=>
Loc::getMessage
(
'LANDING_HOOK_PIXEL_VK_USE'
)
22
)),
23
'COUNTER'
=>
new
Field
\
Text
(
'COUNTER'
, array(
24
'title'
=>
Loc::getMessage
(
'LANDING_HOOK_PIXEL_VK_COUNTER'
),
25
'placeholder'
=>
Loc::getMessage
(
'LANDING_HOOK_PIXEL_VK_PLACEHOLDER2'
),
26
'help'
=> $helpUrl
27
?
'<a href="'
. $helpUrl .
'" target="_blank">'
.
28
Loc::getMessage
(
'LANDING_HOOK_PIXEL_VK_HELP'
) .
29
'</a>'
30
:
''
31
))
32
);
33
}
34
39
public
function
enabledInEditMode
()
40
{
41
return
false
;
42
}
43
48
public
function
enabled
()
49
{
50
if
($this->
issetCustomExec
())
51
{
52
return
true
;
53
}
54
55
return
$this->fields[
'USE'
]->getValue() ==
'Y'
;
56
}
57
62
public
function
exec
()
63
{
64
if
($this->
execCustom
())
65
{
66
return
;
67
}
68
69
$counter = \htmlspecialcharsbx(trim($this->fields[
'COUNTER'
]));
70
$counter = \CUtil::jsEscape($counter);
71
if
($counter)
72
{
73
Cookies::addCookieScript
(
74
'vkp'
,
75
'!function(){
76
var t=document.createElement("script");
77
t.type="text/javascript",
78
t.async=!0,
79
t.src="https://vk.com/js/api/openapi.js?160",
80
t.onload=function(){VK.Retargeting.Init("'
. $counter .
'"),
81
VK.Retargeting.Hit()},document.head.appendChild(t)
82
}();'
83
);
84
Manager::setPageView
(
85
'Noscript'
,
86
'<noscript>
87
<img src="https://vk.com/rtrg?p='
. $counter .
'" style="position:fixed; left:-999px;" alt=""/>
88
</noscript>'
89
);
90
}
91
}
92
}
Bitrix\Landing\Field\Checkbox
Definition
checkbox.php:5
Bitrix\Landing\Field\Text
Definition
text.php:5
Bitrix\Landing\Field
Definition
field.php:5
Bitrix\Landing\Hook\Page\Cookies\addCookieScript
static addCookieScript(string $cookieCode, string $functionBody)
Definition
cookies.php:167
Bitrix\Landing\Hook\Page\PixelVk
Definition
pixelvk.php:11
Bitrix\Landing\Hook\Page\PixelVk\getMap
getMap()
Definition
pixelvk.php:16
Bitrix\Landing\Hook\Page\PixelVk\enabledInEditMode
enabledInEditMode()
Definition
pixelvk.php:39
Bitrix\Landing\Hook\Page\PixelVk\enabled
enabled()
Definition
pixelvk.php:48
Bitrix\Landing\Hook\Page\PixelVk\exec
exec()
Definition
pixelvk.php:62
Bitrix\Landing\Hook\Page
Definition
page.php:7
Bitrix\Landing\Hook\Page\issetCustomExec
issetCustomExec()
Definition
page.php:253
Bitrix\Landing\Hook\Page\execCustom
execCustom()
Definition
page.php:262
Bitrix\Landing\Manager\setPageView
static setPageView(string $marker, string $content, bool $skipTrim=false)
Definition
manager.php:465
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\Landing\Hook\Page
Definition
b24button.php:2
modules
landing
lib
hook
page
pixelvk.php
Создано системой
1.10.0