aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions_messenger.php2
-rw-r--r--phpBB/includes/style/style.php11
-rw-r--r--phpBB/includes/template/compile.php6
-rw-r--r--phpBB/includes/template/filter.php13
-rw-r--r--phpBB/includes/template/template.php11
5 files changed, 25 insertions, 18 deletions
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index 55884caedb..2043e2f7be 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -231,7 +231,7 @@ class messenger
}
}
- $style->set_custom_style($template_lang . '_email', array($template_path, $fallback_template_path), '');
+ $style->set_custom_style($template_lang . '_email', array($template_path, $fallback_template_path), array(), '');
$tpl->set_filenames(array(
'body' => $template_file . '.txt',
diff --git a/phpBB/includes/style/style.php b/phpBB/includes/style/style.php
index effd496fb9..9ce96c5da5 100644
--- a/phpBB/includes/style/style.php
+++ b/phpBB/includes/style/style.php
@@ -110,18 +110,27 @@ class phpbb_style
*
* @param string $name Name of style, used for cache prefix. Examples: "admin", "prosilver"
* @param array or string $paths Array of style paths, relative to current root directory
+ * @param array $names Array of names of templates in inheritance tree order, used by extensions. If empty, $name will be used.
* @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/).
*/
- public function set_custom_style($name, $paths, $template_path = false)
+ public function set_custom_style($name, $paths, $names = array(), $template_path = false)
{
if (is_string($paths))
{
$paths = array($paths);
}
+ if (empty($names))
+ {
+ $names = array($name);
+ }
+ $this->names = $names;
+
$this->provider->set_styles($paths);
$this->locator->set_paths($this->provider);
+ $this->template->style_names = $names;
+
if ($template_path !== false)
{
$this->locator->set_template_path($template_path);
diff --git a/phpBB/includes/template/compile.php b/phpBB/includes/template/compile.php
index c2762bfd59..76ad2317c9 100644
--- a/phpBB/includes/template/compile.php
+++ b/phpBB/includes/template/compile.php
@@ -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,
diff --git a/phpBB/includes/template/filter.php b/phpBB/includes/template/filter.php
index 5d9e00553f..a5a0865569 100644
--- a/phpBB/includes/template/filter.php
+++ b/phpBB/includes/template/filter.php
@@ -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']))
{
diff --git a/phpBB/includes/template/template.php b/phpBB/includes/template/template.php
index 52c08326d5..4d257d2510 100644
--- a/phpBB/includes/template/template.php
+++ b/phpBB/includes/template/template.php
@@ -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)
{