diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-10-04 09:45:17 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-10-04 10:12:21 -0700 |
commit | aa0529d557ed0609bf7e5b23a5cf2437f7998c4b (patch) | |
tree | 028337388818b1a1ef0de24c9ee7d62162206e05 /modules/gallery/helpers/gallery.php | |
parent | 60c15e41b37fbe6b2adc7789b21b7e5acea3e949 (diff) |
Create a gallery::plugin_path which returns the appropriate path to the module or theme. This checks for the existence of an application/modules or application/themes first.
Diffstat (limited to 'modules/gallery/helpers/gallery.php')
-rw-r--r-- | modules/gallery/helpers/gallery.php | 13 |
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 |