aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template/renderer_eval.php
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2011-08-18 22:31:25 +0200
committerIgor Wiedler <igor@wiedler.ch>2011-08-18 22:31:25 +0200
commit38c65da553c83e787d8a8adc1d40d789713579c4 (patch)
tree3aff0778b74cfbf328991aa83af50e9d07aff4e6 /phpBB/includes/template/renderer_eval.php
parentf84460c710f528724fac68278361af7fe18e458c (diff)
parent9589fbffe4cdad9fa35df2597c21fc0753ed1d52 (diff)
downloadforums-38c65da553c83e787d8a8adc1d40d789713579c4.tar
forums-38c65da553c83e787d8a8adc1d40d789713579c4.tar.gz
forums-38c65da553c83e787d8a8adc1d40d789713579c4.tar.bz2
forums-38c65da553c83e787d8a8adc1d40d789713579c4.tar.xz
forums-38c65da553c83e787d8a8adc1d40d789713579c4.zip
Merge branch 'develop' into feature/request-class
* develop: (157 commits) [ticket/10316] Resolve inconsistent move topic behavior [ticket/9297] Add network to class name of unit tests. [ticket/9297] Fix typo in localhost. [ticket/9297] Rename test class to reflect its contents. [ticket/9297] Adjust comment - IPv6 is needed for IPv6 connections to work. [ticket/9297] Fix markTestSkipped call in setUpBeforeClass. [ticket/9608] Remove use of references in topic_review [ticket/9297] Skip FTP PASV/EPSV test if FTP connection fails. [ticket/9297] Separate ipv4 and ipv6 tests into separate functions. [ticket/9297] Update copyright year of unit test file. [feature/template-engine] Delete _get_locator function. [feature/template-engine] Clean up template locator usage in bbcode. [ticket/9297] Make EPSV unit tests work without IPv6. [ticket/9297] Unit tests for ftp_fsock PASV and EPSV. [ticket/9297] Add support for Extended Passive Mode (EPSV) in ftp_fsock class. [ticket/10312] Un-check the shadow option while moving. [feature/template-engine] Need to call set_template on template. [feature/template-engine] Update installer for template engine changes. [feature/template-engine] Dependency inject locator into template. [feature/template-engine] Delete useless code from set_template. ... Conflicts: phpBB/includes/functions.php
Diffstat (limited to 'phpBB/includes/template/renderer_eval.php')
-rw-r--r--phpBB/includes/template/renderer_eval.php60
1 files changed, 60 insertions, 0 deletions
diff --git a/phpBB/includes/template/renderer_eval.php b/phpBB/includes/template/renderer_eval.php
new file mode 100644
index 0000000000..11e2a30f06
--- /dev/null
+++ b/phpBB/includes/template/renderer_eval.php
@@ -0,0 +1,60 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* Template renderer that stores compiled template's php code and
+* displays it via eval.
+*
+* @package phpBB3
+*/
+class phpbb_template_renderer_eval implements phpbb_template_renderer
+{
+ /**
+ * Template code to be eval'ed.
+ */
+ private $code;
+
+ /**
+ * Constructor. Stores provided code for future evaluation.
+ * Template includes are delegated to template object $template.
+ *
+ * @param string $code php code of the template
+ * @param phpbb_template $template template object
+ */
+ public function __construct($code, $template)
+ {
+ $this->code = $code;
+ $this->template = $template;
+ }
+
+ /**
+ * Displays the template managed by this renderer by eval'ing php code
+ * of the template.
+ *
+ * @param phpbb_template_context $context Template context to use
+ * @param array $lang Language entries to use
+ */
+ public function render($context, $lang)
+ {
+ $_template = $this->template;
+ $_tpldata = &$context->get_data_ref();
+ $_rootref = &$context->get_root_ref();
+ $_lang = $lang;
+
+ eval($this->code);
+ }
+}