[TASK] Re-work/simplify copyright header in PHP files - Part 3
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Resource / Utility / ListUtility.php
1 <?php
2 namespace TYPO3\CMS\Core\Resource\Utility;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16 /**
17 * Utility function for working with resource-lists
18 */
19 class ListUtility {
20
21 /**
22 * Resolve special folders (by their role) into localised string
23 *
24 * @param array $folders Array of \TYPO3\CMS\Core\Resource\Folder
25 * @return array Array of \TYPO3\CMS\Core\Resource\Folder; folder name or role with folder name as keys
26 */
27 static public function resolveSpecialFolderNames(array $folders) {
28 $resolvedFolders = array();
29
30 /** @var $folder \TYPO3\CMS\Core\Resource\Folder */
31 foreach ($folders as $folder) {
32 $name = $folder->getName();
33 $role = $folder->getRole();
34 if ($role !== \TYPO3\CMS\Core\Resource\FolderInterface::ROLE_DEFAULT) {
35 $tempName = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:role_folder_' . $role, TRUE);
36 if (!empty($tempName) && ($tempName !== $name)) {
37 // Set new name and append original name
38 $name = $tempName . ' (' . $name . ')';
39 }
40 }
41 $resolvedFolders[$name] = $folder;
42 }
43
44 return $resolvedFolders;
45 }
46
47 }