summaryrefslogtreecommitdiff
path: root/framework/Web/UI
diff options
context:
space:
mode:
authorwei <>2006-01-13 12:57:54 +0000
committerwei <>2006-01-13 12:57:54 +0000
commit52ae5aef521fa7d800e09206342eb9ac17043cd8 (patch)
tree51c3791769ad032232f6f2d3937404b0864f5012 /framework/Web/UI
parent8e16e1f6e9b2b79696d03375e2a60fbae6761a64 (diff)
Diffstat (limited to 'framework/Web/UI')
-rw-r--r--framework/Web/UI/WebControls/TTextBox.php29
1 files changed, 24 insertions, 5 deletions
diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php
index e37b98b8..dae0ccf8 100644
--- a/framework/Web/UI/WebControls/TTextBox.php
+++ b/framework/Web/UI/WebControls/TTextBox.php
@@ -10,6 +10,8 @@
* @package System.Web.UI.WebControls
*/
+Prado::using('System.3rdParty.SafeHtml.TSafeHtmlParser');
+
/**
* TTextBox class
*
@@ -55,6 +57,8 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
*/
private static $_autoCompleteTypes=array('BusinessCity','BusinessCountryRegion','BusinessFax','BusinessPhone','BusinessState','BusinessStreetAddress','BusinessUrl','BusinessZipCode','Cellular','Company','Department','Disabled','DisplayName','Email','FirstName','Gender','HomeCity','HomeCountryRegion','HomeFax','Homepage','HomePhone','HomeState','HomeStreetAddress','HomeZipCode','JobTitle','LastName','MiddleName','None','Notes','Office','Pager','Search');
+ protected $_safeContent;
+
/**
* @return string tag name of the textbox
*/
@@ -90,7 +94,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
if($textMode==='SingleLine')
{
$writer->addAttribute('type','text');
- if(($text=$this->getText())!=='')
+ if(($text=$this->getRawText())!=='')
$writer->addAttribute('value',$text);
if(($act=$this->getAutoCompleteType())!=='None')
{
@@ -169,7 +173,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
public function loadPostData($key,$values)
{
$value=$values[$key];
- if(!$this->getReadOnly() && $this->getText()!==$value)
+ if(!$this->getReadOnly() && $this->getRawText()!==$value)
{
$this->setText($value);
return true;
@@ -226,7 +230,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
protected function renderContents($writer)
{
if($this->getTextMode()==='MultiLine')
- $writer->write(THttpUtility::htmlEncode($this->getText()));
+ $writer->write(THttpUtility::htmlEncode($this->getRawText()));
}
/**
@@ -358,20 +362,35 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
}
/**
- * @return string the text content of the TTextBox control.
+ * @return string the unmodified text content of the TTextBox control.
*/
- public function getText()
+ public function getRawText()
{
return $this->getViewState('Text','');
}
/**
+ * @return string safe text content.
+ */
+ public function getText()
+ {
+ $text = $this->getRawText();
+ if(is_null($this->_safeContent))
+ {
+ $renderer = new TSafeHtmlParser();
+ $this->_safeContent = $renderer->parse($text);
+ }
+ return $this->_safeContent;
+ }
+
+ /**
* Sets the text content of the TTextBox control.
* @param string the text content
*/
public function setText($value)
{
$this->setViewState('Text',$value,'');
+ $this->_safeContent = null;
}
/**