summaryrefslogtreecommitdiff
path: root/plugins/kolab_folders
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2012-10-17 10:12:45 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2012-10-17 10:12:45 (GMT)
commitd356302759bea5fc14d12ae6a5d6638d8a875975 (patch)
tree41f2735e8d6b221048c17786c955eb6e4b341afd /plugins/kolab_folders
parentfad8e68fe7461d65b8834f77bfcdfc4264b06860 (diff)
downloadroundcubemail-plugins-kolab-d356302759bea5fc14d12ae6a5d6638d8a875975.tar.gz
Cut off folder type suffix from shared annotation values (#1105); small code cleanup to reduce redundancy
Diffstat (limited to 'plugins/kolab_folders')
-rw-r--r--plugins/kolab_folders/kolab_folders.php19
1 files changed, 2 insertions, 17 deletions
diff --git a/plugins/kolab_folders/kolab_folders.php b/plugins/kolab_folders/kolab_folders.php
index 3f83847..c8def8f 100644
--- a/plugins/kolab_folders/kolab_folders.php
+++ b/plugins/kolab_folders/kolab_folders.php
@@ -337,14 +337,7 @@ class kolab_folders extends rcube_plugin
*/
function get_folder_type($folder)
{
- $storage = $this->rc->get_storage();
- $folderdata = $storage->get_metadata($folder, array(kolab_storage::CTYPE_KEY_PRIVATE, kolab_storage::CTYPE_KEY));
-
- if (!($ctype = $folderdata[$folder][kolab_storage::CTYPE_KEY_PRIVATE])) {
- $ctype = $folderdata[$folder][kolab_storage::CTYPE_KEY];
- }
-
- return explode('.', $ctype);
+ return explode('.', (string)kolab_storage::folder_type($folder));
}
/**
@@ -380,7 +373,7 @@ class kolab_folders extends rcube_plugin
$namespace = $storage->get_namespace();
// get all folders of specified type
- $folderdata = array_map(array($this, 'folder_select_metadata'), $folderdata);
+ $folderdata = array_map(array('kolab_storage', 'folder_select_metadata'), $folderdata);
$folderdata = array_intersect($folderdata, array($type));
foreach ($folderdata as $folder => $data) {
@@ -403,14 +396,6 @@ class kolab_folders extends rcube_plugin
}
/**
- * Callback for array_map to select the correct annotation value
- */
- private function folder_select_metadata($types)
- {
- return $types[kolab_storage::CTYPE_KEY_PRIVATE] ?: $types[kolab_storage::CTYPE_KEY];
- }
-
- /**
* Returns CSS class name for specified folder type
*
* @param string $type Folder type