diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2012-06-12 00:02:30 -0400 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2012-11-02 19:39:05 -0400 |
commit | 09794c6821a93023c19d6b74e8e5d0e835e37be6 (patch) | |
tree | 09c63f9897e369cedb2d8a31bd50d5166c9751c3 | |
parent | 6295b014d35890d60ccf422f5bb8228569e8ca3a (diff) | |
download | forums-09794c6821a93023c19d6b74e8e5d0e835e37be6.tar forums-09794c6821a93023c19d6b74e8e5d0e835e37be6.tar.gz forums-09794c6821a93023c19d6b74e8e5d0e835e37be6.tar.bz2 forums-09794c6821a93023c19d6b74e8e5d0e835e37be6.tar.xz forums-09794c6821a93023c19d6b74e8e5d0e835e37be6.zip |
[ticket/10933] Add mutators for template_path to style resource locator.
template_path is now private.
Change semantics of passing false for template path - now this resets
template path to default which I think makes sense.
PHPBB3-10933
-rw-r--r-- | phpBB/includes/style/resource_locator.php | 20 | ||||
-rw-r--r-- | phpBB/includes/style/style.php | 12 |
2 files changed, 27 insertions, 5 deletions
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 * @@ -94,6 +99,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} */ public function set_filenames(array $filename_array) 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,13 +122,17 @@ 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; } |