diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-01-18 13:24:52 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-01-18 13:24:52 +0100 |
commit | 4d7964d9101d08b5e7533cea50e52e07bf3f783a (patch) | |
tree | 20066128d8218f5054075fe85dc517ab954813b0 /program/include/rcmail.php | |
parent | 8e8f3b96b51fde1df953de7398b15e0f01e10777 (diff) |
Improved folder path presentation in page title (use unified delimiter, localize path).
E.g. folder "INBOX.test" will be displayed as "Inbox >> test"
Diffstat (limited to 'program/include/rcmail.php')
-rw-r--r-- | program/include/rcmail.php | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 249bd0559..c734216ac 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1677,12 +1677,31 @@ class rcmail extends rcube * Try to localize the given IMAP folder name. * UTF-7 decode it in case no localized text was found * - * @param string $name Folder name + * @param string $name Folder name + * @param bool $with_path Enable path localization * * @return string Localized folder name in UTF-8 encoding */ - public function localize_foldername($name) + public function localize_foldername($name, $with_path = true) { + // try to localize path of the folder + if ($with_path) { + $storage = $this->get_storage(); + $delimiter = $storage->get_hierarchy_delimiter(); + $path = explode($delimiter, $name); + $count = count($path); + + if ($count > 1) { + for ($i = 1; $i < $count; $i++) { + $folder = implode($delimiter, array_slice($path, 0, -$i)); + if ($folder_class = $this->folder_classname($folder)) { + $name = implode($delimiter, array_slice($path, $count - $i)); + return $this->gettext($folder_class) . $delimiter . rcube_charset::convert($name, 'UTF7-IMAP'); + } + } + } + } + if ($folder_class = $this->folder_classname($name)) { return $this->gettext($folder_class); } |