[TASK] Cleanup ext:info and ext:info_pagetsconfig 71/22271/5
authorWouter Wolters <typo3@wouterwolters.nl>
Fri, 12 Jul 2013 19:46:59 +0000 (21:46 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Tue, 30 Jul 2013 16:03:46 +0000 (18:03 +0200)
- Remove require_once calls
- Replace global $LANG and $BACK_PATH
- Make some function calls use real boolean

Change-Id: I6e913e183a8357076b55d84c961e1104d643e81e
Resolves: #49992
Releases: 6.2
Reviewed-on: https://review.typo3.org/22271
Reviewed-by: Oliver Klee
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/info/Classes/Controller/InfoModuleController.php
typo3/sysext/info/ext_tables.php
typo3/sysext/info/mod1/index.php
typo3/sysext/info_pagetsconfig/Classes/Controller/InfoPageTyposcriptConfigController.php
typo3/sysext/info_pagetsconfig/class.tx_infopagetsconfig_webinfo.php [deleted file]
typo3/sysext/info_pagetsconfig/ext_tables.php

index 4223a79..36deb8d 100644 (file)
@@ -35,7 +35,6 @@ namespace TYPO3\CMS\Info\Controller;
  */
 class InfoModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
 
-       // Internal, dynamic:
        /**
         * @todo Define visibility
         */
@@ -60,16 +59,23 @@ class InfoModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
        public $doc;
 
        /**
+        * Constructor
+        */
+       public function __construct() {
+               $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_mod_web_info.xlf');
+               $GLOBALS['BE_USER']->modAccess($GLOBALS['MCONF'], TRUE);
+       }
+
+       /**
         * Initialize module header etc and call extObjContent function
         *
         * @return void
-        * @todo Define visibility
         */
        public function main() {
                // Access check...
                // The page will show only if there is a valid page and if this page may be viewed by the user
                $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause);
-               $access = is_array($this->pageinfo) ? 1 : 0;
+               $access = is_array($this->pageinfo);
                if ($this->id && $access || $GLOBALS['BE_USER']->user['admin'] && !$this->id) {
                        $this->CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($this->pageinfo);
                        if ($GLOBALS['BE_USER']->user['admin'] && !$this->id) {
@@ -111,7 +117,12 @@ class InfoModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                        $docHeaderButtons = $this->getButtons();
                        $markers = array(
                                'CSH' => $docHeaderButtons['csh'],
-                               'FUNC_MENU' => \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
+                               'FUNC_MENU' => \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
+                                       $this->id,
+                                       'SET[function]',
+                                       $this->MOD_SETTINGS['function'],
+                                       $this->MOD_MENU['function']
+                               ),
                                'CONTENT' => $this->content
                        );
                        // Build the <body> for the module
@@ -132,7 +143,6 @@ class InfoModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
         * Print module content (from $this->content)
         *
         * @return void
-        * @todo Define visibility
         */
        public function printContent() {
                $this->content = $this->doc->insertStylesAndJS($this->content);
@@ -163,5 +173,4 @@ class InfoModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
 
 }
 
-
 ?>
\ No newline at end of file
index 152212d..2af24fb 100644 (file)
@@ -3,6 +3,11 @@ if (!defined('TYPO3_MODE')) {
        die('Access denied.');
 }
 if (TYPO3_MODE === 'BE') {
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('web', 'info', '', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'mod1/');
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule(
+               'web',
+               'info',
+               '',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'mod1/'
+       );
 }
 ?>
\ No newline at end of file
index 234117f..732194b 100755 (executable)
@@ -24,6 +24,7 @@
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * Module: Web>Info
  * Presents various page related information from extensions
 unset($MCONF);
 require __DIR__ . '/conf.php';
 require $BACK_PATH . 'init.php';
-$LANG->includeLLFile('EXT:lang/locallang_mod_web_info.xlf');
-$BE_USER->modAccess($MCONF, 1);
-/*
- * @deprecated since 6.0, the classname SC_mod_web_info_index and this file is obsolete
- * and will be removed with 6.2. The class was renamed and is now located at:
- * typo3/sysext/info/Classes/Controller/InfoModuleController.php
- */
-require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('info') . 'Classes/Controller/InfoModuleController.php';
-// Make instance:
+
 $SOBE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Info\\Controller\\InfoModuleController');
 $SOBE->init();
-// Include files?
-foreach ($SOBE->include_once as $INC_FILE) {
-       include_once $INC_FILE;
-}
 // Checking for first level external objects
 $SOBE->checkExtObj();
-// Repeat Include files! - if any files has been added by second-level extensions
-foreach ($SOBE->include_once as $INC_FILE) {
-       include_once $INC_FILE;
-}
 // Checking second level external objects
 $SOBE->checkSubExtObj();
 $SOBE->main();
index e73ad70..095dbf6 100644 (file)
@@ -37,30 +37,36 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
 class InfoPageTyposcriptConfigController extends \TYPO3\CMS\Backend\Module\AbstractFunctionModule {
 
        /**
+        * Constructor
+        */
+       public function __construct() {
+               $GLOBALS['LANG']->includeLLFile('EXT:info_pagetsconfig/locallang.xlf');
+       }
+
+       /**
         * Function menu initialization
         *
         * @return array Menu array
         * @todo Define visibility
         */
        public function modMenu() {
-               global $LANG;
                $modMenuAdd = array(
                        'tsconf_parts' => array(
-                               0 => $LANG->getLL('tsconf_parts_0'),
-                               1 => $LANG->getLL('tsconf_parts_1'),
-                               '1a' => $LANG->getLL('tsconf_parts_1a'),
-                               '1b' => $LANG->getLL('tsconf_parts_1b'),
-                               '1c' => $LANG->getLL('tsconf_parts_1c'),
-                               '1d' => $LANG->getLL('tsconf_parts_1d'),
-                               '1e' => $LANG->getLL('tsconf_parts_1e'),
-                               '1f' => $LANG->getLL('tsconf_parts_1f'),
-                               '1g' => $LANG->getLL('tsconf_parts_1g'),
+                               0 => $GLOBALS['LANG']->getLL('tsconf_parts_0'),
+                               1 => $GLOBALS['LANG']->getLL('tsconf_parts_1'),
+                               '1a' => $GLOBALS['LANG']->getLL('tsconf_parts_1a'),
+                               '1b' => $GLOBALS['LANG']->getLL('tsconf_parts_1b'),
+                               '1c' => $GLOBALS['LANG']->getLL('tsconf_parts_1c'),
+                               '1d' => $GLOBALS['LANG']->getLL('tsconf_parts_1d'),
+                               '1e' => $GLOBALS['LANG']->getLL('tsconf_parts_1e'),
+                               '1f' => $GLOBALS['LANG']->getLL('tsconf_parts_1f'),
+                               '1g' => $GLOBALS['LANG']->getLL('tsconf_parts_1g'),
                                2 => 'RTE.',
                                5 => 'TCEFORM.',
                                6 => 'TCEMAIN.',
                                3 => 'TSFE.',
                                4 => 'user.',
-                               99 => $LANG->getLL('tsconf_configFields')
+                               99 => $GLOBALS['LANG']->getLL('tsconf_configFields')
                        ),
                        'tsconf_alphaSort' => '1'
                );
@@ -76,34 +82,33 @@ class InfoPageTyposcriptConfigController extends \TYPO3\CMS\Backend\Module\Abstr
         * @return string HTML output
         */
        public function main() {
-               global $LANG;
                $menu = BackendUtility::getFuncMenu($this->pObj->id, 'SET[tsconf_parts]', $this->pObj->MOD_SETTINGS['tsconf_parts'], $this->pObj->MOD_MENU['tsconf_parts']);
                $menu .= '<br /><label for="checkTsconf_alphaSort">' . $GLOBALS['LANG']->getLL('sort_alphabetic', TRUE) . '</label> ' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[tsconf_alphaSort]', $this->pObj->MOD_SETTINGS['tsconf_alphaSort'], '', '', 'id="checkTsconf_alphaSort"');
                $menu .= '<br /><br />';
-               $theOutput = $this->pObj->doc->header($LANG->getLL('tsconf_title'));
+               $theOutput = $this->pObj->doc->header($GLOBALS['LANG']->getLL('tsconf_title'));
 
                if ($this->pObj->MOD_SETTINGS['tsconf_parts'] == 99) {
-                       $TSparts = BackendUtility::getPagesTSconfig($this->pObj->id, '', 1);
+                       $TSparts = BackendUtility::getPagesTSconfig($this->pObj->id, '', TRUE);
                        $lines = array();
                        $pUids = array();
                        foreach ($TSparts as $k => $v) {
                                if ($k != 'uid_0') {
                                        if ($k == 'defaultPageTSconfig') {
-                                               $pTitle = '<strong>' . $GLOBALS['LANG']->getLL('editTSconfig_default', 1) . '</strong>';
+                                               $pTitle = '<strong>' . $GLOBALS['LANG']->getLL('editTSconfig_default', TRUE) . '</strong>';
                                                $editIcon = '';
                                        } else {
                                                $pUids[] = substr($k, 4);
                                                $row = BackendUtility::getRecordWSOL('pages', substr($k, 4));
-                                               $pTitle = $this->pObj->doc->getHeader('pages', $row, '', 0);
+                                               $pTitle = $this->pObj->doc->getHeader('pages', $row, '', FALSE);
                                                $editIdList = substr($k, 4);
                                                $params = '&edit[pages][' . $editIdList . ']=edit&columnsOnly=TSconfig';
                                                $onclickUrl = BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'], '');
-                                               $editIcon = '<a href="#" onclick="' . htmlspecialchars($onclickUrl) . '" title="' . $GLOBALS['LANG']->getLL('editTSconfig', 1) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>';
+                                               $editIcon = '<a href="#" onclick="' . htmlspecialchars($onclickUrl) . '" title="' . $GLOBALS['LANG']->getLL('editTSconfig', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>';
                                        }
                                        $TScontent = nl2br(htmlspecialchars(trim($v) . chr(10)));
                                        $tsparser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
                                        $tsparser->lineNumberOffset = 0;
-                                       $TScontent = $tsparser->doSyntaxHighlight(trim($v) . LF, '', 0);
+                                       $TScontent = $tsparser->doSyntaxHighlight(trim($v) . LF);
                                        $lines[] = '
                                                <tr><td nowrap="nowrap" class="bgColor5">' . $pTitle . '</td></tr>
                                                <tr><td nowrap="nowrap" class="bgColor4">' . $TScontent . $editIcon . '</td></tr>
@@ -114,7 +119,7 @@ class InfoPageTyposcriptConfigController extends \TYPO3\CMS\Backend\Module\Abstr
                        if (count($pUids)) {
                                $params = '&edit[pages][' . implode(',', $pUids) . ']=edit&columnsOnly=TSconfig';
                                $onclickUrl = BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'], '');
-                               $editIcon = '<a href="#" onclick="' . htmlspecialchars($onclickUrl) . '" title="' . $GLOBALS['LANG']->getLL('editTSconfig_all', 1) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '<strong>' . $GLOBALS['LANG']->getLL('editTSconfig_all', 1) . '</strong>' . '</a>';
+                               $editIcon = '<a href="#" onclick="' . htmlspecialchars($onclickUrl) . '" title="' . $GLOBALS['LANG']->getLL('editTSconfig_all', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '<strong>' . $GLOBALS['LANG']->getLL('editTSconfig_all', TRUE) . '</strong>' . '</a>';
                        } else {
                                $editIcon = '';
                        }
@@ -203,5 +208,4 @@ class InfoPageTyposcriptConfigController extends \TYPO3\CMS\Backend\Module\Abstr
 
 }
 
-
 ?>
\ No newline at end of file
diff --git a/typo3/sysext/info_pagetsconfig/class.tx_infopagetsconfig_webinfo.php b/typo3/sysext/info_pagetsconfig/class.tx_infopagetsconfig_webinfo.php
deleted file mode 100755 (executable)
index 60cc959..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/*
- * @deprecated since 6.0, the classname tx_infopagetsconfig_webinfo and this file is obsolete
- * and will be removed with 6.2. The class was renamed and is now located at:
- * typo3/sysext/info_pagetsconfig/Classes/Controller/InfoPageTyposcriptConfigController.php
- */
-require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('info_pagetsconfig') . 'Classes/Controller/InfoPageTyposcriptConfigController.php';
-?>
\ No newline at end of file
index 28c5227..e197d59 100755 (executable)
@@ -2,8 +2,13 @@
 if (!defined('TYPO3_MODE')) {
        die('Access denied.');
 }
-if (TYPO3_MODE == 'BE') {
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::insertModuleFunction('web_info', 'tx_infopagetsconfig_webinfo', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'class.tx_infopagetsconfig_webinfo.php', 'LLL:EXT:info_pagetsconfig/locallang.xlf:mod_pagetsconfig');
+if (TYPO3_MODE === 'BE') {
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::insertModuleFunction(
+               'web_info',
+               'TYPO3\CMS\InfoPagetsconfig\Controller\InfoPageTyposcriptConfigController',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Classes/InfoPageTyposcriptConfigController.php',
+               'LLL:EXT:info_pagetsconfig/locallang.xlf:mod_pagetsconfig'
+       );
 }
 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_web_info', 'EXT:info_pagetsconfig/locallang_csh_webinfo.xlf');
 ?>
\ No newline at end of file