summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/gallery.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/helpers/gallery.php')
-rw-r--r--modules/gallery/helpers/gallery.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index 37a08d08..6d387d76 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -110,4 +110,17 @@ class gallery_Core {
return $file_name;
}
+ /**
+ * Return a full path to the theme or module file. It checks the APPPATH/(themes|modules) first
+ * then the THEMEPATH | MODPATH
+ * @param $file the file or directory
+ * @param $type ("module" | "theme" optional: defaults to "module")
+ * @return string
+ */
+ static function plugin_path($file, $type="module") {
+ if (!file_exists($ofile = APPPATH . "{$type}s/$file")) {
+ $ofile = $type == "module" ? MODPATH . $file : THEMEPATH . $file;
+ }
+ return $ofile;
+ }
} \ No newline at end of file