summaryrefslogtreecommitdiff
path: root/framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php')
-rwxr-xr-xframework/Web/UI/ActiveControls/TCallbackResponseAdapter.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php b/framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php
new file mode 100755
index 00000000..d1ec67ad
--- /dev/null
+++ b/framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php
@@ -0,0 +1,65 @@
+<?php
+
+/**
+ *
+ */
+class TCallbackResponseAdapter extends THttpResponseAdapter
+{
+ private $_writers=array();
+
+ private $_data;
+
+ public function createNewHtmlWriter($type,$response)
+ {
+ $writer = new TCallbackResponseWriter();
+ $this->_writers[] = $writer;
+ return parent::createNewHtmlWriter($type,$writer);
+ }
+
+ public function flushContent()
+ {
+ foreach($this->_writers as $writer)
+ echo $writer->flush();
+ parent::flushContent();
+ }
+
+ public function setResponseData($data)
+ {
+ $this->_data = $data;
+ }
+
+ public function getResponseData()
+ {
+ return $this->_data;
+ }
+}
+
+class TCallbackResponseWriter extends TTextWriter
+{
+ private $_boundary;
+
+ public function __construct()
+ {
+ $this->_boundary = sprintf('%x',crc32((string)$this));
+ }
+
+ 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;
+ }
+}
+
+?> \ No newline at end of file