[CLEANUP] Code cleanup EXT:filelist 79/36279/7
authorChristian M\üllenhagen <christianmuellenhagen@yahoo.de>
Mon, 26 Jan 2015 22:04:39 +0000 (23:04 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 30 Jan 2015 16:32:25 +0000 (17:32 +0100)
Refactor the code to go green in PHPStorm.
Main tasks:
* Initialize variables
* Centralize objects in $GLOBALS

Resolves: #64496
Releases: master
Change-Id: I3c5803e818bb7f5b1fded7935b4590e4aaf312f6
Reviewed-on: http://review.typo3.org/36279
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Philipp Gampe <philipp.gampe@typo3.org>
Tested-by: Philipp Gampe <philipp.gampe@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/filelist/Classes/Controller/FileListController.php
typo3/sysext/filelist/Classes/FileList.php

index 0fe04b3..0586f61 100644 (file)
@@ -14,8 +14,18 @@ namespace TYPO3\CMS\Filelist\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Backend\Utility\IconUtility;
+use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Resource\Exception;
+use TYPO3\CMS\Core\Resource\ResourceFactory;
+use TYPO3\CMS\Core\Resource\Utility\ListUtility;
+use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
+use TYPO3\CMS\Core\Utility\File\ExtendedFileUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Filelist\FileList;
 
 /**
  * Script Class for creating the list of files in the File > Filelist module
@@ -52,7 +62,7 @@ class FileListController {
        /**
         * Document template object
         *
-        * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
+        * @var DocumentTemplate
         */
        public $doc;
 
@@ -69,7 +79,7 @@ class FileListController {
        protected $folderObject;
 
        /**
-        * @var \TYPO3\CMS\Core\Messaging\FlashMessage
+        * @var FlashMessage
         */
        protected $errorMessage;
 
@@ -107,7 +117,7 @@ class FileListController {
        /**
         * The file list object
         *
-        * @var \TYPO3\CMS\Filelist\FileList
+        * @var FileList
         */
        public $filelist = NULL;
 
@@ -122,8 +132,8 @@ class FileListController {
         * Constructor
         */
        public function __construct() {
-               $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_mod_file_list.xlf');
-               $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xlf');
+               $this->getLanguageService()->includeLLFile('EXT:lang/locallang_mod_file_list.xlf');
+               $this->getLanguageService()->includeLLFile('EXT:lang/locallang_misc.xlf');
        }
 
        /**
@@ -144,8 +154,8 @@ class FileListController {
 
                try {
                        if ($combinedIdentifier) {
-                               /** @var $fileFactory \TYPO3\CMS\Core\Resource\ResourceFactory */
-                               $fileFactory = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\ResourceFactory::class);
+                               /** @var $fileFactory ResourceFactory */
+                               $fileFactory = GeneralUtility::makeInstance(ResourceFactory::class);
                                $storage = $fileFactory->getStorageObjectFromCombinedIdentifier($combinedIdentifier);
                                $identifier = substr($combinedIdentifier, strpos($combinedIdentifier, ':') + 1);
                                if (!$storage->hasFolder($identifier)) {
@@ -161,7 +171,7 @@ class FileListController {
                                }
                        } else {
                                // Take the first object of the first storage
-                               $fileStorages = $GLOBALS['BE_USER']->getFileStorages();
+                               $fileStorages = $this->getBackendUser()->getFileStorages();
                                $fileStorage = reset($fileStorages);
                                if ($fileStorage) {
                                        // Validating the input "id" (the path, directory!) and
@@ -171,9 +181,9 @@ class FileListController {
                                        throw new \RuntimeException('Could not find any folder to be displayed.', 1349276894);
                                }
                        }
-               } catch (\TYPO3\CMS\Core\Resource\Exception $fileException) {
+               } catch (Exception $fileException) {
                        // Take the first object of the first storage
-                       $fileStorages = $GLOBALS['BE_USER']->getFileStorages();
+                       $fileStorages = $this->getBackendUser()->getFileStorages();
                        $fileStorage = reset($fileStorages);
                        if ($fileStorage) {
                                // Set folder object to null and throw a message later on
@@ -181,12 +191,12 @@ class FileListController {
                        } else {
                                $this->folderObject = NULL;
                        }
-                       $this->errorMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class,
-                               sprintf($GLOBALS['LANG']->getLL('folderNotFoundMessage', TRUE),
+                       $this->errorMessage = GeneralUtility::makeInstance(FlashMessage::class,
+                               sprintf($this->getLanguageService()->getLL('folderNotFoundMessage', TRUE),
                                                htmlspecialchars($this->id)
                                ),
-                               $GLOBALS['LANG']->getLL('folderNotFoundTitle', TRUE),
-                               \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE
+                               $this->getLanguageService()->getLL('folderNotFoundTitle', TRUE),
+                               FlashMessage::NOTICE
                        );
                }
                // Configure the "menu" - which is used internally to save the values of sorting, displayThumbs etc.
@@ -225,7 +235,7 @@ class FileListController {
         */
        public function main() {
                // Initialize the template object
-               $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
+               $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->setModuleTemplate('EXT:filelist/Resources/Private/Templates/file_list.html');
 
@@ -239,30 +249,31 @@ class FileListController {
                if ($this->folderObject) {
 
                        // Create filelisting object
-                       $this->filelist = GeneralUtility::makeInstance(\TYPO3\CMS\Filelist\FileList::class);
+                       $this->filelist = GeneralUtility::makeInstance(FileList::class);
                        $this->filelist->backPath = $GLOBALS['BACK_PATH'];
                        // Apply predefined values for hidden checkboxes
                        // Set predefined value for DisplayBigControlPanel:
-                       if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'activated') {
+                       $backendUser = $this->getBackendUser();
+                       if ($backendUser->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'activated') {
                                $this->MOD_SETTINGS['bigControlPanel'] = TRUE;
-                       } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'deactivated') {
+                       } elseif ($backendUser->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'deactivated') {
                                $this->MOD_SETTINGS['bigControlPanel'] = FALSE;
                        }
                        // Set predefined value for DisplayThumbnails:
-                       if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'activated') {
+                       if ($backendUser->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'activated') {
                                $this->MOD_SETTINGS['displayThumbs'] = TRUE;
-                       } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'deactivated') {
+                       } elseif ($backendUser->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'deactivated') {
                                $this->MOD_SETTINGS['displayThumbs'] = FALSE;
                        }
                        // Set predefined value for Clipboard:
-                       if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'activated') {
+                       if ($backendUser->getTSConfigVal('options.file_list.enableClipBoard') === 'activated') {
                                $this->MOD_SETTINGS['clipBoard'] = TRUE;
-                       } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'deactivated') {
+                       } elseif ($backendUser->getTSConfigVal('options.file_list.enableClipBoard') === 'deactivated') {
                                $this->MOD_SETTINGS['clipBoard'] = FALSE;
                        }
                        // If user never opened the list module, set the value for displayThumbs
                        if (!isset($this->MOD_SETTINGS['displayThumbs'])) {
-                               $this->MOD_SETTINGS['displayThumbs'] = $GLOBALS['BE_USER']->uc['thumbnailsByDefault'];
+                               $this->MOD_SETTINGS['displayThumbs'] = $backendUser->uc['thumbnailsByDefault'];
                        }
                        $this->filelist->thumbs = $this->MOD_SETTINGS['displayThumbs'];
                        // Create clipboard object and initialize that
@@ -290,7 +301,7 @@ class FileListController {
                                                $FILE['delete'][] = array('data' => $v);
                                        }
                                        // Init file processing object for deleting and pass the cmd array.
-                                       $fileProcessor = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::class);
+                                       $fileProcessor = GeneralUtility::makeInstance(ExtendedFileUtility::class);
                                        $fileProcessor->init(array(), $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
                                        $fileProcessor->setActionPermissions();
                                        $fileProcessor->dontCheckForUnique = $this->overwriteExistingFiles ? 1 : 0;
@@ -305,7 +316,7 @@ class FileListController {
                                $this->MOD_SETTINGS['reverse'] = 0;
                        }
                        // Start up filelisting object, include settings.
-                       $this->pointer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
+                       $this->pointer = MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
                        $this->filelist->start($this->folderObject, $this->pointer, $this->MOD_SETTINGS['sort'], $this->MOD_SETTINGS['reverse'], $this->MOD_SETTINGS['clipBoard'], $this->MOD_SETTINGS['bigControlPanel']);
                        // Generate the list
                        $this->filelist->generateList();
@@ -325,7 +336,7 @@ class FileListController {
                        ) {
                                $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DragUploader');
                                $pageRenderer->addInlineLanguagelabelFile(
-                                       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('lang') . 'locallang_core.xlf',
+                                       ExtensionManagementUtility::extPath('lang') . 'locallang_core.xlf',
                                        'file_upload'
                                );
                        }
@@ -349,29 +360,29 @@ class FileListController {
                                        <div id="typo3-listOptions">
                                ';
                                // Add "display bigControlPanel" checkbox:
-                               if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'selectable') {
+                               if ($backendUser->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'selectable') {
                                        $pageContent .= '<div class="checkbox">' .
                                                '<label for="bigControlPanel">' .
                                                        BackendUtility::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], '', '', 'id="bigControlPanel"') .
-                                                       $GLOBALS['LANG']->getLL('bigControlPanel', TRUE) .
+                                                       $this->getLanguageService()->getLL('bigControlPanel', TRUE) .
                                                '</label>' .
                                        '</div>';
                                }
                                // Add "display thumbnails" checkbox:
-                               if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'selectable') {
+                               if ($backendUser->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'selectable') {
                                        $pageContent .= '<div class="checkbox">' .
                                                '<label for="checkDisplayThumbs">' .
                                                        BackendUtility::getFuncCheck($this->id, 'SET[displayThumbs]', $this->MOD_SETTINGS['displayThumbs'], '', '', 'id="checkDisplayThumbs"') .
-                                                       $GLOBALS['LANG']->getLL('displayThumbs', TRUE) .
+                                                       $this->getLanguageService()->getLL('displayThumbs', TRUE) .
                                                '</label>' .
                                        '</div>';
                                }
                                // Add "clipboard" checkbox:
-                               if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'selectable') {
+                               if ($backendUser->getTSConfigVal('options.file_list.enableClipBoard') === 'selectable') {
                                        $pageContent .= '<div class="checkbox">' .
                                                '<label for="checkClipBoard">' .
                                                        BackendUtility::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], '', '', 'id="checkClipBoard"') .
-                                                       $GLOBALS['LANG']->getLL('clipBoard', TRUE) .
+                                                       $this->getLanguageService()->getLL('clipBoard', TRUE) .
                                                '</label>' .
                                        '</div>';
                                }
@@ -394,15 +405,15 @@ class FileListController {
                        );
                        $this->content = $this->doc->moduleBody(array(), $docHeaderButtons, array_merge($markerArray, $otherMarkers));
                        // Renders the module page
-                       $this->content = $this->doc->render($GLOBALS['LANG']->getLL('files'), $this->content);
+                       $this->content = $this->doc->render($this->getLanguageService()->getLL('files'), $this->content);
                } else {
                        $content = '';
                        if ($this->errorMessage) {
-                               $this->errorMessage->setSeverity(\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
+                               $this->errorMessage->setSeverity(FlashMessage::ERROR);
                                $content = $this->doc->moduleBody(array(), array_merge(array('REFRESH' => '', 'PASTE' => '', 'LEVEL_UP' => ''), $this->getButtons()), array('CSH' => '', 'TITLE' => '', 'FOLDER_INFO' => '', 'PAGE_ICON' => '', 'FUNC_MENU' => '', 'CONTENT' => $this->errorMessage->render()));
                        }
                        // Create output - no access (no warning though)
-                       $this->content = $this->doc->render($GLOBALS['LANG']->getLL('files'), $content);
+                       $this->content = $this->doc->render($this->getLanguageService()->getLL('files'), $content);
                }
        }
 
@@ -421,7 +432,7 @@ class FileListController {
                                $name = $this->folderObject->getStorage()->getName();
                        }
                } else {
-                       $name = key(\TYPO3\CMS\Core\Resource\Utility\ListUtility::resolveSpecialFolderNames(
+                       $name = key(ListUtility::resolveSpecialFolderNames(
                                array($name => $this->folderObject)
                        ));
                }
@@ -450,7 +461,7 @@ class FileListController {
                        'new' => ''
                );
                // Add shortcut
-               if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
+               if ($this->getBackendUser()->mayMakeShortcut()) {
                        $buttons['shortcut'] = $this->doc->makeShortcutIcon('pointer,id,target,table', implode(',', array_keys($this->MOD_MENU)), $this->moduleName);
                }
                // FileList Module CSH:
@@ -464,7 +475,7 @@ class FileListController {
                                                'target' => $this->folderObject->getCombinedIdentifier(),
                                                'returnUrl' => $this->filelist->listURL(),
                                        )
-                               )) . '" id="button-upload" title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.upload', TRUE)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-upload') . '</a>';
+                               )) . '" id="button-upload" title="' . $this->getLanguageService()->makeEntities($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.upload', TRUE)) . '">' . IconUtility::getSpriteIcon('actions-edit-upload') . '</a>';
                }
                // New folder button
                if ($this->folderObject && $this->folderObject->checkActionPermission('write')
@@ -477,9 +488,27 @@ class FileListController {
                                                'target' => $this->folderObject->getCombinedIdentifier(),
                                                'returnUrl' => $this->filelist->listURL(),
                                        )
-                               )) . '" title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.new', TRUE)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-new') . '</a>';
+                               )) . '" title="' . $this->getLanguageService()->makeEntities($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.new', TRUE)) . '">' . IconUtility::getSpriteIcon('actions-document-new') . '</a>';
                }
                return $buttons;
        }
 
