summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/Services/TPageService.php2
-rw-r--r--framework/Web/THttpResponse.php32
-rw-r--r--framework/Web/UI/THtmlWriter.php (renamed from framework/Web/UI/THtmlTextWriter.php)2
-rw-r--r--framework/Web/UI/TPage.php1
4 files changed, 34 insertions, 3 deletions
diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php
index 79f81bcd..3218138e 100644
--- a/framework/Web/Services/TPageService.php
+++ b/framework/Web/Services/TPageService.php
@@ -384,7 +384,7 @@ class TPageService extends TComponent implements IService
$page=new $className($this->_properties);
else
throw new THttpException(404,'pageservice_page_unknown',$this->_pageType);
- $writer=new THtmlTextWriter($this->_application->getResponse());
+ $writer=$this->_application->getResponse()->createHtmlWriter();
$page->run($writer);
$writer->flush();
}
diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php
index 58bbfb99..dfa2d023 100644
--- a/framework/Web/THttpResponse.php
+++ b/framework/Web/THttpResponse.php
@@ -59,6 +59,10 @@ class THttpResponse extends TComponent implements IModule, ITextWriter
* @var integer response status code
*/
private $_status=200;
+ /**
+ * @var string HTML writer type
+ */
+ private $_htmlWriterType='System.Web.UI.THtmlWriter';
/**
* Destructor.
@@ -303,6 +307,34 @@ class THttpResponse extends TComponent implements IModule, ITextWriter
{
setcookie($cookie->getName(),null,0,$cookie->getPath(),$cookie->getDomain(),$cookie->getSecure());
}
+
+ /**
+ * @return string the type of HTML writer to be used, defaults to THtmlWriter
+ */
+ public function getHtmlWriterType()
+ {
+ return $this->_htmlWriterType;
+ }
+
+ /**
+ * @param string the type of HTML writer to be used, may be the class name or the namespace
+ */
+ public function setHtmlWriterType($value)
+ {
+ $this->_htmlWriterType=$value;
+ }
+
+ /**
+ * Creates a new instance of HTML writer.
+ * If the type of the HTML writer is not supplied, {@link getHtmlWriterType HtmlWriterType} will be assumed.
+ * @param string type of the HTML writer to be created. If null, {@link getHtmlWriterType HtmlWriterType} will be assumed.
+ */
+ public function createHtmlWriter($type=null)
+ {
+ if($type===null)
+ $type=$this->_htmlWriterType;
+ return Prado::createComponent($type,$this);
+ }
}
?> \ No newline at end of file
diff --git a/framework/Web/UI/THtmlTextWriter.php b/framework/Web/UI/THtmlWriter.php
index 4ea78383..75926d55 100644
--- a/framework/Web/UI/THtmlTextWriter.php
+++ b/framework/Web/UI/THtmlWriter.php
@@ -4,7 +4,7 @@
// keep nonclosing tag only
// add more utility methods (e.g. render....)
// implment encoding (for text and url)
-class THtmlTextWriter extends TComponent implements ITextWriter
+class THtmlWriter extends TComponent implements ITextWriter
{
const TAG_INLINE=0;
const TAG_NONCLOSING=1;
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php
index 232878da..50b29c35 100644
--- a/framework/Web/UI/TPage.php
+++ b/framework/Web/UI/TPage.php
@@ -1,6 +1,5 @@
<?php
-Prado::using('System.Web.*');
Prado::using('System.Web.UI.*');
Prado::using('System.Web.UI.WebControls.*');