summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/gallery.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-09-28 09:04:44 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-09-28 09:04:44 -0700
commit28624bb8f1a153208ae811ffb56c436055f74249 (patch)
treed4d1b196324bf9335ea7e578660c33dfb6a3bded /modules/gallery/helpers/gallery.php
parentcec4493545dba0c1dbbf1ed825d06aa8f5d2cf0e (diff)
Update the PHPDoc for gallery::find_file and convert Gallery_View::script/css to use gallery::find_file
Diffstat (limited to 'modules/gallery/helpers/gallery.php')
-rw-r--r--modules/gallery/helpers/gallery.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index d4f733e4..033bf4bd 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -83,14 +83,21 @@ class gallery_Core {
* 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
+ * @param string filename to look for
+ * @param boolean file required (optional: default false)
+ * @param boolean make the file name relative (optiona: default false)
+ * @return array if the type is config, i18n or l10n
+ * @return string if the file is found (relative to the DOCROOT)
+ * @return FALSE if the file is not found
*/
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));
+ if (!$file_name && file_exists(DOCROOT . "lib/$file")) {
+ return "lib/$file";
+ }
+
+ return is_string($file_name) ? substr($file_name, strlen(DOCROOT)) : $file_name;
}
static function site_menu($menu, $theme) {