mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-21 06:53:49 +02:00
[feature/template-events] Pass top-level template name to template filter.
This will be used to invoke template-specific hooks. PHPBB3-9550
This commit is contained in:
parent
dd7c5183fb
commit
a6c7fbc59d
@ -36,14 +36,16 @@ 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 $template_name Name of top-level template being compiled
|
||||
* @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
|
||||
*/
|
||||
public function __construct($allow_php, $locator, $phpbb_root_path, $extension_manager = null)
|
||||
public function __construct($allow_php, $template_name, $locator, $phpbb_root_path, $extension_manager = null)
|
||||
{
|
||||
$this->filter_params = array(
|
||||
'allow_php' => $allow_php,
|
||||
'template_name' => $template_name,
|
||||
'locator' => $locator,
|
||||
'phpbb_root_path' => $phpbb_root_path,
|
||||
'extension_manager' => $extension_manager,
|
||||
|
@ -87,6 +87,16 @@ class phpbb_template_filter extends php_user_filter
|
||||
*/
|
||||
private $phpbb_root_path;
|
||||
|
||||
/**
|
||||
* Name of the top-level template being compiled and/or rendered.
|
||||
*
|
||||
* This is used by hooks implementation to invoke template-specific
|
||||
* template hooks.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $template_name;
|
||||
|
||||
/**
|
||||
* Extension manager.
|
||||
*
|
||||
@ -152,7 +162,7 @@ class phpbb_template_filter extends php_user_filter
|
||||
/**
|
||||
* Initializer, called on creation.
|
||||
*
|
||||
* Get the allow_php option, root directory and locator from params,
|
||||
* Get the allow_php option, template_name, root directory and locator from params,
|
||||
* which are passed to stream_filter_append.
|
||||
*/
|
||||
public function onCreate()
|
||||
@ -162,6 +172,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->template_name = $this->params['template_name'];
|
||||
$this->extension_manager = $this->params['extension_manager'];
|
||||
$this->template_compile = $this->params['template_compile'];
|
||||
return true;
|
||||
|
@ -81,6 +81,16 @@ class phpbb_template
|
||||
*/
|
||||
private $extension_manager;
|
||||
|
||||
/**
|
||||
* Name of the top-level template being compiled and/or rendered.
|
||||
*
|
||||
* This is used by hooks implementation to invoke template-specific
|
||||
* template hooks.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $template_name;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@ -291,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->locator, $this->phpbb_root_path, $this->extension_manager);
|
||||
$compile = new phpbb_template_compile($this->config['tpl_allow_php'], $this->template_name, $this->locator, $this->phpbb_root_path, $this->extension_manager);
|
||||
|
||||
if ($compile->compile_file_to_file($source_file, $output_file) !== false)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user