summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/gallery.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-09-23 19:45:23 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-09-23 19:45:23 -0700
commit8bab030883647ffaf0e0bd4d172261159d19dd08 (patch)
tree57f649fd304d20513dac0e0e9df2a3332ab98861 /modules/gallery/helpers/gallery.php
parentb038e9cbb4d913088a26f8c4e6e4699de9c860d7 (diff)
Add a new api method gallery::find_file. This wraps the Kohana::find_file function, but allows the extension to supplied as part of the filename. Changed the Edit permission dialog to use the new api method to locate the icons from the active theme.
Diffstat (limited to 'modules/gallery/helpers/gallery.php')
-rw-r--r--modules/gallery/helpers/gallery.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index 91dd2073..d4f733e4 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -79,6 +79,20 @@ class gallery_Core {
return date(module::get_var("gallery", "time_format", "H:i:s"), $timestamp);
}
+ /**
+ * Provide a wrapper function for Kohana::find_file, that first strips the extension and
+ * then calls the Kohana::find_file supply that extension
+ * @param string directory to search in
+ * @param string filename to look for (without extension)
+ * @param boolean file required
+ * @return the file relative to the DOCROOT
+ */
+ static function find_file($directory, $file, $required=false) {
+ $file_name = substr($file, 0, -strlen($ext = strrchr($file, '.')));
+ $file_name = Kohana::find_file($directory, $file_name, $required, substr($ext, 1));
+ return substr($file_name, strlen(DOCROOT));
+ }
+
static function site_menu($menu, $theme) {
if ($theme->page_type != "login") {
$menu->append(Menu::factory("link")