+       /**
+        * Returns an instance of LanguageService
+        *
+        * @return \TYPO3\CMS\Lang\LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
+
+       /**
+        * Returns the current BE user.
+        *
+        * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+        */
+       protected function getBackendUser() {
+               return $GLOBALS['BE_USER'];
+       }
+
 }
index 133e14b..e22ced2 100644 (file)
@@ -14,9 +14,18 @@ namespace TYPO3\CMS\Filelist;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Clipboard\Clipboard;
+use TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider;
+use TYPO3\CMS\Backend\RecordList\AbstractRecordList;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
+use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Resource\File;
+use TYPO3\CMS\Core\Resource\Folder;
+use TYPO3\CMS\Core\Resource\InaccessibleFolder;
+use TYPO3\CMS\Core\Resource\ProcessedFile;
+use TYPO3\CMS\Core\Resource\Utility\ListUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Resource\FolderInterface;
 
@@ -25,7 +34,7 @@ use TYPO3\CMS\Core\Resource\FolderInterface;
  *
  * @author Kasper Skårhøj <kasperYYYY@typo3.com>
  */
-class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
+class FileList extends AbstractRecordList {
 
        /**
         * Default Max items shown
@@ -127,7 +136,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
        public $path = '';
 
        /**
-        * @var \TYPO3\CMS\Core\Resource\Folder
+        * @var Folder
         */
        protected $folderObject;
 
@@ -154,16 +163,22 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
        public $CBnames = array();
 
        /**
+        * @var Clipboard $clipObj
+        */
+       public $clipObj;
+
+       /**
         * Initialization of class
         *
-        * @param \TYPO3\CMS\Core\Resource\Folder $folderObject The folder to work on
+        * @param Folder $folderObject The folder to work on
         * @param int $pointer Pointer
         * @param bool $sort Sorting column
         * @param bool $sortRev Sorting direction
+        * @param bool $clipBoard
         * @param bool $bigControlPanel Show clipboard flag
         * @return void
         */
-       public function start(\TYPO3\CMS\Core\Resource\Folder $folderObject, $pointer, $sort, $sortRev, $clipBoard = FALSE, $bigControlPanel = FALSE) {
+       public function start(Folder $folderObject, $pointer, $sort, $sortRev, $clipBoard = FALSE, $bigControlPanel = FALSE) {
                $this->script = BackendUtility::getModuleUrl('file_list');
                $this->folderObject = $folderObject;
                $this->counter = 0;
@@ -177,8 +192,8 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                $this->clipBoard = $clipBoard;
                $this->bigControlPanel = $bigControlPanel;
                // Setting the maximum length of the filenames to the user's settings or minimum 30 (= $this->fixedL)
-               $this->fixedL = max($this->fixedL, $GLOBALS['BE_USER']->uc['titleLen']);
-               $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_common.xlf');
+               $this->fixedL = max($this->fixedL, $this->getBackendUser()->uc['titleLen']);
+               $this->getLanguageService()->includeLLFile('EXT:lang/locallang_common.xlf');
        }
 
        /**
@@ -193,10 +208,10 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
        /**
         * Return the buttons used by the file list to include in the top header
         *
-        * @param \TYPO3\CMS\Core\Resource\Folder $folderObject
+        * @param Folder $folderObject
         * @return array
         */
-       public function getButtonsAndOtherMarkers(\TYPO3\CMS\Core\Resource\Folder $folderObject) {
+       public function getButtonsAndOtherMarkers(Folder $folderObject) {
                $otherMarkers = array(
                        'PAGE_ICON' => '',
                        'TITLE' => ''
@@ -227,15 +242,15 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                                $otherMarkers['PAGE_ICON'] = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($otherMarkers['PAGE_ICON'], $folderObject->getCombinedIdentifier());
                        }
                        // Add paste button if clipboard is initialized
-                       if ($this->clipObj instanceof \TYPO3\CMS\Backend\Clipboard\Clipboard && $folderObject->checkActionPermission('write')) {
+                       if ($this->clipObj instanceof Clipboard && $folderObject->checkActionPermission('write')) {
                                $elFromTable = $this->clipObj->elFromTable('_FILE');
                                if (count($elFromTable)) {
-                                       $buttons['PASTE'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $this->folderObject->getCombinedIdentifier())) . '" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg('_FILE', $this->path, 'into', $elFromTable)) . '" title="' . $GLOBALS['LANG']->getLL('clip_paste', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
+                                       $buttons['PASTE'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $this->folderObject->getCombinedIdentifier())) . '" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg('_FILE', $this->path, 'into', $elFromTable)) . '" title="' . $this->getLanguageService()->getLL('clip_paste', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
                                }
                        }
 
                }
-               $buttons['refresh'] = '<a href="' . htmlspecialchars($this->listURL()) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-refresh') . '</a>';
+               $buttons['refresh'] = '<a href="' . htmlspecialchars($this->listURL()) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-refresh') . '</a>';
                return array($buttons, $otherMarkers);
        }
 
@@ -277,7 +292,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                        $this->sort = trim($this->sort);
                        if ($this->sort !== '') {
                                $filesToSort = array();
-                               /** @var $fileObject \TYPO3\CMS\Core\Resource\File */
+                               /** @var $fileObject File */
                                foreach ($files as $fileObject) {
                                        switch ($this->sort) {
                                                case 'size':
@@ -340,7 +355,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                        $this->addElement_tdCssClass[$titleCol] = 'col-title';
                        $this->addElement_tdCssClass['_LOCALIZATION_'] = 'col-localizationa';
 
-                       $folderObjects = \TYPO3\CMS\Core\Resource\Utility\ListUtility::resolveSpecialFolderNames($folderObjects);
+                       $folderObjects = ListUtility::resolveSpecialFolderNames($folderObjects);
                        uksort($folderObjects, 'strnatcasecmp');
 
                        // Directories are added
@@ -355,18 +370,18 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                                        $table = '_FILE';
                                        $elFromTable = $this->clipObj->elFromTable($table);
                                        if (count($elFromTable) && $this->folderObject->checkActionPermission('write')) {
-                                               $cells[] = '<a class="btn" href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $this->folderObject->getCombinedIdentifier())) . '" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg('_FILE', $this->path, 'into', $elFromTable)) . '" title="' . $GLOBALS['LANG']->getLL('clip_paste', 1) . '">' . IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
+                                               $cells[] = '<a class="btn" href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $this->folderObject->getCombinedIdentifier())) . '" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg('_FILE', $this->path, 'into', $elFromTable)) . '" title="' . $this->getLanguageService()->getLL('clip_paste', 1) . '">' . IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
                                        }
                                        if ($this->clipObj->current != 'normal' && $iOut) {
-                                               $cells[] = $this->linkClipboardHeaderIcon(IconUtility::getSpriteIcon('actions-edit-copy', array('title' => $GLOBALS['LANG']->getLL('clip_selectMarked', TRUE))), $table, 'setCB');
-                                               $cells[] = $this->linkClipboardHeaderIcon(IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $GLOBALS['LANG']->getLL('clip_deleteMarked'))), $table, 'delete', $GLOBALS['LANG']->getLL('clip_deleteMarkedWarning'));
+                                               $cells[] = $this->linkClipboardHeaderIcon(IconUtility::getSpriteIcon('actions-edit-copy', array('title' => $this->getLanguageService()->getLL('clip_selectMarked', TRUE))), $table, 'setCB');
+                                               $cells[] = $this->linkClipboardHeaderIcon(IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $this->getLanguageService()->getLL('clip_deleteMarked'))), $table, 'delete', $this->getLanguageService()->getLL('clip_deleteMarkedWarning'));
                                                $onClick = 'checkOffCB(\'' . implode(',', $this->CBnames) . '\', this); return false;';
-                                               $cells[] = '<a class="btn" rel="" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $GLOBALS['LANG']->getLL('clip_markRecords', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-select') . '</a>';
+                                               $cells[] = '<a class="btn" rel="" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->getLL('clip_markRecords', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-select') . '</a>';
                                        }
                                        $theData[$v] = implode('', $cells);
                                } else {
                                        // Normal row:
-                                       $theT = $this->linkWrapSort($GLOBALS['LANG']->getLL('c_' . $v, TRUE), $this->folderObject->getCombinedIdentifier(), $v);
+                                       $theT = $this->linkWrapSort($this->getLanguageService()->getLL('c_' . $v, TRUE), $this->folderObject->getCombinedIdentifier(), $v);
                                        $theData[$v] = $theT;
                                }
                        }
