[feature/template-engine] Renamed template executor and friends to renderer.

PHPBB3-9726
This commit is contained in:
Oleg Pudeyev 2011-05-08 04:03:41 -04:00
parent 1cba674b9a
commit 84bc485ccc
4 changed files with 33 additions and 33 deletions

View file

@ -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; return true;
} }
else else
@ -270,8 +270,8 @@ class phpbb_template
} }
/** /**
* Obtains a template executor for a template identified by specified * Obtains a template renderer for a template identified by specified
* handle. THe template executor can execute the template later. * handle. The template renderer can display the template later.
* *
* Template source will first be compiled into php code. * Template source will first be compiled into php code.
* If template cache is writable the compiled php code will be stored * 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 * configuration setting may be used to force templates to be always
* recompiled. * recompiled.
* *
* Returns an object implementing phpbb_template_executor, or null * Returns an object implementing phpbb_template_renderer, or null
* if template loading or compilation failed. Call execute() on the * if template loading or compilation failed. Call render() on the
* executor to execute the template. This will result in template * renderer to display the template. This will result in template
* contents sent to the output stream (unless, of course, output * contents sent to the output stream (unless, of course, output
* buffering is in effect). * buffering is in effect).
* *
* @access private * @access private
* @param string $handle Handle of the template to load * @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 * @uses template_compile is used to compile template source
*/ */
private function _tpl_load($handle) 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 // Recompile page if the original template is newer, otherwise load the compiled version
if (!$recompile) 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. // 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); $output_file = $this->_compiled_file_for_handle($handle);
if ($compile->compile_file_to_file($source_file, $output_file) !== false) 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) 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 else
{ {
$executor = null; $renderer = null;
} }
return $executor; return $renderer;
} }
/** /**
@ -489,11 +489,11 @@ class phpbb_template
$this->files_inherit[$handle] = $this->inherit_root . '/' . $filename; $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 else
{ {

View file

@ -17,19 +17,19 @@ if (!defined('IN_PHPBB'))
} }
/** /**
* Template executor interface. * Template renderer interface.
* *
* Objects implementing this interface encapsulate a means of executing * Objects implementing this interface encapsulate a means of displaying
* (i.e. rendering) a template. * a template.
* *
* @package phpBB3 * @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 phpbb_template_context $context Template context to use
* @param array $lang Language entries to use * @param array $lang Language entries to use
*/ */
public function execute($context, $lang); public function render($context, $lang);
} }

View file

@ -17,12 +17,12 @@ if (!defined('IN_PHPBB'))
} }
/** /**
* Template executor that stores compiled template's php code and * Template renderer that stores compiled template's php code and
* evaluates it via eval. * displays it via eval.
* *
* @package phpBB3 * @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. * 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. * of the template.
* @param phpbb_template_context $context Template context to use * @param phpbb_template_context $context Template context to use
* @param array $lang Language entries to use * @param array $lang Language entries to use
*/ */
public function execute($context, $lang) public function render($context, $lang)
{ {
$_template = &$this->template; $_template = &$this->template;
$_tpldata = &$context->get_data_ref(); $_tpldata = &$context->get_data_ref();

View file

@ -18,12 +18,12 @@ if (!defined('IN_PHPBB'))
/** /**
* Template executor that stores path to php file with template code * Template renderer that stores path to php file with template code
* and evaluates it by including the file. * and displays it by including the file.
* *
* @package phpBB3 * @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. * 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. * the php file containing the template.
* @param phpbb_template_context $context Template context to use * @param phpbb_template_context $context Template context to use
* @param array $lang Language entries to use * @param array $lang Language entries to use
*/ */
public function execute($context, $lang) public function render($context, $lang)
{ {
$_template = &$this->template; $_template = &$this->template;
$_tpldata = &$context->get_data_ref(); $_tpldata = &$context->get_data_ref();