Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
engine.php
1
<?
8
namespace
Bitrix\Seo
;
9
10
use
Bitrix\Main\SystemException
;
11
use
Bitrix\Seo\SearchEngineTable
;
12
13
class
Engine
14
{
15
const
HTTP_STATUS_OK
= 200;
16
const
HTTP_STATUS_CREATED
= 201;
17
const
HTTP_STATUS_NO_CONTENT
= 204;
18
const
HTTP_STATUS_AUTHORIZATION
= 401;
19
20
protected
$engineId
=
'unknown engine'
;
21
22
protected
$engine
=
null
;
23
protected
$engineSettings
= array();
24
25
protected
$authInterface
=
null
;
26
27
public
function
__construct
()
28
{
29
if
(!$this->engine)
30
{
31
$this->engine = static::getEngine($this->engineId);
32
}
33
34
if
(!is_array($this->engine))
35
{
36
throw
new
SystemException
(
"Unknown search engine"
);
37
}
38
else
39
{
40
if
($this->engine[
'SETTINGS'
] <>
''
)
41
{
42
$this->engineSettings = unserialize($this->engine[
'SETTINGS'
], [
'allowed_classes'
=>
false
]);
43
}
44
}
45
}
46
47
public
function
getId
()
48
{
49
return
$this->engine[
'ID'
];
50
}
51
52
public
function
getCode
()
53
{
54
return
$this->engine[
'CODE'
];
55
}
56
57
public
function
getSettings
()
58
{
59
return
$this->engineSettings;
60
}
61
62
public
function
getClientId
()
63
{
64
return
$this->engine[
'CLIENT_ID'
];
65
}
66
67
public
function
getClientSecret
()
68
{
69
return
$this->engine[
'CLIENT_SECRET'
];
70
}
71
72
public
function
getAuthSettings
()
73
{
74
return
($this->engineSettings[
'AUTH'
] ??
false
);
75
}
76
77
public
function
clearAuthSettings
()
78
{
79
unset($this->engineSettings[
'AUTH'
]);
80
$this->
saveSettings
();
81
}
82
83
protected
function
saveSettings
()
84
{
85
SearchEngineTable::update($this->engine[
'ID'
], array(
86
'SETTINGS'
=> serialize($this->engineSettings)
87
));
88
}
89
90
protected
static
function
getEngine
($engineId)
91
{
92
$dbEngine = SearchEngineTable::getByCode(
$engineId
);
93
return
$dbEngine->fetch();
94
}
95
}
96
Bitrix\Main\SystemException
Definition
exception.php:8
Bitrix\Seo\Engine
Definition
engine.php:14
Bitrix\Seo\Engine\__construct
__construct()
Definition
engine.php:27
Bitrix\Seo\Engine\getId
getId()
Definition
engine.php:47
Bitrix\Seo\Engine\HTTP_STATUS_OK
const HTTP_STATUS_OK
Definition
engine.php:15
Bitrix\Seo\Engine\getClientSecret
getClientSecret()
Definition
engine.php:67
Bitrix\Seo\Engine\getEngine
static getEngine($engineId)
Definition
engine.php:90
Bitrix\Seo\Engine\$engine
$engine
Definition
engine.php:22
Bitrix\Seo\Engine\$engineSettings
$engineSettings
Definition
engine.php:23
Bitrix\Seo\Engine\saveSettings
saveSettings()
Definition
engine.php:83
Bitrix\Seo\Engine\$engineId
$engineId
Definition
engine.php:20
Bitrix\Seo\Engine\getClientId
getClientId()
Definition
engine.php:62
Bitrix\Seo\Engine\getCode
getCode()
Definition
engine.php:52
Bitrix\Seo\Engine\clearAuthSettings
clearAuthSettings()
Definition
engine.php:77
Bitrix\Seo\Engine\HTTP_STATUS_CREATED
const HTTP_STATUS_CREATED
Definition
engine.php:16
Bitrix\Seo\Engine\$authInterface
$authInterface
Definition
engine.php:25
Bitrix\Seo\Engine\HTTP_STATUS_AUTHORIZATION
const HTTP_STATUS_AUTHORIZATION
Definition
engine.php:18
Bitrix\Seo\Engine\getAuthSettings
getAuthSettings()
Definition
engine.php:72
Bitrix\Seo\Engine\getSettings
getSettings()
Definition
engine.php:57
Bitrix\Seo\Engine\HTTP_STATUS_NO_CONTENT
const HTTP_STATUS_NO_CONTENT
Definition
engine.php:17
Bitrix\Seo\SearchEngineTable
Definition
searchengine.php:29
Bitrix\Seo
modules
seo
lib
engine.php
Создано системой
1.10.0