Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
bufferarea.php
1
<?
2
namespace
Bitrix\Main\Composite
;
3
4
use
Bitrix\Main\NotSupportedException
;
5
6
class
BufferArea
extends
StaticArea
7
{
8
private
$staticPart =
null
;
9
private
$dynamicPart =
null
;
10
private
$started =
false
;
11
private
$ended =
false
;
12
17
public
function
__construct
($id, $autoContainer =
true
)
18
{
19
parent::__construct($id);
20
if
(!$autoContainer)
21
{
22
$this->
setContainerId
($id);
23
}
24
}
25
37
public
function
begin
($stub =
null
)
38
{
39
if
($this->started)
40
{
41
throw
new
NotSupportedException
(
"begin() has been called. Frame id: "
.$this->
getId
().
"."
);
42
}
43
44
$this->
startDynamicArea
();
45
46
$this->started =
true
;
47
$this->staticPart = $stub;
48
ob_start();
49
return
$this;
50
}
51
63
public
function
beginStub
()
64
{
65
if
(!$this->started)
66
{
67
throw
new
NotSupportedException
(
"begin() has not been called. Frame id: "
.$this->
getId
().
"."
);
68
}
69
70
$this->dynamicPart = ob_get_contents();
71
ob_end_clean();
72
ob_start();
73
return
$this;
74
}
75
87
public
function
end
()
88
{
89
if
(!$this->started)
90
{
91
throw
new
NotSupportedException
(
"begin() has not been called. Frame id: "
.$this->
getId
().
"."
);
92
}
93
94
if
($this->ended)
95
{
96
throw
new
NotSupportedException
(
"begin() has been called. Frame id: "
.$this->
getId
().
"."
);
97
}
98
99
//if beginStub() was called
100
if
($this->dynamicPart !==
null
)
101
{
102
if
($this->staticPart !==
null
)
103
{
104
throw
new
NotSupportedException
(
"begin() was called with a stub. Frame id: "
.$this->
getId
().
"."
);
105
}
106
107
$this->staticPart = ob_get_contents();
108
ob_end_clean();
109
echo $this->dynamicPart;
110
}
111
else
112
{
113
$this->dynamicPart = ob_get_contents();
114
if
($this->staticPart ===
null
)
115
{
116
$this->staticPart = $this->dynamicPart;
117
}
118
ob_end_flush();
119
}
120
121
$this->
setStub
($this->staticPart);
122
$this->
finishDynamicArea
();
123
124
$this->ended =
true
;
125
return
$this;
126
}
127
133
public
function
isStarted
()
134
{
135
return
$this->started;
136
}
137
143
public
function
isEnded
()
144
{
145
return
$this->ended;
146
}
147
}
148
149
class_alias(
"Bitrix\\Main\\Composite\\BufferArea"
,
"Bitrix\\Main\\Page\\FrameBuffered"
);
150
class_alias(
"Bitrix\\Main\\Composite\\BufferArea"
,
"Bitrix\\Main\\Page\\FrameHelper"
);
Bitrix\Main\Composite\BufferArea
Definition
bufferarea.php:7
Bitrix\Main\Composite\BufferArea\__construct
__construct($id, $autoContainer=true)
Definition
bufferarea.php:17
Bitrix\Main\Composite\BufferArea\isStarted
isStarted()
Definition
bufferarea.php:133
Bitrix\Main\Composite\BufferArea\begin
begin($stub=null)
Definition
bufferarea.php:37
Bitrix\Main\Composite\BufferArea\end
end()
Definition
bufferarea.php:87
Bitrix\Main\Composite\BufferArea\isEnded
isEnded()
Definition
bufferarea.php:143
Bitrix\Main\Composite\BufferArea\beginStub
beginStub()
Definition
bufferarea.php:63
Bitrix\Main\Composite\StaticArea
Definition
staticarea.php:8
Bitrix\Main\Composite\StaticArea\getId
getId()
Definition
staticarea.php:119
Bitrix\Main\Composite\StaticArea\setContainerId
setContainerId($containerId)
Definition
staticarea.php:139
Bitrix\Main\Composite\StaticArea\setStub
setStub($stub)
Definition
staticarea.php:129
Bitrix\Main\Composite\StaticArea\startDynamicArea
startDynamicArea()
Definition
staticarea.php:29
Bitrix\Main\Composite\StaticArea\finishDynamicArea
finishDynamicArea()
Definition
staticarea.php:49
Bitrix\Main\NotSupportedException
Definition
exception.php:159
Bitrix\Main\Composite
Definition
appcache.php:2
modules
main
lib
composite
bufferarea.php
Создано системой
1.10.0