mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-04 07:47:34 +02:00
[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
This commit is contained in:
32
phpBB/includes/template_executor_eval.php
Normal file
32
phpBB/includes/template_executor_eval.php
Normal file
@@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user