Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
metayandexverification.php
1<?php
3
4use \Bitrix\Landing\Manager;
5use \Bitrix\Landing\Field;
6use \Bitrix\Main\Localization\Loc;
7
8Loc::loadMessages(__FILE__);
9
11{
16 protected function getMap()
17 {
18 $helpUrl = \Bitrix\Landing\Help::getHelpUrl('META_YANDEX_VERIFICATION');
19 return array(
20 'USE' => new Field\Checkbox('USE', array(
21 'title' => Loc::getMessage('LANDING_HOOK_YANDEX_VERIF_TITLE')
22 )),
23 'META' => new Field\Text('META', array(
24 'title' => Loc::getMessage('LANDING_HOOK_YANDEX_VERIF_TITLE'),
25 'placeholder' => '<meta name="yandex-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="yandex-verification"\s+content="[a-z0-9_\-]+"\s+/*>$#i', $meta))
72 {
73 Manager::setPageView('BeforeHeadClose', $meta);
74 }
75 }
76}
static setPageView(string $marker, string $content, bool $skipTrim=false)
Definition manager.php:465
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29