blob: b28d817b1bcaff3cbc198bfcb5856e5d898af622 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<?php
/**
*
*/
class TCallbackResponse extends THttpResponse
{
private $_writers=array();
public function createHtmlWriter($type=null,$parameter=null)
{
$writer = new TCallbackResponseWriter($parameter);
$this->_writers[] = $writer;
if($type===null)
$type=$this->getHtmlWriterType();
return Prado::createComponent($type,$writer);
}
public function flush()
{
foreach($this->_writers as $writer)
echo $writer->flush();
parent::flush();
}
}
class TCallbackResponseWriter extends TTextWriter
{
private $_boundary;
private $_response;
public function __construct($response)
{
$this->_response = $response;
$this->_boundary = sprintf('%x',crc32((string)$this));
}
public function getResponse()
{
return $this->_response;
}
public function getBoundary()
{
return $this->_boundary;
}
public function setBoundary($value)
{
$this->_boundary = $value;
}
public function flush()
{
$content = '<!--'.$this->getBoundary().'-->';
$content .= parent::flush();
$content .= '<!--//'.$this->getBoundary().'-->';
return $content;
}
}
?>
|