diff options
| author | Oleg Pudeyev <oleg@bsdpower.com> | 2011-05-03 23:53:22 -0400 |
|---|---|---|
| committer | Oleg Pudeyev <oleg@bsdpower.com> | 2011-05-04 01:21:44 -0400 |
| commit | d06e59f63bc8213a4d679ff0c20a23dcf8cd524e (patch) | |
| tree | 7c80b3768be92135840a8095bca0d0a3f6ed263b /phpBB/includes/template_executor_eval.php | |
| parent | 237deb12cea909822e0f2fa3c072d31adfec3fb1 (diff) | |
| download | forums-d06e59f63bc8213a4d679ff0c20a23dcf8cd524e.tar forums-d06e59f63bc8213a4d679ff0c20a23dcf8cd524e.tar.gz forums-d06e59f63bc8213a4d679ff0c20a23dcf8cd524e.tar.bz2 forums-d06e59f63bc8213a4d679ff0c20a23dcf8cd524e.tar.xz forums-d06e59f63bc8213a4d679ff0c20a23dcf8cd524e.zip | |
[feature/template-engine] Split template execution logic into classes.
Template executor interface defines a template executor object.
It is an object which can execute (i.e. display/render) a template.
Currently there are two implementations:
* phpbb_template_executor_include includes php code from a file.
* phpbb_template_executor_eval eval's php code.
PHPBB3-9726
Diffstat (limited to 'phpBB/includes/template_executor_eval.php')
| -rw-r--r-- | phpBB/includes/template_executor_eval.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/phpBB/includes/template_executor_eval.php b/phpBB/includes/template_executor_eval.php new file mode 100644 index 0000000000..27bdf95b52 --- /dev/null +++ b/phpBB/includes/template_executor_eval.php @@ -0,0 +1,32 @@ +<?php + +/** +* Template executor that stores compiled template's php code and +* evaluates it via eval. +*/ +class phpbb_template_executor_eval implements phpbb_template_executor +{ + /** + * Template code to be eval'ed. + */ + private $code; + + /** + * Constructor. Stores provided code for future evaluation. + * + * @param string $code php code of the template + */ + public function __construct($code) + { + $this->code = $code; + } + + /** + * Executes the template managed by this executor by eval'ing php code + * of the template. + */ + public function execute() + { + eval($this->code); + } +} |
