Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
context.php
1
<?php
2
10
namespace
Bitrix\Main
;
11
12
use
Bitrix\Main\Localization
;
13
17
class
Context
18
{
20
protected
$application
;
21
23
protected
$response
;
24
26
protected
$request
;
27
29
protected
$server
;
30
32
protected
$language
;
33
35
protected
$site
;
36
38
protected
$env
;
39
41
protected
$culture
;
42
44
protected
$params
;
45
51
public
function
__construct
(
Application
$application)
52
{
53
$this->application = $application;
54
}
55
64
public
function
initialize
(
Request
$request,
Response
$response,
Server
$server, array $params = [])
65
{
66
$this->request = $request;
67
$this->response = $response;
68
$this->server = $server;
69
$this->params =
$params
;
70
}
71
72
public
function
getEnvironment
()
73
{
74
if
($this->env ===
null
)
75
{
76
$this->env =
new
Environment
($this->params[
'env'
]);
77
}
78
return
$this->env;
79
}
80
86
public
function
getResponse
()
87
{
88
return
$this->response;
89
}
90
97
public
function
setResponse
(
Response
$response)
98
{
99
$this->response = $response;
100
return
$this;
101
}
102
108
public
function
getRequest
()
109
{
110
return
$this->request;
111
}
112
118
public
function
getServer
()
119
{
120
return
$this->server;
121
}
122
128
public
function
getApplication
()
129
{
130
return
$this->application;
131
}
132
138
public
function
getCulture
()
139
{
140
return
$this->culture;
141
}
142
148
public
function
getLanguage
()
149
{
150
return
$this->language ? $this->language->getLid() :
null
;
151
}
152
158
public
function
getLanguageObject
(): ?Localization\EO_Language
159
{
160
return
$this->language;
161
}
162
168
public
function
getSite
()
169
{
170
return
$this->site ? $this->site->getLid() :
null
;
171
}
172
178
public
function
getSiteObject
(): ?EO_Site
179
{
180
return
$this->site;
181
}
182
189
public
function
setCulture
(
Context
\
Culture
$culture)
190
{
191
$this->culture = $culture;
192
return
$this;
193
}
194
201
public
function
setLanguage
($language)
202
{
203
if
(
$language
instanceof Localization\EO_Language)
204
{
205
$this->language =
$language
;
206
}
207
else
208
{
209
$this->language = Localization\LanguageTable::wakeUpObject(
$language
);
210
$this->language->fill(ORM\Fields\
FieldTypeMask::SCALAR
| ORM\Fields\
FieldTypeMask::EXPRESSION
);
211
}
212
return
$this;
213
}
214
221
public
function
setSite
($site)
222
{
223
if
(
$site
instanceof EO_Site)
224
{
225
$this->site =
$site
;
226
}
227
else
228
{
229
$this->site =
SiteTable::wakeUpObject
(
$site
);
230
$this->site->fill(ORM\Fields\
FieldTypeMask::SCALAR
| ORM\Fields\
FieldTypeMask::EXPRESSION
);
231
}
232
return
$this;
233
}
234
241
public
static
function
getCurrent
()
242
{
243
if
(
Application::hasInstance
())
244
{
245
$application
=
Application::getInstance
();
246
return
$application
->getContext();
247
}
248
249
return
null
;
250
}
251
}
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\hasInstance
static hasInstance()
Definition
application.php:107
Bitrix\Main\Application\getInstance
static getInstance()
Definition
application.php:95
Bitrix\Main\Context\Culture
Definition
culture.php:14
Bitrix\Main\Context
Definition
context.php:18
Bitrix\Main\Context\getCulture
getCulture()
Definition
context.php:138
Bitrix\Main\Context\getEnvironment
getEnvironment()
Definition
context.php:72
Bitrix\Main\Context\getSite
getSite()
Definition
context.php:168
Bitrix\Main\Context\__construct
__construct(Application $application)
Definition
context.php:51
Bitrix\Main\Context\initialize
initialize(Request $request, Response $response, Server $server, array $params=[])
Definition
context.php:64
Bitrix\Main\Context\getCurrent
static getCurrent()
Definition
context.php:241
Bitrix\Main\Context\getSiteObject
getSiteObject()
Definition
context.php:178
Bitrix\Main\Context\$application
$application
Definition
context.php:20
Bitrix\Main\Context\getResponse
getResponse()
Definition
context.php:86
Bitrix\Main\Context\$language
$language
Definition
context.php:32
Bitrix\Main\Context\getLanguageObject
getLanguageObject()
Definition
context.php:158
Bitrix\Main\Context\setLanguage
setLanguage($language)
Definition
context.php:201
Bitrix\Main\Context\$site
$site
Definition
context.php:35
Bitrix\Main\Context\$env
$env
Definition
context.php:38
Bitrix\Main\Context\getApplication
getApplication()
Definition
context.php:128
Bitrix\Main\Context\$request
$request
Definition
context.php:26
Bitrix\Main\Context\getServer
getServer()
Definition
context.php:118
Bitrix\Main\Context\$server
$server
Definition
context.php:29
Bitrix\Main\Context\setResponse
setResponse(Response $response)
Definition
context.php:97
Bitrix\Main\Context\getRequest
getRequest()
Definition
context.php:108
Bitrix\Main\Context\$culture
$culture
Definition
context.php:41
Bitrix\Main\Context\setCulture
setCulture(Context\Culture $culture)
Definition
context.php:189
Bitrix\Main\Context\setSite
setSite($site)
Definition
context.php:221
Bitrix\Main\Context\$response
$response
Definition
context.php:23
Bitrix\Main\Context\getLanguage
getLanguage()
Definition
context.php:148
Bitrix\Main\Context\$params
$params
Definition
context.php:44
Bitrix\Main\Environment
Definition
environment.php:8
Bitrix\Main\ORM\Data\DataManager\wakeUpObject
static wakeUpObject($row)
Definition
datamanager.php:269
Bitrix\Main\ORM\Fields\FieldTypeMask\EXPRESSION
const EXPRESSION
Definition
fieldtypemask.php:18
Bitrix\Main\ORM\Fields\FieldTypeMask\SCALAR
const SCALAR
Definition
fieldtypemask.php:17
Bitrix\Main\Request
Definition
request.php:10
Bitrix\Main\Response
Definition
response.php:5
Bitrix\Main\Server
Definition
server.php:12
Bitrix\Main\Localization
Definition
culture.php:8
Bitrix\Main
modules
main
lib
context.php
Создано системой
1.10.0