diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-09-07 15:41:03 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-09-07 15:42:08 -0700 |
commit | 3f997562dee7fa45fec58604dd894d9c523a1113 (patch) | |
tree | 2508fdb8ecc95e660fc555d7c64bbf59affed2ed /modules/gallery/helpers/item.php | |
parent | 68a78f7cced4f26436d7bdbc6acdd9e0a9ada4df (diff) |
Add support for a per-item "slug" which will be the user-visible url
component for that given item. Album hierarchies are represented by
nested slugs. By default, we convert the filename to a slug when you
create an album, photo or movie.
Diffstat (limited to 'modules/gallery/helpers/item.php')
-rw-r--r-- | modules/gallery/helpers/item.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index 8839861f..bf948731 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -121,6 +121,14 @@ class item_Core { } /** + * Convert a filename into something we can use as a url component. + * @param string $filename + */ + static function convert_filename_to_slug($filename) { + return preg_replace("/[^A-Za-z0-9-_]+/", "-", pathinfo($filename, PATHINFO_FILENAME)); + } + + /** * Display delete confirmation message and form * @param object $item * @return string form |