diff options
-rw-r--r-- | .gitattributes | 2 | ||||
-rw-r--r-- | framework/Web/Services/TPageService.php | 2 | ||||
-rw-r--r-- | framework/Web/THttpResponse.php | 32 | ||||
-rw-r--r-- | framework/Web/UI/THtmlWriter.php (renamed from framework/Web/UI/THtmlTextWriter.php) | 2 | ||||
-rw-r--r-- | framework/Web/UI/TPage.php | 1 | ||||
-rw-r--r-- | framework/core.php | 5 |
6 files changed, 39 insertions, 5 deletions
diff --git a/.gitattributes b/.gitattributes index 24b7d228..7f54e625 100644 --- a/.gitattributes +++ b/.gitattributes @@ -74,7 +74,7 @@ framework/Web/UI/TClientScriptManager.php -text framework/Web/UI/TControl.php -text framework/Web/UI/TForm.php -text framework/Web/UI/THiddenFieldPageStatePersister.php -text -framework/Web/UI/THtmlTextWriter.php -text +framework/Web/UI/THtmlWriter.php -text framework/Web/UI/TPage.php -text framework/Web/UI/TPageStatePersister.php -text framework/Web/UI/TPostBackOptions.php -text 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.*');
diff --git a/framework/core.php b/framework/core.php index 02d771db..5c3d645c 100644 --- a/framework/core.php +++ b/framework/core.php @@ -37,7 +37,10 @@ require_once(PRADO_DIR.'/Collections/TMap.php'); * Includes TXmlDocument, TXmlElement definition
*/
require_once(PRADO_DIR.'/Data/TXmlDocument.php');
-
+/**
+ * Includes THttpUtility definition
+ */
+require_once(PRADO_DIR.'/Web/THttpUtility.php');
/**
* IModule interface.
|