Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * TExpression class file
4
 *
5
 * @author Qiang Xue <qiang.xue@gmail.com>
6
 * @link http://www.pradosoft.com/
7
 * @copyright Copyright &copy; 2005-2008 PradoSoft
8
 * @license http://www.pradosoft.com/license/
9
 * @version $Id: TExpression.php 2541 2008-10-21 15:05:13Z qiang.xue $
10
 * @package System.Web.UI.WebControls
11
 */
12
 
13
/**
14
 * TExpression class
15
 *
16
 * TExpression evaluates a PHP expression and renders the result.
17
 * The expression is evaluated during the rendering stage. The expression being
18
 * evaluated can be set via the property {@link setExpression Expression}.
19
 * The context of the expression evaluated is the TExpression object itself.
20
 *
21
 * Note, since TExpression allows evaluation of arbitrary PHP expression,
22
 * make sure {@link setExpression Expression} does not come directly from user input.
23
 *
24
 * @author Qiang Xue <qiang.xue@gmail.com>
25
 * @version $Id: TExpression.php 2541 2008-10-21 15:05:13Z qiang.xue $
26
 * @package System.Web.UI.WebControls
27
 * @since 3.0
28
 */
29
class TExpression extends TControl
30
{
31
	/**
32
	 * @var string PHP expression to be evaluated
33
	 */
34
	private $_e='';
35
 
36
	/**
37
	 * @return string the expression to be evaluated
38
	 */
39
	public function getExpression()
40
	{
41
		return $this->_e;
42
	}
43
 
44
	/**
45
	 * @param string the expression to be evaluated
46
	 */
47
	public function setExpression($value)
48
	{
49
		$this->_e=$value;
50
	}
51
 
52
	/**
53
	 * Renders the evaluation result of the expression.
54
	 * @param THtmlWriter the writer used for the rendering purpose
55
	 */
56
	public function render($writer)
57
	{
58
		if($this->_e!=='')
59
			$writer->write($this->evaluateExpression($this->_e));
60
	}
61
}
62