mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-25 20:44:01 +01:00
[feature/template-engine] Renamed template executor and friends to renderer.
PHPBB3-9726
This commit is contained in:
parent
1cba674b9a
commit
84bc485ccc
@ -206,11 +206,11 @@ class phpbb_template
|
||||
}
|
||||
*/
|
||||
|
||||
$executor = $this->_tpl_load($handle);
|
||||
$renderer = $this->_tpl_load($handle);
|
||||
|
||||
if ($executor)
|
||||
if ($renderer)
|
||||
{
|
||||
$executor->execute($this->_context, $this->get_lang());
|
||||
$renderer->render($this->_context, $this->get_lang());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -270,8 +270,8 @@ class phpbb_template
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains a template executor for a template identified by specified
|
||||
* handle. THe template executor can execute the template later.
|
||||
* Obtains a template renderer for a template identified by specified
|
||||
* handle. The template renderer can display the template later.
|
||||
*
|
||||
* Template source will first be compiled into php code.
|
||||
* If template cache is writable the compiled php code will be stored
|
||||
@ -281,15 +281,15 @@ class phpbb_template
|
||||
* configuration setting may be used to force templates to be always
|
||||
* recompiled.
|
||||
*
|
||||
* Returns an object implementing phpbb_template_executor, or null
|
||||
* if template loading or compilation failed. Call execute() on the
|
||||
* executor to execute the template. This will result in template
|
||||
* Returns an object implementing phpbb_template_renderer, or null
|
||||
* if template loading or compilation failed. Call render() on the
|
||||
* renderer to display the template. This will result in template
|
||||
* contents sent to the output stream (unless, of course, output
|
||||
* buffering is in effect).
|
||||
*
|
||||
* @access private
|
||||
* @param string $handle Handle of the template to load
|
||||
* @return phpbb_template_executor Template executor object, or null on failure
|
||||
* @return phpbb_template_renderer Template renderer object, or null on failure
|
||||
* @uses template_compile is used to compile template source
|
||||
*/
|
||||
private function _tpl_load($handle)
|
||||
@ -333,7 +333,7 @@ class phpbb_template
|
||||
// Recompile page if the original template is newer, otherwise load the compiled version
|
||||
if (!$recompile)
|
||||
{
|
||||
return new phpbb_template_executor_include($filename, $this);
|
||||
return new phpbb_template_renderer_include($filename, $this);
|
||||
}
|
||||
|
||||
// Inheritance - we point to another template file for this one.
|
||||
@ -350,18 +350,18 @@ class phpbb_template
|
||||
$output_file = $this->_compiled_file_for_handle($handle);
|
||||
if ($compile->compile_file_to_file($source_file, $output_file) !== false)
|
||||
{
|
||||
$executor = new phpbb_template_executor_include($output_file, $this);
|
||||
$renderer = new phpbb_template_renderer_include($output_file, $this);
|
||||
}
|
||||
else if (($code = $compile->compile_file($source_file)) !== false)
|
||||
{
|
||||
$executor = new phpbb_template_executor_eval($code, $this);
|
||||
$renderer = new phpbb_template_renderer_eval($code, $this);
|
||||
}
|
||||
else
|
||||
{
|
||||
$executor = null;
|
||||
$renderer = null;
|
||||
}
|
||||
|
||||
return $executor;
|
||||
return $renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -489,11 +489,11 @@ class phpbb_template
|
||||
$this->files_inherit[$handle] = $this->inherit_root . '/' . $filename;
|
||||
}
|
||||
|
||||
$executor = $this->_tpl_load($handle);
|
||||
$renderer = $this->_tpl_load($handle);
|
||||
|
||||
if ($executor)
|
||||
if ($renderer)
|
||||
{
|
||||
$executor->execute($this->_context, $this->get_lang());
|
||||
$renderer->render($this->_context, $this->get_lang());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -17,19 +17,19 @@ if (!defined('IN_PHPBB'))
|
||||
}
|
||||
|
||||
/**
|
||||
* Template executor interface.
|
||||
* Template renderer interface.
|
||||
*
|
||||
* Objects implementing this interface encapsulate a means of executing
|
||||
* (i.e. rendering) a template.
|
||||
* Objects implementing this interface encapsulate a means of displaying
|
||||
* a template.
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
interface phpbb_template_executor
|
||||
interface phpbb_template_renderer
|
||||
{
|
||||
/**
|
||||
* Executes the template managed by this executor.
|
||||
* Displays the template managed by this renderer.
|
||||
* @param phpbb_template_context $context Template context to use
|
||||
* @param array $lang Language entries to use
|
||||
*/
|
||||
public function execute($context, $lang);
|
||||
public function render($context, $lang);
|
||||
}
|
@ -17,12 +17,12 @@ if (!defined('IN_PHPBB'))
|
||||
}
|
||||
|
||||
/**
|
||||
* Template executor that stores compiled template's php code and
|
||||
* evaluates it via eval.
|
||||
* Template renderer that stores compiled template's php code and
|
||||
* displays it via eval.
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_template_executor_eval implements phpbb_template_executor
|
||||
class phpbb_template_renderer_eval implements phpbb_template_renderer
|
||||
{
|
||||
/**
|
||||
* Template code to be eval'ed.
|
||||
@ -43,12 +43,12 @@ class phpbb_template_executor_eval implements phpbb_template_executor
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the template managed by this executor by eval'ing php code
|
||||
* 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 execute($context, $lang)
|
||||
public function render($context, $lang)
|
||||
{
|
||||
$_template = &$this->template;
|
||||
$_tpldata = &$context->get_data_ref();
|
@ -18,12 +18,12 @@ if (!defined('IN_PHPBB'))
|
||||
|
||||
|
||||
/**
|
||||
* Template executor that stores path to php file with template code
|
||||
* and evaluates it by including the file.
|
||||
* Template renderer that stores path to php file with template code
|
||||
* and displays it by including the file.
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_template_executor_include implements phpbb_template_executor
|
||||
class phpbb_template_renderer_include implements phpbb_template_renderer
|
||||
{
|
||||
/**
|
||||
* Template path to be included.
|
||||
@ -43,12 +43,12 @@ class phpbb_template_executor_include implements phpbb_template_executor
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the template managed by this executor by including
|
||||
* Displays the template managed by this renderer by including
|
||||
* the php file containing the template.
|
||||
* @param phpbb_template_context $context Template context to use
|
||||
* @param array $lang Language entries to use
|
||||
*/
|
||||
public function execute($context, $lang)
|
||||
public function render($context, $lang)
|
||||
{
|
||||
$_template = &$this->template;
|
||||
$_tpldata = &$context->get_data_ref();
|
Loading…
x
Reference in New Issue
Block a user