mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/10756] Renaming template classes
Renaming template classes from phpbb_style_template_ to phpbb_template_ PHPBB3-10756
This commit is contained in:
parent
733018f99a
commit
ef295a2860
10 changed files with 24 additions and 24 deletions
|
@ -119,7 +119,7 @@ class phpbb_style
|
||||||
|
|
||||||
$this->template->cachepath = $this->phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $name) . '_';
|
$this->template->cachepath = $this->phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $name) . '_';
|
||||||
|
|
||||||
$this->template->context = new phpbb_style_template_context();
|
$this->template->context = new phpbb_template_context();
|
||||||
|
|
||||||
if ($template_path !== false)
|
if ($template_path !== false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@ if (!defined('IN_PHPBB'))
|
||||||
class phpbb_style_template
|
class phpbb_style_template
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var phpbb_style_template_context Template context.
|
* @var phpbb_template_context Template context.
|
||||||
* Stores template data used during template rendering.
|
* Stores template data used during template rendering.
|
||||||
*/
|
*/
|
||||||
public $context;
|
public $context;
|
||||||
|
@ -253,15 +253,15 @@ class phpbb_style_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_style_template_renderer, or null
|
* Returns an object implementing phpbb_template_renderer, or null
|
||||||
* if template loading or compilation failed. Call render() on the
|
* if template loading or compilation failed. Call render() on the
|
||||||
* renderer to display 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).
|
||||||
*
|
*
|
||||||
* @param string $handle Handle of the template to load
|
* @param string $handle Handle of the template to load
|
||||||
* @return phpbb_style_template_renderer Template renderer object, or null on failure
|
* @return phpbb_template_renderer Template renderer object, or null on failure
|
||||||
* @uses phpbb_style_template_compile is used to compile template source
|
* @uses phpbb_template_compile is used to compile template source
|
||||||
*/
|
*/
|
||||||
private function _tpl_load($handle)
|
private function _tpl_load($handle)
|
||||||
{
|
{
|
||||||
|
@ -285,18 +285,18 @@ class phpbb_style_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_style_template_renderer_include($output_file, $this);
|
return new phpbb_template_renderer_include($output_file, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
$compile = new phpbb_style_template_compile($this->config['tpl_allow_php'], $this->locator, $this->phpbb_root_path);
|
$compile = new phpbb_template_compile($this->config['tpl_allow_php'], $this->locator, $this->phpbb_root_path);
|
||||||
|
|
||||||
if ($compile->compile_file_to_file($source_file, $output_file) !== false)
|
if ($compile->compile_file_to_file($source_file, $output_file) !== false)
|
||||||
{
|
{
|
||||||
$renderer = new phpbb_style_template_renderer_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)
|
||||||
{
|
{
|
||||||
$renderer = new phpbb_style_template_renderer_eval($code, $this);
|
$renderer = new phpbb_template_renderer_eval($code, $this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -358,7 +358,7 @@ class phpbb_style_template
|
||||||
$this->context->append_var($varname, $varval);
|
$this->context->append_var($varname, $varval);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Docstring is copied from phpbb_style_template_context method with the same name.
|
// Docstring is copied from phpbb_template_context method with the same name.
|
||||||
/**
|
/**
|
||||||
* Assign key variable pairs from an array to a specified block
|
* Assign key variable pairs from an array to a specified block
|
||||||
* @param string $blockname Name of block to assign $vararray to
|
* @param string $blockname Name of block to assign $vararray to
|
||||||
|
@ -369,7 +369,7 @@ class phpbb_style_template
|
||||||
return $this->context->assign_block_vars($blockname, $vararray);
|
return $this->context->assign_block_vars($blockname, $vararray);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Docstring is copied from phpbb_style_template_context method with the same name.
|
// Docstring is copied from phpbb_template_context method with the same name.
|
||||||
/**
|
/**
|
||||||
* Change already assigned key variable pair (one-dimensional - single loop entry)
|
* Change already assigned key variable pair (one-dimensional - single loop entry)
|
||||||
*
|
*
|
||||||
|
|
|
@ -15,7 +15,7 @@ if (!defined('IN_PHPBB'))
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_filter_register('phpbb_template', 'phpbb_style_template_filter');
|
stream_filter_register('phpbb_template', 'phpbb_template_filter');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of template class - Functions needed for compiling templates only.
|
* Extension of template class - Functions needed for compiling templates only.
|
||||||
|
@ -23,7 +23,7 @@ stream_filter_register('phpbb_template', 'phpbb_style_template_filter');
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
* @uses template_filter As a PHP stream filter to perform compilation of templates
|
* @uses template_filter As a PHP stream filter to perform compilation of templates
|
||||||
*/
|
*/
|
||||||
class phpbb_style_template_compile
|
class phpbb_template_compile
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Array of parameters to forward to template filter
|
* Array of parameters to forward to template filter
|
||||||
|
|
|
@ -20,7 +20,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_style_template_context
|
class phpbb_template_context
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* variable that holds all the data we'll be substituting into
|
* variable that holds all the data we'll be substituting into
|
||||||
|
|
|
@ -35,7 +35,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* @see template_compile
|
* @see template_compile
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_style_template_filter extends php_user_filter
|
class phpbb_template_filter extends php_user_filter
|
||||||
{
|
{
|
||||||
const REGEX_NS = '[a-z_][a-z_0-9]+';
|
const REGEX_NS = '[a-z_][a-z_0-9]+';
|
||||||
|
|
||||||
|
|
|
@ -23,12 +23,12 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
interface phpbb_style_template_renderer
|
interface phpbb_template_renderer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Displays the template managed by this renderer.
|
* Displays the template managed by this renderer.
|
||||||
*
|
*
|
||||||
* @param phpbb_style_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 render($context, $lang);
|
public function render($context, $lang);
|
||||||
|
|
|
@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_style_template_renderer_eval implements phpbb_style_template_renderer
|
class phpbb_template_renderer_eval implements phpbb_template_renderer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Template code to be eval'ed.
|
* Template code to be eval'ed.
|
||||||
|
@ -45,7 +45,7 @@ class phpbb_style_template_renderer_eval implements phpbb_style_template_rendere
|
||||||
* Displays the template managed by this renderer 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_style_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 render($context, $lang)
|
public function render($context, $lang)
|
||||||
|
|
|
@ -22,7 +22,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_style_template_renderer_include implements phpbb_style_template_renderer
|
class phpbb_template_renderer_include implements phpbb_template_renderer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Template path to be included.
|
* Template path to be included.
|
||||||
|
@ -45,7 +45,7 @@ class phpbb_style_template_renderer_include implements phpbb_style_template_rend
|
||||||
* Displays the template managed by this renderer 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_style_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 render($context, $lang)
|
public function render($context, $lang)
|
||||||
|
|
|
@ -13,8 +13,8 @@ class phpbb_template_renderer_eval_test extends phpbb_test_case
|
||||||
{
|
{
|
||||||
$compiled_code = '<a href="<?php echo \'Test\'; ?>">';
|
$compiled_code = '<a href="<?php echo \'Test\'; ?>">';
|
||||||
$valid_code = '<a href="Test">';
|
$valid_code = '<a href="Test">';
|
||||||
$context = new phpbb_style_template_context();
|
$context = new phpbb_template_context();
|
||||||
$template = new phpbb_style_template_renderer_eval($compiled_code, NULL);
|
$template = new phpbb_template_renderer_eval($compiled_code, NULL);
|
||||||
ob_start();
|
ob_start();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ class phpbb_template_template_compile_test extends phpbb_test_case
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->template_compile = new phpbb_style_template_compile(false, null, '');
|
$this->template_compile = new phpbb_template_compile(false, null, '');
|
||||||
$this->template_path = dirname(__FILE__) . '/templates';
|
$this->template_path = dirname(__FILE__) . '/templates';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue