diff --git a/phpBB/includes/style/resource_locator.php b/phpBB/includes/style/resource_locator.php index e3bcf4d9c4..a5bf595671 100644 --- a/phpBB/includes/style/resource_locator.php +++ b/phpBB/includes/style/resource_locator.php @@ -44,7 +44,7 @@ class phpbb_style_resource_locator implements phpbb_template_locator * style directory, such as admin control panel templates. * @var string */ - public $template_path = 'template/'; + private $template_path; /** * Map from root index to handles to source template file paths. @@ -63,6 +63,11 @@ class phpbb_style_resource_locator implements phpbb_template_locator */ private $filenames = array(); + public function __construct() + { + $this->set_default_template_path(); + } + /** * Sets the list of style paths * @@ -93,6 +98,19 @@ class phpbb_style_resource_locator implements phpbb_template_locator } } + /** + * Sets the location of templates directory within style directories. + */ + public function set_template_path($template_path) + { + $this->template_path = $template_path; + } + + public function set_default_template_path() + { + $this->template_path = 'template/'; + } + /** * {@inheritDoc} */ diff --git a/phpBB/includes/style/style.php b/phpBB/includes/style/style.php index d8974bc516..effd496fb9 100644 --- a/phpBB/includes/style/style.php +++ b/phpBB/includes/style/style.php @@ -110,7 +110,7 @@ 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 string $template_path Path to templates, relative to style directory. False if path should not be changed. + * @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) { @@ -122,12 +122,16 @@ class phpbb_style $this->provider->set_styles($paths); $this->locator->set_paths($this->provider); - $this->template->cachepath = $this->phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $name) . '_'; - if ($template_path !== false) { - $this->locator->template_path = $template_path; + $this->locator->set_template_path($template_path); } + else + { + $this->locator->set_default_template_path(); + } + + $this->template->cachepath = $this->phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $name) . '_'; return true; }