From 55c4ac1bfe565f1ca7f537fdd8b7a201be28e581 Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 10 Nov 2005 12:47:19 +0000 Subject: Initial import of prado framework --- framework/Web/UI/WebControls/TLiteral.php | 79 +++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 framework/Web/UI/WebControls/TLiteral.php (limited to 'framework/Web/UI/WebControls/TLiteral.php') diff --git a/framework/Web/UI/WebControls/TLiteral.php b/framework/Web/UI/WebControls/TLiteral.php new file mode 100644 index 00000000..0509724a --- /dev/null +++ b/framework/Web/UI/WebControls/TLiteral.php @@ -0,0 +1,79 @@ + + * @link http://www.xisc.com/ + * @copyright Copyright © 2004-2005, Qiang Xue + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version $Revision: $ $Date: $ + * @package System.Web.UI.WebControls + */ + +/** + * TLiteral class + * + * TLiteral reserves a location on the Web page to display static text or body content. + * The TLiteral control is similar to the TLabel control, except the TLiteral + * control does not allow you to apply a style to the displayed text. + * You can programmatically control the text displayed in the control by setting + * the Text property. If the Text property is empty, the content + * enclosed within the TLiteral control will be displayed. This is very useful + * for reserving a location on a page because you can add text and controls + * as children of TLiteral control and they will be rendered at the place. + * + * Note, Text is not HTML encoded before it is displayed in the TLiteral component. + * If the values for the component come from user input, be sure to validate the values + * to help prevent security vulnerabilities. + * + * @author Qiang Xue + * @version $Revision: $ $Date: $ + * @package System.Web.UI.WebControls + * @since 3.0 + */ +class TLiteral extends TControl +{ + /** + * @return string the static text of the TLiteral + */ + public function getText() + { + return $this->getViewState('Text',''); + } + + /** + * Sets the static text of the TLiteral + * @param string the text to be set + */ + public function setText($value) + { + $this->setViewState('Text',$value,''); + } + + public function getEncode() + { + return $this->getViewState('Encode',false); + } + + public function setEncode($value) + { + $this->setViewState('Encode',$value,false); + } + + /** + * Renders the evaluation result of the statements. + * @param THtmlTextWriter the writer used for the rendering purpose + */ + protected function render($writer) + { + if(($text=$this->getText())!=='') + { + if($this->getEncode()) + $writer->write(THttpUtility::htmlEncode($text)); + else + $writer->write($text); + } + } +} + +?> \ No newline at end of file -- cgit v1.2.3