[ Index ] |
|
Code source de PRADO 3.0.6 |
1 <?php 2 /** 3 * TLiteral class file 4 * 5 * @author Qiang Xue <qiang.xue@gmail.com> 6 * @link http://www.pradosoft.com/ 7 * @copyright Copyright © 2005 PradoSoft 8 * @license http://www.pradosoft.com/license/ 9 * @version $Id: TLiteral.php 1397 2006-09-07 07:55:53Z wei $ 10 * @package System.Web.UI.WebControls 11 */ 12 13 /** 14 * TLiteral class 15 * 16 * TLiteral displays a static text on the Web page. 17 * TLiteral is similar to the TLabel control, except that the TLiteral 18 * control does not have style properties (e.g. BackColor, Font, etc.) 19 * You can programmatically control the text displayed in the control by setting 20 * the {@link setText Text} property. The text displayed may be HTML-encoded 21 * if the {@link setEncode Encode} property is set true (defaults to false). 22 * 23 * TLiteral will render the contents enclosed within its component tag 24 * if {@link setText Text} is empty. 25 * 26 * Note, if {@link setEncode Encode} is false, make sure {@link setText Text} 27 * does not contain unwanted characters that may bring security vulnerabilities. 28 * 29 * @author Qiang Xue <qiang.xue@gmail.com> 30 * @version $Id: TLiteral.php 1397 2006-09-07 07:55:53Z wei $ 31 * @package System.Web.UI.WebControls 32 * @since 3.0 33 */ 34 class TLiteral extends TControl 35 { 36 /** 37 * @return string the static text of the TLiteral 38 */ 39 public function getText() 40 { 41 return $this->getViewState('Text',''); 42 } 43 44 /** 45 * Sets the static text of the TLiteral 46 * @param string the text to be set 47 */ 48 public function setText($value) 49 { 50 $this->setViewState('Text',$value,''); 51 } 52 53 /** 54 * @return boolean whether the rendered text should be HTML-encoded. Defaults to false. 55 */ 56 public function getEncode() 57 { 58 return $this->getViewState('Encode',false); 59 } 60 61 /** 62 * @param boolean whether the rendered text should be HTML-encoded. 63 */ 64 public function setEncode($value) 65 { 66 $this->setViewState('Encode',TPropertyValue::ensureBoolean($value),false); 67 } 68 69 /** 70 * Renders the literal control. 71 * @param THtmlWriter the writer used for the rendering purpose 72 */ 73 public function render($writer) 74 { 75 if(($text=$this->getText())!=='') 76 { 77 if($this->getEncode()) 78 $writer->write(THttpUtility::htmlEncode($text)); 79 else 80 $writer->write($text); 81 } 82 else 83 parent::render($writer); 84 } 85 } 86 87 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 21:07:04 2007 | par Balluche grâce à PHPXref 0.7 |