aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/style
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-06-11 23:43:00 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2012-11-02 19:37:52 -0400
commit615d5ef628767ec127735fb4797171de3f886de2 (patch)
tree0eb5317ef4ed5407c38310c1cb1113d58fee20bb /phpBB/includes/style
parent816c546666b9ee27a717efc4f5640afc4794cff6 (diff)
downloadforums-615d5ef628767ec127735fb4797171de3f886de2.tar
forums-615d5ef628767ec127735fb4797171de3f886de2.tar.gz
forums-615d5ef628767ec127735fb4797171de3f886de2.tar.bz2
forums-615d5ef628767ec127735fb4797171de3f886de2.tar.xz
forums-615d5ef628767ec127735fb4797171de3f886de2.zip
[ticket/10933] Add get_first_template_location.
This localizes template_path to style resource locator. locate function on template will be removed in a subsequent commit. PHPBB3-10933
Diffstat (limited to 'phpBB/includes/style')
-rw-r--r--phpBB/includes/style/resource_locator.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/phpBB/includes/style/resource_locator.php b/phpBB/includes/style/resource_locator.php
index 8658fe4a36..e3bcf4d9c4 100644
--- a/phpBB/includes/style/resource_locator.php
+++ b/phpBB/includes/style/resource_locator.php
@@ -229,4 +229,31 @@ class phpbb_style_resource_locator implements phpbb_template_locator
// search failed
return $default_result;
}
+
+ /**
+ * Just like get_first_file_location but works on a list of templates,
+ * not files.
+ *
+ * The templates given in the first argument first are prepended with
+ * the template path (property in this class), then given to
+ * get_first_file_location for the rest of the processing.
+ */
+ public function get_first_template_location($templates, $return_default = false, $return_full_path = true)
+ {
+ // add template path prefix
+ $files = array();
+ if (is_string($templates))
+ {
+ $files[] = $this->template_path . $templates;
+ }
+ else
+ {
+ foreach ($templates as $template)
+ {
+ $files[] = $this->template_path . $template;
+ }
+ }
+
+ return $this->get_first_file_location($files, $return_default, $return_full_path);
+ }
}