diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-23 19:45:23 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-23 19:45:23 -0700 |
commit | 8bab030883647ffaf0e0bd4d172261159d19dd08 (patch) | |
tree | 57f649fd304d20513dac0e0e9df2a3332ab98861 /modules/gallery/helpers/gallery.php | |
parent | b038e9cbb4d913088a26f8c4e6e4699de9c860d7 (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.php | 14 |
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") |