Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
request.php
1
<?php
2
3
namespace
Bitrix\Main
;
4
9
abstract
class
Request
extends
Type\ParameterDictionary
10
{
14
protected
$server
;
15
protected
$requestedPage
=
null
;
16
protected
$requestedPageDirectory
=
null
;
17
18
public
function
__construct
(
Server
$server
, array $request)
19
{
20
parent::__construct($request);
21
22
$this->server =
$server
;
23
}
24
25
public
function
addFilter
(
Type
\
IRequestFilter
$filter)
26
{
27
$filteredValues = $filter->filter($this->values);
28
29
if
($filteredValues !=
null
)
30
{
31
$this->
setValuesNoDemand
($filteredValues);
32
}
33
}
34
38
public
function
getServer
()
39
{
40
return
$this->server
;
41
}
42
43
public
function
getPhpSelf
()
44
{
45
return
$this->server->getPhpSelf();
46
}
47
48
public
function
getScriptName
()
49
{
50
return
$this->server->getScriptName();
51
}
52
53
public
function
getRequestedPage
()
54
{
55
if
($this->requestedPage ===
null
)
56
{
57
$page = $this->
getScriptName
();
58
if
(!empty($page))
59
{
60
$page = IO\Path::normalize($page);
61
62
if
(mb_substr($page, 0, 1) !==
"/"
&& !preg_match(
"#^[a-z]:[/\\\\]#i"
, $page))
63
{
64
$page =
"/"
. $page;
65
}
66
}
67
$this->requestedPage = $page;
68
}
69
70
return
$this->requestedPage
;
71
}
72
77
public
function
getRequestedPageDirectory
()
78
{
79
if
($this->requestedPageDirectory ===
null
)
80
{
81
$requestedPage
= $this->
getRequestedPage
();
82
$this->requestedPageDirectory = IO\Path::getDirectory(
$requestedPage
) .
'/'
;
83
}
84
return
$this->requestedPageDirectory
;
85
}
86
87
public
function
isAdminSection
()
88
{
89
$requestedDir = $this->
getRequestedPageDirectory
();
90
return
(str_starts_with($requestedDir,
"/bitrix/admin/"
)
91
|| str_starts_with($requestedDir,
"/bitrix/updates/"
)
92
|| (defined(
"ADMIN_SECTION"
) && ADMIN_SECTION ===
true
)
93
|| (defined(
"BX_PUBLIC_TOOLS"
) && BX_PUBLIC_TOOLS ===
true
)
94
);
95
}
96
101
public
function
isAjaxRequest
()
102
{
103
return
104
$this->server->get(
"HTTP_BX_AJAX"
) !==
null
||
105
$this->server->get(
"HTTP_X_REQUESTED_WITH"
) ===
"XMLHttpRequest"
;
106
}
107
}
Bitrix\Main\Request
Definition
request.php:10
Bitrix\Main\Request\getPhpSelf
getPhpSelf()
Definition
request.php:43
Bitrix\Main\Request\$requestedPageDirectory
$requestedPageDirectory
Definition
request.php:16
Bitrix\Main\Request\isAjaxRequest
isAjaxRequest()
Definition
request.php:101
Bitrix\Main\Request\__construct
__construct(Server $server, array $request)
Definition
request.php:18
Bitrix\Main\Request\addFilter
addFilter(Type\IRequestFilter $filter)
Definition
request.php:25
Bitrix\Main\Request\$requestedPage
$requestedPage
Definition
request.php:15
Bitrix\Main\Request\getRequestedPage
getRequestedPage()
Definition
request.php:53
Bitrix\Main\Request\getScriptName
getScriptName()
Definition
request.php:48
Bitrix\Main\Request\getServer
getServer()
Definition
request.php:38
Bitrix\Main\Request\$server
$server
Definition
request.php:14
Bitrix\Main\Request\isAdminSection
isAdminSection()
Definition
request.php:87
Bitrix\Main\Request\getRequestedPageDirectory
getRequestedPageDirectory()
Definition
request.php:77
Bitrix\Main\Server
Definition
server.php:12
Bitrix\Main\Type\ParameterDictionary
Definition
parameterdictionary.php:8
Bitrix\Main\Type\ParameterDictionary\setValuesNoDemand
setValuesNoDemand(array $values)
Definition
parameterdictionary.php:14
Bitrix\Main\Type\IRequestFilter
Definition
irequestfilter.php:7
Bitrix\Main\Type
Definition
collection.php:2
Bitrix\Main
modules
main
lib
request.php
Создано системой
1.10.0