[TASK] Cleanup extra_page_cm_options 52/17952/3
authorWouter Wolters <typo3@wouterwolters.nl>
Sat, 2 Feb 2013 15:24:02 +0000 (16:24 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 3 Feb 2013 18:05:52 +0000 (19:05 +0100)
Cleanup the code in extra_page_cm_options

Change-Id: I324115dae3514cc7b6f4ea350d244d13a3f6d818
Resolves: #45096
Releases: 6.1
Reviewed-on: https://review.typo3.org/17952
Reviewed-by: Oliver Klee
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extra_page_cm_options/Classes/ExtraPageContextMenuOptions.php
typo3/sysext/extra_page_cm_options/ext_tables.php
typo3/sysext/extra_page_cm_options/locallang.xlf

index 98175e4..a34895a 100644 (file)
@@ -26,15 +26,9 @@ namespace TYPO3\CMS\ExtraPageCmOptions;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
- * Class, adding extra context menu options
- *
- * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
- *
- * @author Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-/**
- * Class, adding extra context menu options
+ * Class to add extra context menu options
  *
  * @author Kasper Skårhøj <kasperYYYY@typo3.com>
  */
@@ -49,7 +43,6 @@ class ExtraPageContextMenuOptions {
         * @param string $table Table name of clicked item.
         * @param integer $uid UID of clicked item.
         * @return array Modified $menuItems array
-        * @todo Define visibility
         */
        public function main(&$backRef, $menuItems, $table, $uid) {
                // Accumulation of local items.
@@ -60,25 +53,31 @@ class ExtraPageContextMenuOptions {
                if (!in_array('moreoptions', $backRef->disabledItems) && !$backRef->cmLevel) {
                        // Creating menu items here:
                        if ($backRef->editOK) {
-                               $LL = $this->includeLL();
+                               $localLanguage = $GLOBALS['LANG']->includeLLFile('EXT:extra_page_cm_options/locallang.xlf', FALSE);
                                $localItems[] = 'spacer';
-                               $localItems['moreoptions'] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('label', $LL)), $backRef->excludeIcon(''), 'top.loadTopMenu(\'' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript() . '&cmLevel=1&subname=moreoptions\');return false;', 0, 1);
+                               $localItems['moreoptions'] = $backRef->linkItem(
+                                       $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('label', $localLanguage)),
+                                       $backRef->excludeIcon(''),
+                                       'top.loadTopMenu(\'' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript() . '&cmLevel=1&subname=moreoptions\');return false;',
+                                       0,
+                                       1
+                               );
                                if (!in_array('hide', $backRef->disabledItems) && is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']) && $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']) {
                                        $localItems['hide'] = $backRef->DB_hideUnhide($table, $backRef->rec, $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']);
                                }
                                if (!in_array('edit_access', $backRef->disabledItems) && is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) {
                                        $localItems['edit_access'] = $backRef->DB_editAccess($table, $uid);
                                }
-                               if (!in_array('edit_pageproperties', $backRef->disabledItems) && $table == 'pages' && $backRef->editPageIconSet) {
+                               if (!in_array('edit_pageproperties', $backRef->disabledItems) && $table === 'pages' && $backRef->editPageIconSet) {
                                        $localItems['edit_pageproperties'] = $backRef->DB_editPageProperties($uid);
                                }
                        }
                        // Find delete element among the input menu items and insert the local items just before that:
                        $c = 0;
                        $deleteFound = FALSE;
-                       foreach ($menuItems as $k => $value) {
+                       foreach ($menuItems as $key => $value) {
                                $c++;
-                               if (!strcmp($k, 'delete')) {
+                               if (!strcmp($key, 'delete')) {
                                        $deleteFound = TRUE;
                                        break;
                                }
@@ -94,13 +93,13 @@ class ExtraPageContextMenuOptions {
                } elseif ($subname === 'moreoptions') {
                        // If the page can be edited, then show this:
                        if ($backRef->editOK) {
-                               if (!in_array('move_wizard', $backRef->disabledItems) && ($table == 'pages' || $table == 'tt_content')) {
+                               if (!in_array('move_wizard', $backRef->disabledItems) && ($table === 'pages' || $table === 'tt_content')) {
                                        $localItems['move_wizard'] = $backRef->DB_moveWizard($table, $uid, $backRef->rec);
                                }
-                               if (!in_array('new_wizard', $backRef->disabledItems) && ($table == 'pages' || $table == 'tt_content')) {
+                               if (!in_array('new_wizard', $backRef->disabledItems) && ($table === 'pages' || $table === 'tt_content')) {
                                        $localItems['new_wizard'] = $backRef->DB_newWizard($table, $uid, $backRef->rec);
                                }
-                               if (!in_array('perms', $backRef->disabledItems) && $table == 'pages' && $GLOBALS['BE_USER']->check('modules', 'web_perm')) {
+                               if (!in_array('perms', $backRef->disabledItems) && $table === 'pages' && $GLOBALS['BE_USER']->check('modules', 'web_perm')) {
                                        $localItems['perms'] = $backRef->DB_perms($table, $uid, $backRef->rec);
                                }
                                if (!in_array('db_list', $backRef->disabledItems) && $GLOBALS['BE_USER']->check('modules', 'web_list')) {
@@ -108,7 +107,7 @@ class ExtraPageContextMenuOptions {
                                }
                        }
                        // Temporary mount point item:
-                       if ($table == 'pages') {
+                       if ($table === 'pages') {
                                $localItems['temp_mount_point'] = $backRef->DB_tempMountPoint($uid);
                        }
                        // Merge the locally made items into the current menu items passed to this function.
@@ -117,18 +116,6 @@ class ExtraPageContextMenuOptions {
                return $menuItems;
        }
 
-       /**
-        * Include local lang file.
-        *
-        * @return array Local lang array.
-        * @todo Define visibility
-        */
-       public function includeLL() {
-               $LOCAL_LANG = $GLOBALS['LANG']->includeLLFile('EXT:extra_page_cm_options/locallang.php', FALSE);
-               return $LOCAL_LANG;
-       }
-
 }
 
-
 ?>
\ No newline at end of file
index 9f09538..e9c1cb3 100755 (executable)
@@ -2,10 +2,10 @@
 if (!defined('TYPO3_MODE')) {
        die('Access denied.');
 }
-if (TYPO3_MODE == 'BE') {
+if (TYPO3_MODE === 'BE') {
        $GLOBALS['TBE_MODULES_EXT']['xMOD_alt_clickmenu']['extendCMclasses'][] = array(
                'name' => 'TYPO3\\CMS\\ExtraPageCmOptions\\ExtraPageContextMenuOptions',
-               'path' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'class.tx_extrapagecmoptions.php'
+               'path' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Classes/ExtraPageContextMenuOptions.php'
        );
 }
 ?>
\ No newline at end of file
index 32946e1..0e55fc6 100644 (file)
@@ -8,4 +8,4 @@
                        </trans-unit>
                </body>
        </file>
-</xliff>
+</xliff>
\ No newline at end of file