From e52022c572c6f1a7cbab7e665e4b738f9e084f7f Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 1 Sep 2011 15:16:21 -0400 Subject: [PATCH] [feature/extension-manager] Make sure named styles are loaded from root dir PHPBB3-10323 --- phpBB/includes/template/extension_path_provider.php | 6 ++++-- phpBB/includes/template/path_provider.php | 6 ++++-- phpBB/includes/template/path_provider_interface.php | 4 +++- phpBB/includes/template/template.php | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/template/extension_path_provider.php b/phpBB/includes/template/extension_path_provider.php index 67f0dd48c1..9578702b65 100644 --- a/phpBB/includes/template/extension_path_provider.php +++ b/phpBB/includes/template/extension_path_provider.php @@ -91,11 +91,13 @@ class phpbb_template_extension_path_provider extends phpbb_extension_provider im * The first element is the main template. * If the path is false, it will be generated from * the supplied name. + * @param string $style_root_path The root directory for styles identified + * by name only. * @return null */ - public function set_templates(array $templates) + public function set_templates(array $templates, $style_root_path) { - $this->base_paths->set_templates($templates); + $this->base_paths->set_templates($templates, $style_root_path); $this->items = null; } diff --git a/phpBB/includes/template/path_provider.php b/phpBB/includes/template/path_provider.php index e6c8b34e15..80e3ef87d7 100644 --- a/phpBB/includes/template/path_provider.php +++ b/phpBB/includes/template/path_provider.php @@ -44,9 +44,11 @@ class phpbb_template_path_provider implements IteratorAggregate, phpbb_template_ * The first element is the main template. * If the path is false, it will be generated from * the supplied name. + * @param string $style_root_path The root directory for styles identified + * by name only. * @return null */ - public function set_templates(array $templates) + public function set_templates(array $templates, $style_root_path) { $this->paths; @@ -54,7 +56,7 @@ class phpbb_template_path_provider implements IteratorAggregate, phpbb_template_ { if (!$path) { - $path = $this->template_root_for_style($name); + $path = $style_root_path . $this->template_root_for_style($name); } $this->paths[] = $path; diff --git a/phpBB/includes/template/path_provider_interface.php b/phpBB/includes/template/path_provider_interface.php index 800d7697d9..822393a91e 100644 --- a/phpBB/includes/template/path_provider_interface.php +++ b/phpBB/includes/template/path_provider_interface.php @@ -39,9 +39,11 @@ interface phpbb_template_path_provider_interface extends Traversable * The first element is the main template. * If the path is false, it will be generated from * the supplied name. + * @param string $style_root_path The root directory for styles identified + * by name only. * @return null */ - public function set_templates(array $templates); + public function set_templates(array $templates, $style_root_path); /** * Retrieves the path to the main template passed into set_templates() diff --git a/phpBB/includes/template/template.php b/phpBB/includes/template/template.php index d46032f521..228ea93513 100644 --- a/phpBB/includes/template/template.php +++ b/phpBB/includes/template/template.php @@ -133,7 +133,7 @@ class phpbb_template $templates[$fallback_template_name] = $fallback_template_path; } - $this->provider->set_templates($templates); + $this->provider->set_templates($templates, $this->phpbb_root_path); $this->locator->set_paths($this->provider); $this->locator->set_main_template($this->provider->get_main_template_path());