summaryrefslogtreecommitdiff
path: root/lib/prado/framework/Web/UI/WebControls/TStatements.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/prado/framework/Web/UI/WebControls/TStatements.php')
-rw-r--r--lib/prado/framework/Web/UI/WebControls/TStatements.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/lib/prado/framework/Web/UI/WebControls/TStatements.php b/lib/prado/framework/Web/UI/WebControls/TStatements.php
new file mode 100644
index 0000000..e9cbeb3
--- /dev/null
+++ b/lib/prado/framework/Web/UI/WebControls/TStatements.php
@@ -0,0 +1,61 @@
+<?php
+/**
+ * TStatements class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link https://github.com/pradosoft/prado
+ * @copyright Copyright &copy; 2005-2015 The PRADO Group
+ * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
+ * @package System.Web.UI.WebControls
+ */
+
+/**
+ * TStatements class
+ *
+ * TStatements executes one or several PHP statements and renders the display
+ * generated during the execution. The execution happens during the rendering stage.
+ * The PHP statements being executed can be set via the property
+ * {@link setStatements Statements}. The context of the statemenets executed
+ * is the TStatements object itself.
+ *
+ * Note, since TStatements allows execution of arbitrary PHP statements,
+ * make sure {@link setStatements Statements} does not come directly from user input.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package System.Web.UI.WebControls
+ * @since 3.0
+ */
+class TStatements extends TControl
+{
+ /**
+ * @var string PHP statements
+ */
+ private $_s='';
+
+ /**
+ * @return string the statements to be executed
+ */
+ public function getStatements()
+ {
+ return $this->_s;
+ }
+
+ /**
+ * @param string the PHP statements to be executed
+ */
+ public function setStatements($value)
+ {
+ $this->_s=$value;
+ }
+
+ /**
+ * Renders the evaluation result of the statements.
+ * @param THtmlWriter the writer used for the rendering purpose
+ */
+ public function render($writer)
+ {
+ if($this->_s!=='')
+ $writer->write($this->evaluateStatements($this->_s));
+ }
+}
+