@@ -386,22 +401,21 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                        </div>';
 
                } else {
-                       /** @var $flashMessage \TYPO3\CMS\Core\Messaging\FlashMessage */
-                       $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, $GLOBALS['LANG']->getLL('storageNotBrowsableMessage'), $GLOBALS['LANG']->getLL('storageNotBrowsableTitle'), \TYPO3\CMS\Core\Messaging\FlashMessage::INFO);
+                       /** @var $flashMessage FlashMessage */
+                       $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $this->getLanguageService()->getLL('storageNotBrowsableMessage'), $this->getLanguageService()->getLL('storageNotBrowsableTitle'), FlashMessage::INFO);
                        $out = $flashMessage->render();
                }
                return $out;
        }
 
-
        /**
         * If there is a parent folder and user has access to it, return an icon
         * which is linked to the filelist of the parent folder.
         *
-        * @param \TYPO3\CMS\Core\Resource\Folder $currentFolder
+        * @param Folder $currentFolder
         * @return string
         */
-       protected function getLinkToParentFolder(\TYPO3\CMS\Core\Resource\Folder $currentFolder) {
+       protected function getLinkToParentFolder(Folder $currentFolder) {
                $levelUp = '';
                try {
                        $currentStorage = $currentFolder->getStorage();
@@ -410,7 +424,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                                $levelUp = $this->linkWrapDir(
                                        IconUtility::getSpriteIcon(
                                                'actions-view-go-up',
-                                               array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', TRUE))
+                                               array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', TRUE))
                                        ),
                                        $parentFolder
                                );
@@ -418,6 +432,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                } catch (\Exception $e) {}
                return $levelUp;
        }
+
        /**
         * Gets the number of files and total size of a folder
         *
@@ -425,17 +440,17 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
         */
        public function getFolderInfo() {
                if ($this->counter == 1) {
-                       $fileLabel = $GLOBALS['LANG']->getLL('file', TRUE);
+                       $fileLabel = $this->getLanguageService()->getLL('file', TRUE);
                } else {
-                       $fileLabel = $GLOBALS['LANG']->getLL('files', TRUE);
+                       $fileLabel = $this->getLanguageService()->getLL('files', TRUE);
                }
-               return $this->counter . ' ' . $fileLabel . ', ' . GeneralUtility::formatSize($this->totalbytes, $GLOBALS['LANG']->getLL('byteSizeUnits', TRUE));
+               return $this->counter . ' ' . $fileLabel . ', ' . GeneralUtility::formatSize($this->totalbytes, $this->getLanguageService()->getLL('byteSizeUnits', TRUE));
        }
 
        /**
         * This returns tablerows for the directories in the array $items['sorting'].
         *
-        * @param \TYPO3\CMS\Core\Resource\Folder[] $folders Folders of \TYPO3\CMS\Core\Resource\Folder
+        * @param Folder[] $folders Folders of \TYPO3\CMS\Core\Resource\Folder
         * @return string HTML table rows.
         */
        public function formatDirList(array $folders) {
@@ -455,7 +470,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                        list($flag, $code) = $this->fwd_rwd_nav();
                        $out .= $code;
                        if ($flag) {
-                               $isLocked = $folderObject instanceof \TYPO3\CMS\Core\Resource\InaccessibleFolder;
+                               $isLocked = $folderObject instanceof InaccessibleFolder;
                                $isWritable = $folderObject->checkActionPermission('write');
 
                                // Initialization
@@ -479,13 +494,13 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                                                switch ($field) {
                                                        case 'size':
                                                                $numFiles = $folderObject->getFileCount();
-                                                               $theData[$field] = $numFiles . ' ' . $GLOBALS['LANG']->getLL(($numFiles === 1 ? 'file' : 'files'), TRUE);
+                                                               $theData[$field] = $numFiles . ' ' . $this->getLanguageService()->getLL(($numFiles === 1 ? 'file' : 'files'), TRUE);
                                                                break;
                                                        case 'rw':
-                                                               $theData[$field] = '<strong class="text-danger">' . $GLOBALS['LANG']->getLL('read', TRUE) . '</strong>' . (!$isWritable ? '' : '<strong class="text-danger">' . $GLOBALS['LANG']->getLL('write', TRUE) . '</strong>');
+                                                               $theData[$field] = '<strong class="text-danger">' . $this->getLanguageService()->getLL('read', TRUE) . '</strong>' . (!$isWritable ? '' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('write', TRUE) . '</strong>');
                                                                break;
                                                        case 'fileext':
-                                                               $theData[$field] = $GLOBALS['LANG']->getLL('folder', TRUE);
+                                                               $theData[$field] = $this->getLanguageService()->getLL('folder', TRUE);
                                                                break;
                                                        case 'tstamp':
                                                                // @todo: FAL: how to get the mtime info -- $theData[$field] = \TYPO3\CMS\Backend\Utility\BackendUtility::date($theFile['tstamp']);
@@ -504,7 +519,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                                                                $theData[$field] = $this->makeRef($folderObject);
                                                                break;
                                                        default:
-                                                               $theData[$field] = GeneralUtility::fixed_lgd_cs($theFile[$field], $this->fixedL);
+                                                               $theData[$field] = GeneralUtility::fixed_lgd_cs($theData[$field], $this->fixedL);
                                                }
                                        }
                                }
@@ -520,10 +535,10 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
         * Wraps the directory-titles
         *
         * @param string $title String to be wrapped in links
-        * @param \TYPO3\CMS\Core\Resource\Folder $folderObject Folder to work on
+        * @param Folder $folderObject Folder to work on
         * @return string HTML
         */
-       public function linkWrapDir($title, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
+       public function linkWrapDir($title, Folder $folderObject) {
                $href = $this->backPath . $this->script . '&id=' . rawurlencode($folderObject->getCombinedIdentifier());
                $onclick = ' onclick="' . htmlspecialchars(('top.document.getElementsByName("navigation")[0].contentWindow.Tree.highlightActiveItem("file","folder' . GeneralUtility::md5int($folderObject->getCombinedIdentifier()) . '_"+top.fsMod.currentBank)')) . '"';
                // Sometimes $code contains plain HTML tags. In such a case the string should not be modified!
@@ -538,10 +553,10 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
         * Wraps filenames in links which opens them in a window IF they are in web-path.
         *
         * @param string $code String to be wrapped in links
-        * @param \TYPO3\CMS\Core\Resource\File $fileObject File to be linked
+        * @param File $fileObject File to be linked
         * @return string HTML
         */
-       public function linkWrapFile($code, \TYPO3\CMS\Core\Resource\File $fileObject) {
+       public function linkWrapFile($code, File $fileObject) {
                $fileUrl = $fileObject->getPublicUrl(TRUE);
                if ($fileUrl) {
                        $aOnClick = 'return top.openUrlInWindow(\'' . $fileUrl . '\', \'WebFile\');';
@@ -567,15 +582,15 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
        /**
         * This returns tablerows for the files in the array $items['sorting'].
         *
-        * @param \TYPO3\CMS\Core\Resource\File[] $files File items
+        * @param File[] $files File items
         * @return string HTML table rows.
         */
        public function formatFileList(array $files) {
                $out = '';
                // first two keys are "0" (default) and "-1" (multiple), after that comes the "other languages"
-               $allSystemLanguages = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider::class)->getSystemLanguages();
+               $allSystemLanguages = GeneralUtility::makeInstance(TranslationConfigurationProvider::class)->getSystemLanguages();
                $systemLanguages = array_filter($allSystemLanguages, function($languageRecord) {
-                       if ($languageRecord['uid'] === -1 || $languageRecord['uid'] === 0 || !$GLOBALS['BE_USER']->checkLanguageAccess($languageRecord['uid'])) {
+                       if ($languageRecord['uid'] === -1 || $languageRecord['uid'] === 0 || !$this->getBackendUser()->checkLanguageAccess($languageRecord['uid'])) {
                                return FALSE;
                        } else {
                                return TRUE;
@@ -601,10 +616,10 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                                foreach ($this->fieldArray as $field) {
                                        switch ($field) {
                                                case 'size':
-                                                       $theData[$field] = GeneralUtility::formatSize($fileObject->getSize(), $GLOBALS['LANG']->getLL('byteSizeUnits', TRUE));
+                                                       $theData[$field] = GeneralUtility::formatSize($fileObject->getSize(), $this->getLanguageService()->getLL('byteSizeUnits', TRUE));
                                                        break;
                                                case 'rw':
-                                                       $theData[$field] = '' . (!$fileObject->checkActionPermission('read') ? ' ' : '<strong class="text-danger">' . $GLOBALS['LANG']->getLL('read', TRUE) . '</strong>') . (!$fileObject->checkActionPermission('write') ? '' : '<strong class="text-danger">' . $GLOBALS['LANG']->getLL('write', TRUE) . '</strong>');
+                                                       $theData[$field] = '' . (!$fileObject->checkActionPermission('read') ? ' ' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('read', TRUE) . '</strong>') . (!$fileObject->checkActionPermission('write') ? '' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('write', TRUE) . '</strong>');
                                                        break;
                                                case 'fileext':
                                                        $theData[$field] = strtoupper($ext);
@@ -654,7 +669,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
 
                                                                // Hide flag button bar when not translated yet
                                                                $theData[$field] = ' <div class="localisationData btn-group" data-fileid="' . $fileObject->getUid() . '"' .
-                                                                               (empty($translations) ? ' style="display: none;"' : '') . '>' . $languageCode . '</div>';
+                                                                       (empty($translations) ? ' style="display: none;"' : '') . '>' . $languageCode . '</div>';
                                                                $theData[$field] .= '<a class="btn filelist-translationToggler" data-fileid="' . $fileObject->getUid() . '">' .
                                                                        IconUtility::getSpriteIcon(
                                                                                'mimetypes-x-content-page-language-overlay',
@@ -673,9 +688,9 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                                                        if ($fileObject->isMissing()) {
                                                                $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject);
                                                                $theData[$field] .= $flashMessage->render();
-                                                       // Thumbnails?
+                                                               // Thumbnails?
                                                        } elseif ($this->thumbs && $this->isImage($ext)) {
-                                                               $processedFile = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
+                                                               $processedFile = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
                                                                if ($processedFile) {
                                                                        $thumbUrl = $processedFile->getPublicUrl(TRUE);
                                                                        $theData[$field] .= '<br /><img src="' . $thumbUrl . '" title="' . htmlspecialchars($fileName) . '" alt="" />';
@@ -706,7 +721,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
        protected function getTranslationsForMetaData($metaDataRecord) {
                $where = $GLOBALS['TCA']['sys_file_metadata']['ctrl']['transOrigPointerField'] . '=' . (int)$metaDataRecord['uid'] .
                        ' AND ' . $GLOBALS['TCA']['sys_file_metadata']['ctrl']['languageField'] . '>0';
-               $translationRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_file_metadata', $where);
+               $translationRecords = $this->getDatabaseConnection()->exec_SELECTgetRows('*', 'sys_file_metadata', $where);
                $translations = array();
                foreach ($translationRecords as $record) {
                        $translations[$record[$GLOBALS['TCA']['sys_file_metadata']['ctrl']['languageField']]] = $record;
@@ -748,7 +763,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
        /**
         * Creates the clipboard control pad
         *
-        * @param \TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\Folder $fileOrFolderObject Array with information about the file/directory for which to make the clipboard panel for the listing.
+        * @param File|Folder $fileOrFolderObject Array with information about the file/directory for which to make the clipboard panel for the listing.
         * @return string HTML-table
         */
        public function makeClip($fileOrFolderObject) {
@@ -761,10 +776,10 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                // For normal clipboard, add copy/cut buttons:
                if ($this->clipObj->current == 'normal') {
                        $isSel = $this->clipObj->isSelected('_FILE', $md5);
-                       $cells[] = '<a class="btn" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 1, ($isSel == 'copy'))) . '">' . IconUtility::getSpriteIcon(('actions-edit-copy' . ($isSel == 'copy' ? '-release' : '')), array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.copy', TRUE))) . '</a>';
+                       $cells[] = '<a class="btn" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 1, ($isSel == 'copy'))) . '">' . IconUtility::getSpriteIcon(('actions-edit-copy' . ($isSel == 'copy' ? '-release' : '')), array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.copy', TRUE))) . '</a>';
                        // we can only cut if file can be moved
                        if ($fileOrFolderObject->checkActionPermission('move')) {
-                               $cells[] = '<a class="btn" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 0, ($isSel == 'cut'))) . '">' . IconUtility::getSpriteIcon(('actions-edit-cut' . ($isSel == 'cut' ? '-release' : '')), array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.cut', TRUE))) . '</a>';
+                               $cells[] = '<a class="btn" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 0, ($isSel == 'cut'))) . '">' . IconUtility::getSpriteIcon(('actions-edit-cut' . ($isSel == 'cut' ? '-release' : '')), array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.cut', TRUE))) . '</a>';
                        } else {
                                $cells[] = $this->spaceIcon;
                        }
@@ -773,12 +788,12 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                        $n = '_FILE|' . $md5;
                        $this->CBnames[] = $n;
                        $checked = $this->clipObj->isSelected('_FILE', $md5) ? ' checked="checked"' : '';
-                       $cells[] = '<div class="btn-checkbox-holder"><input type="hidden" name="CBH[' . $n . ']" value="0" /><input type="checkbox" name="CBC[' . $n . ']" value="' . htmlspecialchars($fullIdentifier) . '" class="smallCheckboxes btn-checkbox"' . $checked . ' /><span class="btn"><span class="t3-icon fa"></span></span></div>';
+                       $cells[] = '<div class="btn-checkbox-holder"><input type="hidden" name="CBH[' . $n . ']" value="0" /><input type="checkbox" name="CBC[' . $n . ']" value="' . htmlspecialchars($fullIdentifier) . '" class="smallCheckboxes btn-checkbox" ' . $checked . ' /><span class="btn"><span class="t3-icon fa"></span></span></div>';
                }
                // Display PASTE button, if directory:
                $elFromTable = $this->clipObj->elFromTable('_FILE');
-               if (is_a($fileOrFolderObject, \TYPO3\CMS\Core\Resource\Folder::class) && count($elFromTable) && $fileOrFolderObject->checkActionPermission('write')) {
-                       $cells[] = '<a class="btn" href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $fullIdentifier)) . '" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg('_FILE', $fullIdentifier, 'into', $elFromTable)) . '" title="' . $GLOBALS['LANG']->getLL('clip_pasteInto', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-paste-into') . '</a>';
+               if (is_a($fileOrFolderObject, Folder::class) && count($elFromTable) && $fileOrFolderObject->checkActionPermission('write')) {
+                       $cells[] = '<a class="btn" href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $fullIdentifier)) . '" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg('_FILE', $fullIdentifier, 'into', $elFromTable)) . '" title="' . $this->getLanguageService()->getLL('clip_pasteInto', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-paste-into') . '</a>';
                }
                // Compile items into a DIV-element:
                return ' <div class="btn-group">' . implode('', $cells) . '</div>';
@@ -787,7 +802,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
        /**
         * Creates the edit control section
         *
-        * @param \TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\Folder $fileOrFolderObject Array with information about the file/directory for which to make the edit control section for the listing.
+        * @param File|Folder $fileOrFolderObject Array with information about the file/directory for which to make the edit control section for the listing.
         * @return string HTML-table
         */
        public function makeEdit($fileOrFolderObject) {
@@ -795,13 +810,13 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
                // Edit metadata of file
                try {
-                       if (is_a($fileOrFolderObject, \TYPO3\CMS\Core\Resource\File::class) && $fileOrFolderObject->isIndexed() && $fileOrFolderObject->checkActionPermission('write')) {
+                       if (is_a($fileOrFolderObject, File::class) && $fileOrFolderObject->isIndexed() && $fileOrFolderObject->checkActionPermission('write')) {
                                $metaData = $fileOrFolderObject->_getMetaData();
                                $data = array(
                                        'sys_file_metadata' => array($metaData['uid'] => 'edit')
                                );
                                $editOnClick = BackendUtility::editOnClick(GeneralUtility::implodeArrayForUrl('edit', $data), $GLOBALS['BACK_PATH'], $this->listUrl());
-                               $title = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.editMetadata'));
+                               $title = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.editMetadata'));
                                $cells['editmetadata'] = '<a href="#" class="btn" onclick="' . $editOnClick . '" title="' . $title . '">'
                                        . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
                        } else {
@@ -811,10 +826,10 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                        $cells['editmetadata'] = $this->spaceIcon;
                }
                // Edit file content (if editable)
-               if (is_a($fileOrFolderObject, \TYPO3\CMS\Core\Resource\File::class) && $fileOrFolderObject->checkActionPermission('write') && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileOrFolderObject->getExtension())) {
+               if (is_a($fileOrFolderObject, File::class) && $fileOrFolderObject->checkActionPermission('write') && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileOrFolderObject->getExtension())) {
                        $url = BackendUtility::getModuleUrl('file_edit', array('target' => $fullIdentifier));
                        $editOnClick = 'top.content.list_frame.location.href=top.TS.PATH_typo3+' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
-                       $cells['edit'] = '<a href="#" class="btn" onclick="' . htmlspecialchars($editOnClick) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.editcontent') . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>';
+                       $cells['edit'] = '<a href="#" class="btn" onclick="' . htmlspecialchars($editOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.editcontent') . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>';
                } else {
                        $cells['edit'] = $this->spaceIcon;
                }
@@ -822,17 +837,18 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                if ($fileOrFolderObject->checkActionPermission('rename')) {
                        $url = BackendUtility::getModuleUrl('file_rename', array('target' => $fullIdentifier));
                        $renameOnClick = 'top.content.list_frame.location.href = top.TS.PATH_typo3+' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
-                       $cells['rename'] = '<a href="#" class="btn" onclick="' . htmlspecialchars($renameOnClick) . '"  title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.rename') . '">' . IconUtility::getSpriteIcon('actions-edit-rename') . '</a>';
+                       $cells['rename'] = '<a href="#" class="btn" onclick="' . htmlspecialchars($renameOnClick) . '"  title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.rename') . '">' . IconUtility::getSpriteIcon('actions-edit-rename') . '</a>';
                } else {
                        $cells['rename'] = $this->spaceIcon;
                }
                if ($fileOrFolderObject->checkActionPermission('read')) {
-                       if (is_a($fileOrFolderObject, \TYPO3\CMS\Core\Resource\Folder::class)) {
+                       $infoOnClick = '';
+                       if (is_a($fileOrFolderObject, Folder::class)) {
                                $infoOnClick = 'top.launchView( \'_FOLDER\', \'' . $fullIdentifier . '\');return false;';
-                       } elseif (is_a($fileOrFolderObject, \TYPO3\CMS\Core\Resource\File::class)) {
+                       } elseif (is_a($fileOrFolderObject, File::class)) {
                                $infoOnClick = 'top.launchView( \'_FILE\', \'' . $fullIdentifier . '\');return false;';
                        }
-                       $cells['info'] = '<a href="#" class="btn" onclick="' . $infoOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.info') . '">' . IconUtility::getSpriteIcon('status-dialog-information') . '</a>';
+                       $cells['info'] = '<a href="#" class="btn" onclick="' . $infoOnClick . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.info') . '">' . IconUtility::getSpriteIcon('status-dialog-information') . '</a>';
                } else {
                        $cells['info'] = $this->spaceIcon;
                }
@@ -840,21 +856,21 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                // delete the file
                if ($fileOrFolderObject->checkActionPermission('delete')) {
                        $identifier = $fileOrFolderObject->getIdentifier();
-                       if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
+                       if ($fileOrFolderObject instanceof Folder) {
                                $referenceCountText = BackendUtility::referenceCount('_FILE', $identifier, ' (There are %s reference(s) to this folder!)');
                        } else {
                                $referenceCountText = BackendUtility::referenceCount('sys_file', $fileOrFolderObject->getUid(), ' (There are %s reference(s) to this file!)');
                        }
 
-                       if ($GLOBALS['BE_USER']->jsConfirmation(4)) {
-                               $confirmationCheck = 'confirm(' . GeneralUtility::quoteJSvalue(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText) . ')';
+                       if ($this->getBackendUser()->jsConfirmation(4)) {
+                               $confirmationCheck = 'confirm(' . GeneralUtility::quoteJSvalue(sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText) . ')';
                        } else {
                                $confirmationCheck = '1 == 1';
                        }
 
-                       $removeOnClick = 'if (' . $confirmationCheck . ') { top.content.list_frame.location.href=top.TS.PATH_typo3+\'tce_file.php?file[delete][0][data]=' . rawurlencode($fileOrFolderObject->getCombinedIdentifier()) . '&vC=' . $GLOBALS['BE_USER']->veriCode() . BackendUtility::getUrlToken('tceAction') . '&redirect=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);};';
+                       $removeOnClick = 'if (' . $confirmationCheck . ') { top.content.list_frame.location.href=top.TS.PATH_typo3+\'tce_file.php?file[delete][0][data]=' . rawurlencode($fileOrFolderObject->getCombinedIdentifier()) . '&vC=' . $this->getBackendUser()->veriCode() . BackendUtility::getUrlToken('tceAction') . '&redirect=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);};';
 
-                       $cells['delete'] = '<a href="#" class="btn" onclick="' . htmlspecialchars($removeOnClick) . '"  title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete') . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
+                       $cells['delete'] = '<a href="#" class="btn" onclick="' . htmlspecialchars($removeOnClick) . '"  title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete') . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
                } else {
                        $cells['delete'] = $this->spaceIcon;
                }
@@ -863,7 +879,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) {
                        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) {
                                $hookObject = GeneralUtility::getUserObj($classData);
-                               if (!$hookObject instanceof \TYPO3\CMS\Filelist\FileListEditIconHookInterface) {
+                               if (!$hookObject instanceof FileListEditIconHookInterface) {
                                        throw new \UnexpectedValueException(
                                                '$hookObject must implement interface \\TYPO3\\CMS\\Filelist\\FileListEditIconHookInterface',
                                                1235225797
@@ -879,11 +895,11 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
        /**
         * Make reference count
         *
-        * @param \TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\Folder $fileOrFolderObject Array with information about the file/directory for which to make the clipboard panel for the listing.
+        * @param File|Folder $fileOrFolderObject Array with information about the file/directory for which to make the clipboard panel for the listing.
         * @return string HTML
         */
        public function makeRef($fileOrFolderObject) {
-               if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\FolderInterface) {
+               if ($fileOrFolderObject instanceof FolderInterface) {
                        return '-';
                }
                // Look up the file in the sys_refindex.
@@ -904,4 +920,22 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                return $GLOBALS['TYPO3_DB'];
        }
 
+       /**
+        * Returns an instance of LanguageService
+        *
+        * @return \TYPO3\CMS\Lang\LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
+
+       /**
+        * Returns the current BE user.
+        *
+        * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+        */
+       protected function getBackendUser() {
+               return $GLOBALS['BE_USER'];
+       }
+
 }