[CLEANUP] ImportExport classes
[Packages/TYPO3.CMS.git] / typo3 / sysext / impexp / Classes / Clickmenu.php
index eea16f0..ac45c4b 100644 (file)
@@ -14,9 +14,11 @@ namespace TYPO3\CMS\Impexp;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * Adding Import/Export clickmenu item
@@ -50,7 +52,7 @@ class Clickmenu
     {
         $localItems = array();
         // Show import/export on second level menu OR root level.
-        if ($backRef->cmLevel && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) {
+        if ($backRef->cmLevel && GeneralUtility::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) {
             $LL = $this->includeLL();
             $urlParameters = array(
                 'tx_impexp' => array(
@@ -66,9 +68,14 @@ class Clickmenu
                 $urlParameters['tx_impexp']['record'][] = $table . ':' . $uid;
                 $urlParameters['tx_impexp']['external_ref']['tables'][] = '_ALL';
             }
-            $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
-            $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('export', $LL)), $backRef->excludeIcon($this->iconFactory->getIcon('actions-document-export-t3d', Icon::SIZE_SMALL)), $backRef->urlRefForCM($url), 1);
-            if ($table == 'pages') {
+            $url = BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
+            $localItems[] = $backRef->linkItem(
+                $this->getLanguageService()->makeEntities($this->getLanguageService()->getLLL('export', $LL)),
+                $backRef->excludeIcon($this->iconFactory->getIcon('actions-document-export-t3d', Icon::SIZE_SMALL)),
+                $backRef->urlRefForCM($url),
+                1
+            );
+            if ($table === 'pages') {
                 $urlParameters = array(
                     'id' => $uid,
                     'table' => $table,
@@ -76,8 +83,13 @@ class Clickmenu
                         'action' => 'import'
                     ),
                 );
-                $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
-                $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('import', $LL)), $backRef->excludeIcon($this->iconFactory->getIcon('actions-document-import-t3d', Icon::SIZE_SMALL)), $backRef->urlRefForCM($url), 1);
+                $url = BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
+                $localItems[] = $backRef->linkItem(
+                    $this->getLanguageService()->makeEntities($this->getLanguageService()->getLLL('import', $LL)),
+                    $backRef->excludeIcon($this->iconFactory->getIcon('actions-document-import-t3d', Icon::SIZE_SMALL)),
+                    $backRef->urlRefForCM($url),
+                    1
+                );
             }
         }
         return array_merge($menuItems, $localItems);
@@ -90,6 +102,14 @@ class Clickmenu
      */
     public function includeLL()
     {
-        return $GLOBALS['LANG']->includeLLFile('EXT:impexp/Resources/Private/Language/locallang.xlf', false);
+        return $this->getLanguageService()->includeLLFile('EXT:impexp/Resources/Private/Language/locallang.xlf', false);
+    }
+
+    /**
+     * @return LanguageService
+     */
+    protected function getLanguageService()
+    {
+        return $GLOBALS['LANG'];
     }
 }