1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
headblock.php
См. документацию.
1
<?php
2
namespace
Bitrix\Landing\Hook\Page;
3
4
use \Bitrix\Landing\Field;
5
use \Bitrix\Landing\Manager;
6
use \Bitrix\Main\ModuleManager;
7
use \Bitrix\Main\Localization\Loc;
8
9
Loc::loadMessages(__FILE__);
10
11
class
HeadBlock
extends
\Bitrix\Landing\Hook\Page
12
{
17
protected
static
$lastInsertedCode
=
null
;
18
23
protected
function
getMap
()
24
{
25
return
array
(
26
'USE'
=>
new
Field
\
Checkbox
(
'USE'
,
array
(
27
'title'
=> Loc::getMessage(
'LANDING_HOOK_HEADBLOCK_USE2'
)
28
)),
29
'CODE'
=>
new
Field
\
Textarea
(
'CODE'
,
array
(
30
'title'
=> Loc::getMessage(
'LANDING_HOOK_HEADBLOCK_CODE'
),
31
'help'
=> Loc::getMessage(
'LANDING_HOOK_HEADBLOCK_CODE_HELP3'
),
32
'placeholder'
=>
'<script>
33
var googletag = googletag || {};
34
googletag.cmd = googletag.cmd || [];
35
</script>'
36
))
37
);
38
}
39
44
public
static
function
getLastInsertedCode
()
45
{
46
return
self::$lastInsertedCode;
47
}
48
53
public
function
isFree
()
54
{
55
return
false
;
56
}
57
62
public
function
isLocked
()
63
{
64
return
$this->
isLockedFeature
();
65
}
66
71
public
static
function
isLockedFeature
()
72
{
73
if
(ModuleManager::isModuleInstalled(
'bitrix24'
))
74
{
75
$checkFeature =
\Bitrix\Landing\Restriction\Manager::isAllowed
(
76
'limit_sites_html_js'
77
);
78
if
($checkFeature)
79
{
80
return
false
;
81
}
82
$dateCreate =
\Bitrix\Main\Config\Option::get
(
83
'main'
,
'~controller_date_create'
84
);
85
// for all portals early than 01.07.2019, feature are available
86
if
($dateCreate < 1562000000)
87
{
88
// this option will be set after downgrade in bitrix24
89
return
Manager::getOption
(
'html_disabled'
,
'N'
) ==
'Y'
;
90
}
91
else
92
{
93
return
true
;
94
}
95
}
96
97
return
false
;
98
}
99
104
public
function
getTitle
()
105
{
106
return
Loc::getMessage(
'LANDING_HOOK_HEADBLOCK_NAME2'
);
107
}
108
113
public
function
getSort
()
114
{
115
return
500;
116
}
117
122
public
function
enabled
()
123
{
124
if
($this->
isLocked
())
125
{
126
return
false
;
127
}
128
129
if
($this->
issetCustomExec
())
130
{
131
return
true
;
132
}
133
134
return
$this->fields[
'USE'
]->getValue() ==
'Y'
;
135
}
136
141
public
function
enabledInEditMode
()
142
{
143
return
false
;
144
}
145
150
public
function
exec
()
151
{
152
if
($this->
isLocked
())
153
{
154
return
;
155
}
156
157
if
($this->
execCustom
())
158
{
159
return
;
160
}
161
162
$code
= trim($this->fields[
'CODE'
]);
163
164
if
(
$code
!=
''
)
165
{
166
self::$lastInsertedCode =
$code
;
167
$code
= str_replace(
168
'<script'
,
169
'<script data-skip-moving="true"'
,
$code
170
);
171
\Bitrix\Main\Page\Asset::getInstance()->addString(
$code
);
172
}
173
}
174
}
Bitrix\Landing\Field\Checkbox
Определения
checkbox.php:5
Bitrix\Landing\Field\Textarea
Определения
textarea.php:5
Bitrix\Landing\Hook\Page\HeadBlock
Определения
headblock.php:12
Bitrix\Landing\Hook\Page\HeadBlock\isLocked
isLocked()
Определения
headblock.php:62
Bitrix\Landing\Hook\Page\HeadBlock\isLockedFeature
static isLockedFeature()
Определения
headblock.php:71
Bitrix\Landing\Hook\Page\HeadBlock\getMap
getMap()
Определения
headblock.php:23
Bitrix\Landing\Hook\Page\HeadBlock\getTitle
getTitle()
Определения
headblock.php:104
Bitrix\Landing\Hook\Page\HeadBlock\getSort
getSort()
Определения
headblock.php:113
Bitrix\Landing\Hook\Page\HeadBlock\enabledInEditMode
enabledInEditMode()
Определения
headblock.php:141
Bitrix\Landing\Hook\Page\HeadBlock\getLastInsertedCode
static getLastInsertedCode()
Определения
headblock.php:44
Bitrix\Landing\Hook\Page\HeadBlock\enabled
enabled()
Определения
headblock.php:122
Bitrix\Landing\Hook\Page\HeadBlock\exec
exec()
Определения
headblock.php:150
Bitrix\Landing\Hook\Page\HeadBlock\$lastInsertedCode
static $lastInsertedCode
Определения
headblock.php:17
Bitrix\Landing\Hook\Page\HeadBlock\isFree
isFree()
Определения
headblock.php:53
Bitrix\Landing\Hook\Page\issetCustomExec
issetCustomExec()
Определения
page.php:253
Bitrix\Landing\Hook\Page\execCustom
execCustom()
Определения
page.php:262
Bitrix\Landing\Manager\getOption
static getOption($code, $default=null)
Определения
manager.php:160
Bitrix\Landing\Restriction\Manager\isAllowed
static isAllowed(string $code, array $params=[], string $cacheSalt='')
Определения
manager.php:214
Bitrix\Main\Config\Option\get
static get($moduleId, $name, $default="", $siteId=false)
Определения
option.php:30
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$code
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения
options.php:195
Bitrix\Landing\Field
Определения
checkbox.php:2
Bitrix\Landing\Hook\Page
Определения
b24button.php:2
bitrix
modules
landing
lib
hook
page
headblock.php
Создано системой
1.14.0