Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
metagoogleverification.php
1
<?php
2
namespace
Bitrix\Landing\Hook\Page
;
3
4
use \Bitrix\Landing\Manager;
5
use \Bitrix\Landing\Field;
6
use \Bitrix\Main\Localization\Loc;
7
8
Loc::loadMessages
(__FILE__);
9
10
class
MetaGoogleVerification
extends
\Bitrix\Landing\Hook\Page
11
{
16
protected
function
getMap
()
17
{
18
$helpUrl = \Bitrix\Landing\Help::getHelpUrl(
'META_GOOGLE_VERIFICATION'
);
19
return
array(
20
'USE'
=>
new
Field
\
Checkbox
(
'USE'
, array(
21
'title'
=>
'Google Search Console'
22
)),
23
'META'
=>
new
Field
\
Text
(
'META'
, array(
24
'title'
=>
'Google Search Console'
,
25
'placeholder'
=>
'<meta name="google-site-verification" content="9fe8a037d323d50a5faed82923c1438f" />'
,
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
enabled
()
40
{
41
if
($this->
issetCustomExec
())
42
{
43
return
true
;
44
}
45
46
return
$this->fields[
'USE'
]->getValue() ==
'Y'
;
47
}
48
53
public
function
enabledInEditMode
()
54
{
55
return
false
;
56
}
57
62
public
function
exec
()
63
{
64
if
($this->
execCustom
())
65
{
66
return
;
67
}
68
69
$meta = trim($this->fields[
'META'
]);
70
71
if
(preg_match(
'#^<meta\s+name="google-site-verification"\s+content="[a-z0-9_\-]+"\s+/*>$#i'
, $meta))
72
{
73
Manager::setPageView
(
'BeforeHeadClose'
, $meta);
74
}
75
}
76
}
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\MetaGoogleVerification
Definition
metagoogleverification.php:11
Bitrix\Landing\Hook\Page\MetaGoogleVerification\getMap
getMap()
Definition
metagoogleverification.php:16
Bitrix\Landing\Hook\Page\MetaGoogleVerification\enabledInEditMode
enabledInEditMode()
Definition
metagoogleverification.php:53
Bitrix\Landing\Hook\Page\MetaGoogleVerification\enabled
enabled()
Definition
metagoogleverification.php:39
Bitrix\Landing\Hook\Page\MetaGoogleVerification\exec
exec()
Definition
metagoogleverification.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
metagoogleverification.php
Создано системой
1.10.0