Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
messengerchat.php
1
<?php
2
3
namespace
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config
;
4
5
final
class
MessengerChat
extends
AbstractConfigField
6
{
7
private
static
function
checkUrl($url) :
bool
8
{
9
return
10
is_string($url) &&
11
preg_match(
'/^((https:\/\/)|(http:\/\/)){1}[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$/i'
,$url);
12
}
13
private
static
function
checkDomains($value)
14
{
15
if
(array_key_exists(
'domains'
, $value) && is_array($value[
'domains'
]) && !empty($value[
'domains'
]))
16
{
17
foreach
($value[
'domains'
] as $url)
18
{
19
if
(!static::checkUrl($url))
20
{
21
return
false
;
22
}
23
}
24
return
true
;
25
}
26
return
false
;
27
28
}
29
30
static
function
prepareValue
($value)
31
{
32
if
(is_array($value) && array_key_exists(
'domains'
, $value) && is_array($value[
'domains'
]))
33
{
34
$value[
'domains'
] = array_values(array_filter($value[
'domains'
]));
35
}
36
return
parent::prepareValue($value);
37
}
38
39
protected
static
function
checkValueFields
($value): bool
40
{
41
return
static::checkDomains($value);
42
}
43
47
static
function
available
(): bool
48
{
49
return
true
;
50
}
51
55
static
function
required
(): bool
56
{
57
return
false
;
58
}
59
60
protected
static
function
getFields
() : array
61
{
62
return
array_merge(parent::getFields(),[
'domains'
]);
63
}
64
}
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\AbstractConfigField
Definition
abstractconfigfield.php:7
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\MessengerChat
Definition
messengerchat.php:6
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\MessengerChat\checkValueFields
static checkValueFields($value)
Definition
messengerchat.php:39
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\MessengerChat\prepareValue
static prepareValue($value)
Definition
messengerchat.php:30
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\MessengerChat\getFields
static getFields()
Definition
messengerchat.php:60
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\MessengerChat\available
static available()
Definition
messengerchat.php:47
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config\MessengerChat\required
static required()
Definition
messengerchat.php:55
Bitrix\Seo\BusinessSuite\Configuration\Facebook\Fields\Config
Definition
abstractconfigfield.php:3
modules
seo
lib
businesssuite
configuration
facebook
fields
config
messengerchat.php
Создано системой
1.10.0