1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-01 14:30:32 +02:00

[feature/template-events] Convert a single style name to array of them.

This allows template code to know the entire style hierarchy for
templates being rendered.

PHPBB3-9550
This commit is contained in:
Oleg Pudeyev
2012-11-08 12:21:06 -05:00
parent 0a29312d83
commit 44d6dc4c4c
13 changed files with 33 additions and 26 deletions

View File

@@ -36,17 +36,17 @@ class phpbb_template_compile
* Constructor.
*
* @param bool $allow_php Whether PHP code will be allowed in templates (inline PHP code, PHP tag and INCLUDEPHP tag)
* @param string $style_name Name of style to which the template being compiled belongs
* @param array $style_names Name of style to which the template being compiled belongs and parents in style tree order
* @param phpbb_style_resource_locator $locator Resource locator
* @param string $phpbb_root_path Path to phpBB root directory
* @param phpbb_extension_manager $extension_manager Extension manager to use for finding template fragments in extensions; if null, template hooks will not be invoked
* @param phpbb_user $user Current user
*/
public function __construct($allow_php, $style_name, $locator, $phpbb_root_path, $extension_manager = null, $user = null)
public function __construct($allow_php, $style_names, $locator, $phpbb_root_path, $extension_manager = null, $user = null)
{
$this->filter_params = array(
'allow_php' => $allow_php,
'style_name' => $style_name,
'style_names' => $style_names,
'locator' => $locator,
'phpbb_root_path' => $phpbb_root_path,
'extension_manager' => $extension_manager,

View File

@@ -89,14 +89,13 @@ class phpbb_template_filter extends php_user_filter
/**
* Name of the style that the template being compiled and/or rendered
* belongs to.
* belongs to, and its parents, in inheritance tree order.
*
* This is used by hooks implementation to invoke style-specific
* template hooks.
* Used to invoke style-specific template events.
*
* @var string
* @var array
*/
private $style_name;
private $style_names;
/**
* Extension manager.
@@ -169,7 +168,7 @@ class phpbb_template_filter extends php_user_filter
/**
* Initializer, called on creation.
*
* Get the allow_php option, style_name, root directory and locator from params,
* Get the allow_php option, style_names, root directory and locator from params,
* which are passed to stream_filter_append.
*/
public function onCreate()
@@ -179,7 +178,7 @@ class phpbb_template_filter extends php_user_filter
$this->allow_php = $this->params['allow_php'];
$this->locator = $this->params['locator'];
$this->phpbb_root_path = $this->params['phpbb_root_path'];
$this->style_name = $this->params['style_name'];
$this->style_names = $this->params['style_names'];
$this->extension_manager = $this->params['extension_manager'];
if (isset($this->params['user']))
{

View File

@@ -83,14 +83,13 @@ class phpbb_template
/**
* Name of the style that the template being compiled and/or rendered
* belongs to.
* belongs to, and its parents, in inheritance tree order.
*
* This is used by hooks implementation to invoke style-specific
* template hooks.
* Used to invoke style-specific template events.
*
* @var string
* @var array
*/
private $style_name;
public $style_names;
/**
* Constructor.
@@ -302,7 +301,7 @@ class phpbb_template
return new phpbb_template_renderer_include($output_file, $this);
}
$compile = new phpbb_template_compile($this->config['tpl_allow_php'], $this->style_name, $this->locator, $this->phpbb_root_path, $this->extension_manager, $this->user);
$compile = new phpbb_template_compile($this->config['tpl_allow_php'], $this->style_names, $this->locator, $this->phpbb_root_path, $this->extension_manager, $this->user);
if ($compile->compile_file_to_file($source_file, $output_file) !== false)
{