summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2011-04-22 15:02:38 -0700
committerTim Almdal <tnalmdal@shaw.ca>2011-04-22 15:02:38 -0700
commitb10e6f66710c25fe2ed71880e9aaffbf41ecb5a4 (patch)
tree73bf33317258fa2db62189e7cceb0d4ed81bc97d /modules/gallery/helpers
parentd7e299015222ba20ed6df7c572fb8bca7e252010 (diff)
parentb9a720e86bcaeab19aca81ee2af2b5c12fda1c55 (diff)
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/item.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php
index 1a5c631e..7e779544 100644
--- a/modules/gallery/helpers/item.php
+++ b/modules/gallery/helpers/item.php
@@ -152,8 +152,18 @@ class item_Core {
* @param string $filename
*/
static function convert_filename_to_slug($filename) {
- $result = pathinfo($filename, PATHINFO_FILENAME);
+ $result = str_replace("&", "-and-", $filename);
+ $result = str_replace(" ", "-", $result);
+
+ // It's not easy to extend the text helper since it's called by the Input class which is
+ // referenced in hooks/init_gallery, so it's
+ if (class_exists("transliterate")) {
+ $result = transliterate::utf8_to_ascii($result);
+ } else {
+ $result = text::transliterate_to_ascii($result);
+ }
$result = preg_replace("/[^A-Za-z0-9-_]+/", "-", $result);
+ $result = preg_replace("/-+/", "-", $result);
return trim($result, "-");
}