Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
metamain.php
1
<?php
2
namespace
Bitrix\Landing\Hook\Page
;
3
4
use \Bitrix\Landing\Field;
5
use \Bitrix\Landing\Manager;
6
use \Bitrix\Landing\Landing\Seo;
7
use \Bitrix\Main\Localization\Loc;
8
9
Loc::loadMessages
(__FILE__);
10
11
class
MetaMain
extends
\Bitrix\Landing\Hook\Page
12
{
17
protected
function
getMap
()
18
{
19
return
array(
20
'USE'
=>
new
Field
\
Checkbox
(
'USE'
, array(
21
'title'
=>
Loc::getMessage
(
'LANDING_HOOK_METAMAIN_USE'
),
22
'help'
=>
Loc::getMessage
(
'LANDING_HOOK_METAMAIN_DESCRIPTION'
),
23
)),
24
'TITLE'
=>
new
Field
\
Text
(
'TITLE'
, array(
25
'title'
=>
Loc::getMessage
(
'LANDING_HOOK_METAMAIN_TITLE'
),
26
'placeholder'
=>
Loc::getMessage
(
'LANDING_HOOK_METAMAIN_TITLE_PLACEHOLDER'
),
27
'maxlength'
=> 140,
28
'searchable'
=>
true
29
)),
30
'DESCRIPTION'
=>
new
Field
\
Textarea
(
'DESCRIPTION'
, array(
31
'title'
=>
Loc::getMessage
(
'LANDING_HOOK_METAMAIN_DESCRIPTION_TITLE'
),
32
'placeholder'
=>
Loc::getMessage
(
'LANDING_HOOK_METAMAIN_DESCRIPTION_PLACEHOLDER'
),
33
'maxlength'
=> 300,
34
'searchable'
=>
true
35
)),
36
'KEYWORDS'
=>
new
Field
\
Text
(
'KEYWORDS'
, array(
37
'title'
=>
Loc::getMessage
(
'LANDING_HOOK_METAMAIN_KEYWORDS_TITLE'
),
38
'maxlength'
=> 250,
39
'searchable'
=>
true
40
))
41
);
42
}
43
48
public
function
getTitle
()
49
{
50
return
Loc::getMessage
(
'LANDING_HOOK_METAMAIN_NAME'
);
51
}
52
57
public
function
getDescription
(): string
58
{
59
return
Loc::getMessage
(
'LANDING_HOOK_METAMAIN_DESCRIPTION'
);
60
}
61
62
67
public
function
enabled
()
68
{
69
if
($this->
issetCustomExec
())
70
{
71
return
true
;
72
}
73
74
return
$this->fields[
'USE'
]->getValue() ==
'Y'
;
75
}
76
81
public
function
enabledInEditMode
()
82
{
83
return
false
;
84
}
85
90
public
function
exec
()
91
{
92
if
($this->
execCustom
())
93
{
94
return
;
95
}
96
97
$title = \htmlspecialcharsbx(Seo::processValue(
'title'
, $this->fields[
'TITLE'
]));
98
$description = Seo::processValue(
'description'
, $this->fields[
'DESCRIPTION'
]);
99
$keywords = Seo::processValue(
'keywords'
, $this->fields[
'KEYWORDS'
]);
100
101
if
($title !=
''
)
102
{
103
Manager::setPageTitle
($title);
104
}
105
if
($description !=
''
)
106
{
107
Manager::getApplication
()->setPageProperty(
108
'description'
,
109
$description
110
);
111
}
112
if
($keywords !=
''
)
113
{
114
Manager::getApplication
()->setPageProperty(
115
'keywords'
,
116
$keywords
117
);
118
}
119
}
120
}
Bitrix\Landing\Field\Checkbox
Definition
checkbox.php:5
Bitrix\Landing\Field\Text
Definition
text.php:5
Bitrix\Landing\Field\Textarea
Definition
textarea.php:5
Bitrix\Landing\Field
Definition
field.php:5
Bitrix\Landing\Hook\Page\MetaMain
Definition
metamain.php:12
Bitrix\Landing\Hook\Page\MetaMain\getDescription
getDescription()
Definition
metamain.php:57
Bitrix\Landing\Hook\Page\MetaMain\getMap
getMap()
Definition
metamain.php:17
Bitrix\Landing\Hook\Page\MetaMain\getTitle
getTitle()
Definition
metamain.php:48
Bitrix\Landing\Hook\Page\MetaMain\enabledInEditMode
enabledInEditMode()
Definition
metamain.php:81
Bitrix\Landing\Hook\Page\MetaMain\enabled
enabled()
Definition
metamain.php:67
Bitrix\Landing\Hook\Page\MetaMain\exec
exec()
Definition
metamain.php:90
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\getApplication
static getApplication()
Definition
manager.php:71
Bitrix\Landing\Manager\setPageTitle
static setPageTitle($title, $single=false)
Definition
manager.php:211
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
metamain.php
Создано системой
1.10.0