mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-12 22:38:52 +00:00
[feature/template-events] Rename template_name to style_name.
"Style name" makes a lot more sense and should be in line with recent style/template changes. PHPBB3-9550
This commit is contained in:
parent
0df0c6199b
commit
9c31a0ffc7
3 changed files with 18 additions and 17 deletions
|
@ -36,17 +36,17 @@ class phpbb_template_compile
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param bool $allow_php Whether PHP code will be allowed in templates (inline PHP code, PHP tag and INCLUDEPHP tag)
|
* @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 string $style_name Name of style to which the template being compiled belongs
|
||||||
* @param phpbb_style_resource_locator $locator Resource locator
|
* @param phpbb_style_resource_locator $locator Resource locator
|
||||||
* @param string $phpbb_root_path Path to phpBB root directory
|
* @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_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
|
* @param phpbb_user $user Current user
|
||||||
*/
|
*/
|
||||||
public function __construct($allow_php, $template_name, $locator, $phpbb_root_path, $extension_manager = null, $user = null)
|
public function __construct($allow_php, $style_name, $locator, $phpbb_root_path, $extension_manager = null, $user = null)
|
||||||
{
|
{
|
||||||
$this->filter_params = array(
|
$this->filter_params = array(
|
||||||
'allow_php' => $allow_php,
|
'allow_php' => $allow_php,
|
||||||
'template_name' => $template_name,
|
'style_name' => $style_name,
|
||||||
'locator' => $locator,
|
'locator' => $locator,
|
||||||
'phpbb_root_path' => $phpbb_root_path,
|
'phpbb_root_path' => $phpbb_root_path,
|
||||||
'extension_manager' => $extension_manager,
|
'extension_manager' => $extension_manager,
|
||||||
|
|
|
@ -88,14 +88,15 @@ class phpbb_template_filter extends php_user_filter
|
||||||
private $phpbb_root_path;
|
private $phpbb_root_path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the top-level template being compiled and/or rendered.
|
* Name of the style that the template being compiled and/or rendered
|
||||||
|
* belongs to.
|
||||||
*
|
*
|
||||||
* This is used by hooks implementation to invoke template-specific
|
* This is used by hooks implementation to invoke style-specific
|
||||||
* template hooks.
|
* template hooks.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $template_name;
|
private $style_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension manager.
|
* Extension manager.
|
||||||
|
@ -168,7 +169,7 @@ class phpbb_template_filter extends php_user_filter
|
||||||
/**
|
/**
|
||||||
* Initializer, called on creation.
|
* Initializer, called on creation.
|
||||||
*
|
*
|
||||||
* Get the allow_php option, template_name, root directory and locator from params,
|
* Get the allow_php option, style_name, root directory and locator from params,
|
||||||
* which are passed to stream_filter_append.
|
* which are passed to stream_filter_append.
|
||||||
*/
|
*/
|
||||||
public function onCreate()
|
public function onCreate()
|
||||||
|
@ -178,7 +179,7 @@ class phpbb_template_filter extends php_user_filter
|
||||||
$this->allow_php = $this->params['allow_php'];
|
$this->allow_php = $this->params['allow_php'];
|
||||||
$this->locator = $this->params['locator'];
|
$this->locator = $this->params['locator'];
|
||||||
$this->phpbb_root_path = $this->params['phpbb_root_path'];
|
$this->phpbb_root_path = $this->params['phpbb_root_path'];
|
||||||
$this->template_name = $this->params['template_name'];
|
$this->style_name = $this->params['style_name'];
|
||||||
$this->extension_manager = $this->params['extension_manager'];
|
$this->extension_manager = $this->params['extension_manager'];
|
||||||
if (isset($this->params['user']))
|
if (isset($this->params['user']))
|
||||||
{
|
{
|
||||||
|
@ -932,17 +933,16 @@ class phpbb_template_filter extends php_user_filter
|
||||||
$files = array_merge($files, $finder
|
$files = array_merge($files, $finder
|
||||||
->extension_prefix($location)
|
->extension_prefix($location)
|
||||||
->extension_suffix('.html')
|
->extension_suffix('.html')
|
||||||
->extension_directory("/styles/" . $this->template_name . "/template")
|
->extension_directory("/styles/" . $this->style_name . "/template")
|
||||||
->get_files());
|
->get_files());
|
||||||
|
|
||||||
$all_compiled = '';
|
$all_compiled = '';
|
||||||
foreach ($files as $file)
|
foreach ($files as $file)
|
||||||
{
|
{
|
||||||
$compiled = $this->template_compile->compile_file($file);
|
$compiled = $this->template_compile->compile_file($file);
|
||||||
if ($compiled === false)
|
if ($compiled === false) {
|
||||||
{
|
trigger_error(sprintf('The file could not be compiled: %s', phpbb_filter_root_path($file)), E_USER_ERROR);
|
||||||
trigger_error(sprintf('The file could not be compiled: %s', phpbb_filter_root_path($file)), E_USER_ERROR);
|
}
|
||||||
}
|
|
||||||
$all_compiled .= $compiled;
|
$all_compiled .= $compiled;
|
||||||
}
|
}
|
||||||
// Need spaces inside php tags as php cannot grok
|
// Need spaces inside php tags as php cannot grok
|
||||||
|
|
|
@ -82,14 +82,15 @@ class phpbb_template
|
||||||
private $extension_manager;
|
private $extension_manager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the top-level template being compiled and/or rendered.
|
* Name of the style that the template being compiled and/or rendered
|
||||||
|
* belongs to.
|
||||||
*
|
*
|
||||||
* This is used by hooks implementation to invoke template-specific
|
* This is used by hooks implementation to invoke style-specific
|
||||||
* template hooks.
|
* template hooks.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $template_name;
|
private $style_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -301,7 +302,7 @@ class phpbb_template
|
||||||
return new phpbb_template_renderer_include($output_file, $this);
|
return new phpbb_template_renderer_include($output_file, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
$compile = new phpbb_template_compile($this->config['tpl_allow_php'], $this->template_name, $this->locator, $this->phpbb_root_path, $this->extension_manager, $this->user);
|
$compile = new phpbb_template_compile($this->config['tpl_allow_php'], $this->style_name, $this->locator, $this->phpbb_root_path, $this->extension_manager, $this->user);
|
||||||
|
|
||||||
if ($compile->compile_file_to_file($source_file, $output_file) !== false)
|
if ($compile->compile_file_to_file($source_file, $output_file) !== false)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue