summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/legal_file.php
diff options
context:
space:
mode:
authorNathan Kinkade <nath@nkinka.de>2012-05-12 13:06:18 +0000
committerNathan Kinkade <nath@nkinka.de>2012-05-12 13:06:18 +0000
commitf5098f54b8279f468d94747b1156e15ea05d6d25 (patch)
tree2ecfb6663887ffbc72de8f231864b6c78bd62640 /modules/gallery/helpers/legal_file.php
parenta13fd7f373f3718037a2ce90a3cb408f24856602 (diff)
parentd1390bd87db1a7e59bbd72f5991fbbc6374c98b4 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/gallery/helpers/legal_file.php')
-rw-r--r--modules/gallery/helpers/legal_file.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/gallery/helpers/legal_file.php b/modules/gallery/helpers/legal_file.php
index 6ec65e97..af6472ca 100644
--- a/modules/gallery/helpers/legal_file.php
+++ b/modules/gallery/helpers/legal_file.php
@@ -80,4 +80,16 @@ class legal_file_Core {
module::event("legal_movie_types", $types_wrapper);
return $types_wrapper->types;
}
+
+ /**
+ * Convert the extension of a filename. If the original filename has no
+ * extension, add the new one to the end.
+ */
+ static function change_extension($filename, $new_ext) {
+ if (strpos($filename, ".") === false) {
+ return "{$filename}.{$new_ext}";
+ } else {
+ return preg_replace("/\..*?$/", ".{$new_ext}", $filename);
+ }
+ }
}